This is an automated email from the ASF dual-hosted git repository. guangmingchen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brpc.git
The following commit(s) were added to refs/heads/master by this push: new 6ef8b9dd Fix libunwind linked by default on x86_64 cpu when building via bazel (#2973) 6ef8b9dd is described below commit 6ef8b9ddeb8986920885ec24b1c38acbae6b5251 Author: tongke <124763920+tong...@users.noreply.github.com> AuthorDate: Sat May 24 20:07:54 2025 +0800 Fix libunwind linked by default on x86_64 cpu when building via bazel (#2973) * Fix libunwind linked by default on x86_64 cpu when build with bazel * fix errors in getting_started.md english version * add link libunwind instruction for bazel --- BUILD.bazel | 4 ++-- bazel/config/BUILD.bazel | 10 ++++++++++ docs/cn/getting_started.md | 2 +- docs/en/getting_started.md | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 4e0217fc..f6be0807 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -51,7 +51,7 @@ COPTS = [ "//bazel/config:brpc_with_debug_lock": ["-DBRPC_DEBUG_LOCK=1"], "//conditions:default": ["-DBRPC_DEBUG_LOCK=0"], }) + select({ - "@platforms//cpu:x86_64": ["-DBRPC_BTHREAD_TRACER"], + "//bazel/config:brpc_with_bthread_tracer": ["-DBRPC_BTHREAD_TRACER"], "//conditions:default": [], }) + select({ "//bazel/config:brpc_with_asan": ["-fsanitize=address"], @@ -412,7 +412,7 @@ cc_library( ":butil", ":bvar", ] + select({ - "@platforms//cpu:x86_64": ["@com_github_libunwind_libunwind//:libunwind"], + "//bazel/config:brpc_with_bthread_tracer": ["@com_github_libunwind_libunwind//:libunwind"], "//conditions:default": [], }), ) diff --git a/bazel/config/BUILD.bazel b/bazel/config/BUILD.bazel index 57569dd3..2c36be41 100644 --- a/bazel/config/BUILD.bazel +++ b/bazel/config/BUILD.bazel @@ -126,4 +126,14 @@ config_setting( name = "brpc_with_asan", define_values = {"with_asan": "true"}, visibility = ["//visibility:public"], +) + +config_setting( + name = "brpc_with_bthread_tracer", + constraint_values = [ + "@platforms//cpu:x86_64", + ], + define_values = { + "with_bthread_tracer": "true", + }, ) \ No newline at end of file diff --git a/docs/cn/getting_started.md b/docs/cn/getting_started.md index 1b91e15b..6dee100c 100644 --- a/docs/cn/getting_started.md +++ b/docs/cn/getting_started.md @@ -392,7 +392,7 @@ brpc会自动检测valgrind(然后注册bthread的栈)。不支持老版本 ## libunwind: 1.3-1.8.1 -bRPC默认**不**链接 [libunwind](https://github.com/libunwind/libunwind)。用户需要追踪bthread功能则链接libunwind,可以给config_brpc.sh增加`--with-bthread-tracer`选项或者给cmake增加`-DWITH_BTHREAD_TRACER=ON`选项。 +bRPC默认**不**链接 [libunwind](https://github.com/libunwind/libunwind)。用户需要追踪bthread功能则链接libunwind,可以给config_brpc.sh增加`--with-bthread-tracer`选项或者给cmake增加`-DWITH_BTHREAD_TRACER=ON`选项,如果是用 bazel 构建,请添加 `--define with_bthread_tracer=true` 选项。 建议使用最新版本的libunwind。 diff --git a/docs/en/getting_started.md b/docs/en/getting_started.md index b2363ce3..e4dd4039 100644 --- a/docs/en/getting_started.md +++ b/docs/en/getting_started.md @@ -385,7 +385,7 @@ brpc detects valgrind automatically (and registers stacks of bthread). Older val ## libunwind: 1.3-1.8.1 -brpc does **not** link [libunwind](https://github.com/libunwind/libunwind) by default. Users link libunwind on-demand by adding `--with-glog` to config_brpc.sh or adding `-DWITH_GLOG=ON` to cmake. +brpc does **not** link [libunwind](https://github.com/libunwind/libunwind) by default. Users link libunwind on-demand by adding `--with-bthread-tracer` to config_brpc.sh or adding `-DWITH_BTHREAD_TRACER=ON` to cmake, if building with Bazel, please add the `--define with_bthread_tracer=true` option. It is recommended to use the latest possible version of libunwind. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org