diff --git a/BUILD.bazel b/BUILD.bazel index 4e0217fc89..f6be0807d2 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 57569dd34e..2c36be414e 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 1b91e15b91..6dee100cc5 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 b2363ce39f..e4dd40390c 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.