Skip to content

Commit 2d0feb3

Browse files
committed
Bugfix: task tracer
1 parent 5bc6da6 commit 2d0feb3

8 files changed

Lines changed: 109 additions & 401 deletions

File tree

.github/actions/init-ut-make-config/action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ runs:
77
steps:
88
- run: |
99
sudo apt-get update && sudo apt-get install -y clang-12 lldb-12 lld-12 libgtest-dev cmake gdb libstdc++6-11-dbg
10+
shell: bash
11+
- run: |
1012
cd /usr/src/gtest && export CC=clang-12 && export CXX=clang++-12 && sudo cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 .
1113
sudo make -j ${{env.proc_num}} && sudo mv lib/libgtest* /usr/lib/
1214
shell: bash
@@ -22,5 +24,11 @@ runs:
2224
sudo ./autogen.sh && sudo CC=clang-12 CXX=clang++-12 ./configure --prefix=/gperftools --enable-frame-pointers
2325
sudo make -j ${{env.proc_num}} && sudo make install
2426
shell: bash
25-
- run: sh config_brpc.sh --headers="/libunwind/include /gperftools/include /usr/include" --libs="/libunwind/lib /gperftools/lib /usr/lib /usr/lib64" ${{inputs.options}}
27+
- run: |
28+
sudo git clone https://github.com/abseil/abseil-cpp.git
29+
cd abseil-cpp && sudo git checkout lts_2022_06_23 && sudo mkdir -p /abseil-cpp
30+
sudo CC=clang-12 CXX=clang++-12 cmake -DBUILD_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=/abseil-cpp -DCMAKE_POLICY_VERSION_MINIMUM=3.5 .
31+
sudo make -j ${{env.proc_num}} && sudo make install && ls /abseil-cpp/lib
32+
shell: bash
33+
- run: sh config_brpc.sh --headers="/libunwind/include /gperftools/include /abseil-cpp/include /usr/include" --libs="/libunwind/lib /gperftools/lib /abseil-cpp/lib /usr/lib /usr/lib64" ${{inputs.options}} && cat config.mk
2634
shell: bash

.github/workflows/ci-linux.yml

Lines changed: 1 addition & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -15,160 +15,6 @@ env:
1515

