Skip to content

Commit 99bd8d2

Browse files
committed
Fix compilation error with protobuf 24
1 parent a54b607 commit 99bd8d2

5 files changed

Lines changed: 100 additions & 189 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
inputs:
2+
protobuf-version:
3+
description: version of protobuf
4+
required: true
5+
env:
6+
description: action environment
7+
required: false
8+
runs:
9+
using: "composite"
10+
steps:
11+
- run: |
12+
sh ./.github/actions/compile-with-bazel-protobuf ${{inputs.protobuf-version}}
13+
bazel build --verbose_failures --action_env="${{inputs.env}}" -- //... -//example/...
14+
shell: bash

.github/workflows/ci-linux.yml

Lines changed: 83 additions & 186 deletions
Original file line numberDiff line numberDiff line change
@@ -15,222 +15,119 @@ env:
1515

1616
# https://github.com/actions/runner-images
1717
jobs:
18-
compile-with-make:
18+
gcc-compile-with-bazel:
1919
runs-on: ubuntu-22.04
2020
steps:
2121
- uses: actions/checkout@v2
22-
- uses: ./.github/actions/install-all-dependencies
22+
- name: protobuf 21.7
23+
uses: ./.github/actions/compile-with-bazel-protobuf
24+
with:
25+
protobuf-version: 21.7
26+
env: CC=gcc
2327

24-
- name: gcc with default options
25-
uses: ./.github/actions/compile-with-make
28+
- name: protobuf 23.1
29+
uses: ./.github/actions/compile-with-bazel-protobuf
2630
with:
27-
options: --headers=/usr/include --libs=/usr/lib /usr/lib64 --cc=gcc --cxx=g++ --werror
31+
protobuf-version: 23.1
32+
env: CC=gcc
2833

29-
- name: gcc with all options
30-
uses: ./.github/actions/compile-with-make
34+
- name: protobuf 24.4
35+
uses: ./.github/actions/compile-with-bazel-protobuf
3136
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
37+
protobuf-version: 24.4
38+
env: CC=gcc
3339

34-
- name: clang with default options
35-
uses: ./.github/actions/compile-with-make
40+
- name: protobuf 25.5
41+
uses: ./.github/actions/compile-with-bazel-protobuf
3642
with:
37-
options: --headers=/usr/include --libs=/usr/lib /usr/lib64 --cc=clang --cxx=clang++ --werror
43+
protobuf-version: 25.5
44+
env: CC=gcc
3845

39-
- name: clang with all options
40-
uses: ./.github/actions/compile-with-make
46+
- name: protobuf 26.0
47+
uses: ./.github/actions/compile-with-bazel-protobuf
4148
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
49+
protobuf-version: 26.0
50+
env: CC=gcc
4351

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
52+
- name: protobuf 27.0
53+
uses: ./.github/actions/compile-with-bazel-protobuf
54+
with:
55+
protobuf-version: 27.0
56+
env: CC=gcc
8157

82-
- name: protobuf 3.5.1
83-
uses: ./.github/actions/compile-with-make-protobuf
58+
- name: protobuf 28.0
59+
uses: ./.github/actions/compile-with-bazel-protobuf
8460
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
61+
protobuf-version: 28.0
62+
env: CC=gcc
8963

90-
- name: protobuf 3.12.4
91-
uses: ./.github/actions/compile-with-make-protobuf
64+
- name: protobuf 29.0
65+
uses: ./.github/actions/compile-with-bazel-protobuf
9266
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
67+
protobuf-version: 29.0
68+
env: CC=gcc
9769

98-
- name: protobuf 21.12
99-
uses: ./.github/actions/compile-with-make-protobuf
70+
- name: protobuf 30.0
71+
uses: ./.github/actions/compile-with-bazel-protobuf
10072
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
73+
protobuf-version: 30.0
74+
env: CC=gcc
10575

106-
gcc-compile-with-bazel:
76+
clang-compile-with-bazel:
10777
runs-on: ubuntu-22.04
10878
steps:
10979
- uses: actions/checkout@v2
110-
- run: bazel build --verbose_failures -- //... -//example/...
80+
- name: protobuf 21.7
81+
uses: ./.github/actions/compile-with-bazel-protobuf
82+
with:
83+
protobuf-version: 21.7
84+
env: CC=clang
11185

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/...
86+
- name: protobuf 23.1
87+
uses: ./.github/actions/compile-with-bazel-protobuf
88+
with:
89+
protobuf-version: 23.1
90+
env: CC=clang
11791

