Skip to content

Commit 6ef8b9d

Browse files
authored
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
1 parent 5b0a6c1 commit 6ef8b9d

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ COPTS = [
5151
"//bazel/config:brpc_with_debug_lock": ["-DBRPC_DEBUG_LOCK=1"],
5252
"//conditions:default": ["-DBRPC_DEBUG_LOCK=0"],
5353
}) + select({
54-
"@platforms//cpu:x86_64": ["-DBRPC_BTHREAD_TRACER"],
54+
"//bazel/config:brpc_with_bthread_tracer": ["-DBRPC_BTHREAD_TRACER"],
5555
"//conditions:default": [],
5656
}) + select({
5757
"//bazel/config:brpc_with_asan": ["-fsanitize=address"],
@@ -412,7 +412,7 @@ cc_library(
412412
":butil",
413413
":bvar",
414414
] + select({
415-
"@platforms//cpu:x86_64": ["@com_github_libunwind_libunwind//:libunwind"],
415+
"//bazel/config:brpc_with_bthread_tracer": ["@com_github_libunwind_libunwind//:libunwind"],
416416
"//conditions:default": [],
417417
}),
418418
)

bazel/config/BUILD.bazel

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,14 @@ config_setting(
126126
name = "brpc_with_asan",
127127
define_values = {"with_asan": "true"},
128128
visibility = ["//visibility:public"],
129+
)
130+
131+
config_setting(
132+
name = "brpc_with_bthread_tracer",
133+
constraint_values = [
134+
"@platforms//cpu:x86_64",
135+
],
136+
define_values = {
137+
"with_bthread_tracer": "true",
138+
},
129139
)

docs/cn/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ brpc会自动检测valgrind(然后注册bthread的栈)。不支持老版本
392392

393393
## libunwind: 1.3-1.8.1
394394

395-
bRPC默认****链接 [libunwind](https://github.com/libunwind/libunwind)。用户需要追踪bthread功能则链接libunwind,可以给config_brpc.sh增加`--with-bthread-tracer`选项或者给cmake增加`-DWITH_BTHREAD_TRACER=ON`选项。
395+
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` 选项
396396

397397
建议使用最新版本的libunwind。
398398

docs/en/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ brpc detects valgrind automatically (and registers stacks of bthread). Older val
385385

386386
## libunwind: 1.3-1.8.1
387387

388-
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.
388+
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.
389389

390390
It is recommended to use the latest possible version of libunwind.
391391

0 commit comments

Comments
 (0)