1616
# https://github.com/actions/runner-images
1717
jobs:
18-
compile-with-make:
19-
runs-on: ubuntu-22.04
20-
steps:
21-
- uses: actions/checkout@v2
22-
- uses: ./.github/actions/install-all-dependencies
23-
24-
- name: gcc with default options
25-
uses: ./.github/actions/compile-with-make
26-
with:
27-
options: --headers=/usr/include --libs=/usr/lib /usr/lib64 --cc=gcc --cxx=g++ --werror
28-
29-
- name: gcc with all options
30-
uses: ./.github/actions/compile-with-make
31-
with:
32-
options: --headers=/usr/include --libs=/usr/lib /usr/lib64 --cc=gcc --cxx=g++ --werror --with-thrift --with-glog --with-rdma --with-debug-bthread-sche-safety --with-debug-lock --with-bthread-tracer --with-asan
33-
34-
- name: clang with default options
35-
uses: ./.github/actions/compile-with-make
36-
with:
37-
options: --headers=/usr/include --libs=/usr/lib /usr/lib64 --cc=clang --cxx=clang++ --werror
38-
39-
- name: clang with all options
40-
uses: ./.github/actions/compile-with-make
41-
with:
42-
options: --headers=/usr/include --libs=/usr/lib /usr/lib64 --cc=clang --cxx=clang++ --werror --with-thrift --with-glog --with-rdma --with-debug-bthread-sche-safety --with-debug-lock --with-bthread-tracer --with-asan
43-
44-
compile-with-cmake:
45-
runs-on: ubuntu-22.04
46-
steps:
47-
- uses: actions/checkout@v2
48-
- uses: ./.github/actions/install-all-dependencies
49-
50-
- name: gcc with default options
51-
run: |
52-
export CC=gcc && export CXX=g++
53-
mkdir gcc_build && cd gcc_build && cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
54-
make -j ${{env.proc_num}} && make clean
55-
56-
- name: gcc with all options
57-
run: |
58-
export CC=gcc && export CXX=g++
59-
mkdir gcc_build_all && cd gcc_build_all
60-
cmake -DWITH_MESALINK=OFF -DWITH_GLOG=ON -DWITH_THRIFT=ON -DWITH_RDMA=ON -DWITH_DEBUG_BTHREAD_SCHE_SAFETY=ON -DWITH_DEBUG_LOCK=ON -DWITH_BTHREAD_TRACER=ON -DWITH_ASAN=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
61-
make -j ${{env.proc_num}} && make clean
62-
63-
- name: clang with default options
64-
run: |
65-
export CC=clang && export CXX=clang++
66-
mkdir clang_build && cd clang_build && cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
67-
make -j ${{env.proc_num}} && make clean
68-
69-
- name: clang with all options
70-
run: |
71-
export CC=clang && export CXX=clang++
72-
mkdir clang_build_all && cd clang_build_all
73-
cmake -DWITH_MESALINK=OFF -DWITH_GLOG=ON -DWITH_THRIFT=ON -DWITH_RDMA=ON -DWITH_DEBUG_BTHREAD_SCHE_SAFETY=ON -DWITH_DEBUG_LOCK=ON -DWITH_BTHREAD_TRACER=ON -DWITH_ASAN=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
74-
make -j ${{env.proc_num}} && make clean
75-
76-
gcc-compile-with-make-protobuf:
77-
runs-on: ubuntu-22.04
78-
steps:
79-
- uses: actions/checkout@v2
80-
- uses: ./.github/actions/install-essential-dependencies
81-
82-
- name: protobuf 3.5.1
83-
uses: ./.github/actions/compile-with-make-protobuf
84-
with:
85-
protobuf-version: 3.5.1
86-
protobuf-cpp-version: 3.5.1
87-
protobuf-install-dir: /protobuf-3.5.1
88-
config-brpc-options: --cc=gcc --cxx=g++ --werror
89-
90-
- name: protobuf 3.12.4
91-
uses: ./.github/actions/compile-with-make-protobuf
92-
with:
93-
protobuf-version: 3.12.4
94-
protobuf-cpp-version: 3.12.4
95-
protobuf-install-dir: /protobuf-3.12.4
96-
config-brpc-options: --cc=gcc --cxx=g++ --werror
97-
98-
- name: protobuf 21.12
99-
uses: ./.github/actions/compile-with-make-protobuf
100-
with:
101-
protobuf-version: 21.12
102-
protobuf-cpp-version: 3.21.12
103-
protobuf-install-dir: /protobuf-3.21.12
104-
config-brpc-options: --cc=gcc --cxx=g++ --werror
105-
106-
gcc-compile-with-bazel:
107-
runs-on: ubuntu-22.04
108-
steps:
109-
- uses: actions/checkout@v2
110-
- run: bazel build --verbose_failures -- //... -//example/...
111-
112-
gcc-compile-with-boringssl:
113-
runs-on: ubuntu-22.04
114-
steps:
115-
- uses: actions/checkout@v2
116-
- run: bazel build --verbose_failures --define with_mesalink=false --define with_glog=true --define with_thrift=true --define BRPC_WITH_BORINGSSL=true -- //... -//example/...
117-
118-
gcc-compile-with-bazel-all-options:
119-
runs-on: ubuntu-22.04
120-
steps:
121-
- uses: actions/checkout@v2
122-
- run: bazel build --verbose_failures --define with_mesalink=false --define with_glog=true --define with_thrift=true --define with_debug_bthread_sche_safety=true --define with_debug_lock=true --define with_asan=true -- //... -//example/...
123-
124-
clang-compile-with-make-protobuf:
125-
runs-on: ubuntu-22.04
126-
steps:
127-
- uses: actions/checkout@v2
128-
- uses: ./.github/actions/install-essential-dependencies
129-
130-
- name: protobuf 3.5.1
131-
uses: ./.github/actions/compile-with-make-protobuf
132-
with:
133-
protobuf-version: 3.5.1
134-
protobuf-cpp-version: 3.5.1
135-
protobuf-install-dir: /protobuf-3.5.1
136-
config-brpc-options: --cc=clang --cxx=clang++ --werror
137-
138-
- name: protobuf 3.12.4
139-
uses: ./.github/actions/compile-with-make-protobuf
140-
with:
141-
protobuf-version: 3.12.4
142-
protobuf-cpp-version: 3.12.4
143-
protobuf-install-dir: /protobuf-3.12.4
144-
config-brpc-options: --cc=clang --cxx=clang++ --werror
145-
146-
- name: protobuf 21.12
147-
uses: ./.github/actions/compile-with-make-protobuf
148-
with:
149-
protobuf-version: 21.12
150-
protobuf-cpp-version: 3.21.12
151-
protobuf-install-dir: /protobuf-3.21.12
152-
config-brpc-options: --cc=clang --cxx=clang++ --werror
153-
154-
clang-compile-with-bazel:
155-
runs-on: ubuntu-22.04
156-
steps:
157-
- uses: actions/checkout@v2
158-
- run: bazel build --verbose_failures --action_env=CC=clang -- //... -//example/...
159-
160-
clang-compile-with-boringssl:
161-
runs-on: ubuntu-22.04
162-
steps:
163-
- uses: actions/checkout@v2
164-
- run: bazel build --verbose_failures --action_env=CC=clang --define with_mesalink=false --define with_glog=true --define with_thrift=true --define BRPC_WITH_BORINGSSL=true -- //... -//example/...
165-
166-
clang-compile-with-bazel-all-options:
167-
runs-on: ubuntu-22.04
168-
steps:
169-
- uses: actions/checkout@v2
170-
- run: bazel build --verbose_failures --action_env=CC=clang --define with_mesalink=false --define with_glog=true --define with_thrift=true --define with_debug_bthread_sche_safety=true --define with_debug_lock=true --define with_asan=true -- //... -//example/...
171-
17218
clang-unittest:
17319
runs-on: ubuntu-22.04
17420
steps:
@@ -181,25 +27,7 @@ jobs:
18127
run: |
18228
cat config.mk
18329
cd test
184-
make -j ${{env.proc_num}}
185-
- name: run tests
186-
run: |
187-
cd test
188-
sh ./run_tests.sh
189-
190-
clang-unittest-asan:
191-
runs-on: ubuntu-22.04
192-
steps:
193-
- uses: actions/checkout@v2
194-
- uses: ./.github/actions/install-essential-dependencies
195-
- uses: ./.github/actions/init-ut-make-config
196-
with:
197-
options: --cc=clang-12 --cxx=clang++-12 --with-bthread-tracer --with-asan
198-
- name: compile tests
199-
run: |
200-
cat config.mk
201-
cd test
202-
make NEED_GPERFTOOLS=0 -j ${{env.proc_num}}
30+
make -j ${{env.proc_num}} bthread_unittest
20331
- name: run tests
20432
run: |
20533
cd test