118-
gcc-compile-with-bazel-all-options:
119-
runs-on: ubuntu-22.04
120-
steps:
121-
- uses: actions/checkout@v2
122-
- run: |
123-
bazel build --verbose_failures \
124-
--define with_mesalink=false \
125-
--define with_glog=true \
126-
--define with_thrift=true \
127-
--define with_debug_bthread_sche_safety=true \
128-
--define with_debug_lock=true \
129-
--define with_asan=true \
130-
--define with_bthread_tracer=true \
131-
--define BRPC_WITH_NO_PTHREAD_MUTEX_HOOK=true \
132-
-- //... -//example/...
133-
134-
clang-compile-with-make-protobuf:
135-
runs-on: ubuntu-22.04
136-
steps:
137-
- uses: actions/checkout@v2
138-
- uses: ./.github/actions/install-essential-dependencies
92+
- name: protobuf 24.4
93+
uses: ./.github/actions/compile-with-bazel-protobuf
94+
with:
95+
protobuf-version: 24.4
96+
env: CC=clang
13997

140-
- name: protobuf 3.5.1
141-
uses: ./.github/actions/compile-with-make-protobuf
98+
- name: protobuf 25.5
99+
uses: ./.github/actions/compile-with-bazel-protobuf
142100
with:
143-
protobuf-version: 3.5.1
144-
protobuf-cpp-version: 3.5.1
145-
protobuf-install-dir: /protobuf-3.5.1
146-
config-brpc-options: --cc=clang --cxx=clang++ --werror
101+
protobuf-version: 25.5
102+
env: CC=clang
147103

148-
- name: protobuf 3.12.4
149-
uses: ./.github/actions/compile-with-make-protobuf
104+
- name: protobuf 26.0
105+
uses: ./.github/actions/compile-with-bazel-protobuf
150106
with:
151-
protobuf-version: 3.12.4
152-
protobuf-cpp-version: 3.12.4
153-
protobuf-install-dir: /protobuf-3.12.4
154-
config-brpc-options: --cc=clang --cxx=clang++ --werror
107+
protobuf-version: 26.0
108+
env: CC=clang
155109

156-
- name: protobuf 21.12
157-
uses: ./.github/actions/compile-with-make-protobuf
110+
- name: protobuf 27.0
111+
uses: ./.github/actions/compile-with-bazel-protobuf
158112
with:
159-
protobuf-version: 21.12
160-
protobuf-cpp-version: 3.21.12
161-
protobuf-install-dir: /protobuf-3.21.12
162-
config-brpc-options: --cc=clang --cxx=clang++ --werror
113+
protobuf-version: 27.0
114+
env: CC=clang
163115

164-
clang-compile-with-bazel:
165-
runs-on: ubuntu-22.04
166-
steps:
167-
- uses: actions/checkout@v2
168-
- run: bazel build --verbose_failures --action_env=CC=clang -- //... -//example/...
116+
- name: protobuf 28.0
117+
uses: ./.github/actions/compile-with-bazel-protobuf
118+
with:
119+
protobuf-version: 28.0
120+
env: CC=clang
169121

170-
clang-compile-with-boringssl:
171-
runs-on: ubuntu-22.04
172-
steps:
173-
- uses: actions/checkout@v2
174-
- 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/...
122+
- name: protobuf 29.0
123+
uses: ./.github/actions/compile-with-bazel-protobuf
124+
with:
125+
protobuf-version: 29.0
126+
env: CC=clang
127+
128+
- name: protobuf 30.0
129+
uses: ./.github/actions/compile-with-bazel-protobuf
130+
with:
131+
protobuf-version: 30.0
132+
env: CC=clang
175133

