Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "[fix](proto) upgrade protobuf to 21.11" #44202

Open
wants to merge 1 commit into
base: branch-2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 27 additions & 13 deletions thirdparty/build-thirdparty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -416,27 +416,41 @@ build_thrift() {
build_protobuf() {
check_if_source_exist "${PROTOBUF_SOURCE}"
cd "${TP_SOURCE_DIR}/${PROTOBUF_SOURCE}"
rm -fr gmock

# NOTE(amos): -Wl,--undefined=pthread_create force searching for pthread symbols.
# See https://stackoverflow.com/a/65348893/1329147 for detailed explanation.
mkdir gmock
cd gmock
tar xf "${TP_SOURCE_DIR}/${GTEST_NAME}"

mv "${GTEST_SOURCE}" gtest

cd "${TP_SOURCE_DIR}/${PROTOBUF_SOURCE}"

./autogen.sh

if [[ "${KERNEL}" == 'Darwin' ]]; then
ldflags="-L${TP_LIB_DIR}"
else
ldflags="-L${TP_LIB_DIR} -static-libstdc++ -static-libgcc -Wl,--undefined=pthread_create"
fi

mkdir -p cmake/build
cd cmake/build

CXXFLAGS="-O2 -I${TP_INCLUDE_DIR}" \
CXXFLAGS="-fPIC -O2 -I${TP_INCLUDE_DIR}" \
LDFLAGS="${ldflags}" \
"${CMAKE_CMD}" -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${TP_INSTALL_DIR}" \
-Dprotobuf_USE_EXTERNAL_GTEST=ON \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-Dprotobuf_BUILD_SHARED_LIBS=OFF \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_WITH_ZLIB_DEFAULT=ON \
-Dprotobuf_ABSL_PROVIDER=package \
-DCMAKE_INSTALL_PREFIX="${TP_INSTALL_DIR}" ../..
./configure --prefix="${TP_INSTALL_DIR}" --disable-shared --enable-static --with-zlib="${TP_INSTALL_DIR}/include"

# ATTN: If protoc is not built fully statically the linktime libc may newer than runtime.
# This will casue protoc cannot run
# If you really need to dynamically link protoc, please set the environment variable DYN_LINK_PROTOC=1

if [[ "${DYN_LINK_PROTOC:-0}" == "1" || "${KERNEL}" == 'Darwin' ]]; then
echo "link protoc dynamiclly"
else
cd src
sed -i 's/^AM_LDFLAGS\(.*\)$/AM_LDFLAGS\1 -all-static/' Makefile
cd -
fi

make -j "${PARALLEL}"
make install
Expand Down
9 changes: 4 additions & 5 deletions thirdparty/vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,10 @@ THRIFT_SOURCE=thrift-0.16.0
THRIFT_MD5SUM="44cf1b54b4ec1890576c85804acfa637"

# protobuf
# brpc is not yet compatible with protobuf >= 22
PROTOBUF_DOWNLOAD="https://github.com/protocolbuffers/protobuf/releases/download/v21.11/protobuf-all-21.11.tar.gz"
PROTOBUF_NAME="protobuf-all-21.11.tar.gz"
PROTOBUF_SOURCE=protobuf-21.11
PROTOBUF_MD5SUM="b3b104f0374802e1add5d5d7a5a845ac"
PROTOBUF_DOWNLOAD="https://github.com/google/protobuf/archive/v3.15.0.tar.gz"
PROTOBUF_NAME=protobuf-3.15.0.tar.gz
PROTOBUF_SOURCE=protobuf-3.15.0
PROTOBUF_MD5SUM="3fb6c41f7b3c621424543f43d54baa42"

# gflags
GFLAGS_DOWNLOAD="https://github.com/gflags/gflags/archive/v2.2.2.tar.gz"
Expand Down
Loading