.github/workflows/ci-macos.yml

Lines changed: 0 additions & 65 deletions
This file was deleted.

MODULE.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ bazel_dep(name = "apple_support", version = "1.17.1")
1616
bazel_dep(name = 'rules_cc', version = '0.0.1')
1717
bazel_dep(name = 'rules_proto', version = '4.0.0')
1818
bazel_dep(name = 'zlib', version = '1.3.1.bcr.5', repo_name = 'com_github_madler_zlib')
19-
bazel_dep(name = "libunwind", version = "1.8.1", repo_name = 'com_github_libunwind_libunwind')
19+
bazel_dep(name = 'libunwind', version = '1.8.1', repo_name = 'com_github_libunwind_libunwind')
20+
bazel_dep(name = 'abseil-cpp', version = '20220623.1', repo_name = 'com_google_absl')
2021

2122
# --registry=https://baidu.github.io/babylon/registry
2223
bazel_dep(name = 'leveldb', version = '1.23', repo_name = 'com_github_google_leveldb')

config_brpc.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,12 @@ GFLAGS_HDR=$(find_dir_of_header_or_die gflags/gflags.h)
266266

267267
PROTOBUF_HDR=$(find_dir_of_header_or_die google/protobuf/message.h)
268268
PROTOBUF_VERSION=$(grep '#define GOOGLE_PROTOBUF_VERSION [0-9]\+' $PROTOBUF_HDR/google/protobuf/stubs/common.h | awk '{print $3}')
269-
if [ "$PROTOBUF_VERSION" -ge 4022000 ]; then
269+
# 如果protobuf版本大于等于4.22.0或者$WITH_BTHREAD_TRACER不等于0,则需要链接absl库
270+
if [ "$PROTOBUF_VERSION" -ge 4022000 ] || [ $WITH_BTHREAD_TRACER != 0 ]; then
270271
ABSL_HDR=$(find_dir_of_header_or_die absl/base/config.h)
271272
ABSL_LIB=$(find_dir_of_lib_or_die absl_strings)
273+
ABSL_LIB=$(find_dir_of_lib_or_die absl_stacktrace)
274+
ABSL_LIB=$(find_dir_of_lib_or_die absl_symbolize)
272275
ABSL_TARGET_NAMES="
273276
absl_bad_optional_access
274277
absl_bad_variant_access
@@ -336,12 +339,22 @@ if [ "$PROTOBUF_VERSION" -ge 4022000 ]; then
336339
absl_time
337340
absl_time_zone
338341
"
342+
if [ -f $ABSL_LIB/libabsl_strings.a ]; then
343+
STATIC_LINKINGS="$STATIC_LINKINGS -Wl,--start-group"
344+
else
345+
DYNAMIC_LINKINGS="$DYNAMIC_LINKINGS -Wl,--start-group"
346+
fi
339347
for i in $ABSL_TARGET_NAMES; do
340348
# ignore interface targets
341349
if [ -n "$(find_dir_of_lib $i)" ]; then
342350
append_linking "$ABSL_LIB" "$i"
343351
fi
344352
done
353+
if [ -f $ABSL_LIB/libabsl_strings.a ]; then
354+
STATIC_LINKINGS="$STATIC_LINKINGS -Wl,--end-group"
355+
else
356+
DYNAMIC_LINKINGS="$DYNAMIC_LINKINGS -Wl,--end-group"
357+
fi
345358
CXXFLAGS="-std=c++17"
346359
else
347360
CXXFLAGS="-std=c++0x"

0 commit comments

Comments
 (0)