176-
clang-compile-with-bazel-all-options:
177-
runs-on: ubuntu-22.04
178-
steps:
179-
- uses: actions/checkout@v2
180-
- run: |
181-
bazel build --verbose_failures \
182-
--action_env=CC=clang \
183-
--define with_mesalink=false \
184-
--define with_glog=true \
185-
--define with_thrift=true \
186-
--define with_debug_bthread_sche_safety=true \
187-
--define with_debug_lock=true \
188-
--define with_asan=true \
189-
--define with_bthread_tracer=true \
190-
--define BRPC_WITH_NO_PTHREAD_MUTEX_HOOK=true \
191-
-- //... -//example/...
192-
193-
clang-unittest:
194-
runs-on: ubuntu-22.04
195-
steps:
196-
- uses: actions/checkout@v2
197-
- uses: ./.github/actions/install-essential-dependencies
198-
- uses: ./.github/actions/init-ut-make-config
199-
with:
200-
options: --with-bthread-tracer
201-
- name: compile tests
202-
run: |
203-
cat config.mk
204-
cd test
205-
make -j ${{env.proc_num}}
206-
- name: run tests
207-
run: |
208-
cd test
209-
sh ./run_tests.sh
210-
211-
clang-unittest-asan:
212-
runs-on: ubuntu-22.04
213-
steps:
214-
- uses: actions/checkout@v2
215-
- uses: ./.github/actions/install-essential-dependencies
216-
- uses: ./.github/actions/init-ut-make-config
217-
with:
218-
options: --with-bthread-tracer --with-asan
219-
- name: compile tests
220-
run: |
221-
cat config.mk
222-
cd test
223-
make NEED_GPERFTOOLS=0 -j ${{env.proc_num}}
224-
- name: run tests
225-
run: |
226-
cd test
227-
sh ./run_tests.sh
228-
229-
bazel-bvar-unittest:
230-
runs-on: ubuntu-22.04
231-
steps:
232-
- uses: actions/checkout@v2
233-
- run: bazel test --verbose_failures //test:bvar_test
234-
- run: bazel test --verbose_failures --define with_babylon_counter=true //test:bvar_test
235-
- run: bazel test --verbose_failures --action_env=CC=clang //test:bvar_test
236-
- run: bazel test --verbose_failures --action_env=CC=clang --define with_babylon_counter=true //test:bvar_test

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module(
88
bazel_dep(name = 'abseil-cpp', version = '20210324.2', repo_name = 'com_google_absl')
99
bazel_dep(name = 'bazel_skylib', version = '1.0.3')
1010
bazel_dep(name = 'boringssl', version = '0.0.0-20211025-d4f1ab9')
11-
bazel_dep(name = 'protobuf', version = '27.3', repo_name = 'com_google_protobuf')
11+
bazel_dep(name = 'protobuf', version = '27.2', repo_name = 'com_google_protobuf')
1212
bazel_dep(name = 'gflags', version = '2.2.2', repo_name = 'com_github_gflags_gflags')
1313
bazel_dep(name = 'glog', version = '0.5.0', repo_name = 'com_github_google_glog')
1414
bazel_dep(name = 'platforms', version = '0.0.4')

src/json2pb/json_to_pb.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ bool JsonValueToProtoMessage(const BUTIL_RAPIDJSON_NAMESPACE::Value& json_value,
553553
for (int i = 0; i < descriptor->extension_range_count(); ++i) {
554554
const google::protobuf::Descriptor::ExtensionRange*
555555
ext_range = descriptor->extension_range(i);
556-
#if GOOGLE_PROTOBUF_VERSION < 4025000
556+
#if GOOGLE_PROTOBUF_VERSION < 4024000
557557
for (int tag_number = ext_range->start; tag_number < ext_range->end; ++tag_number)
558558
#else
559559
for (int tag_number = ext_range->start_number(); tag_number < ext_range->end_number(); ++tag_number)

src/json2pb/pb_to_json.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ bool PbToJsonConverter::Convert(const google::protobuf::Message& message, Handle
134134
for (int i = 0; i < ext_range_count; ++i) {
135135
const google::protobuf::Descriptor::ExtensionRange*
136136
ext_range = descriptor->extension_range(i);
137-
#if GOOGLE_PROTOBUF_VERSION < 4025000
137+
#if GOOGLE_PROTOBUF_VERSION < 4024000
138138
for (int tag_number = ext_range->start; tag_number < ext_range->end; ++tag_number)
139139
#else
140140
for (int tag_number = ext_range->start_number(); tag_number < ext_range->end_number(); ++tag_number)

0 commit comments

Comments
 (0)