From 635b5630e397e3d845c8ade645b28dca8072e2d9 Mon Sep 17 00:00:00 2001 From: compiletheworld <106100979+compiletheworld@users.noreply.github.com> Date: Sun, 29 May 2022 17:33:59 +0800 Subject: [PATCH] [fix](third-party) Fix build issues of third-party in ubuntu docker (#9805) Fixes: 1. Fully static linkage of protoc may lead to core dump when using it. 2. Building libmyclient may fail due to miss-used option `-v` of `make` 3. Building lzma implicitly requires autopoint 4. Building xml2 implicitly requires pkg-config --- thirdparty/build-thirdparty.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh index 6b96aa271c..8cf569e4be 100755 --- a/thirdparty/build-thirdparty.sh +++ b/thirdparty/build-thirdparty.sh @@ -311,9 +311,16 @@ build_protobuf() { CXXFLAGS="-fPIC -O2 -I${TP_INCLUDE_DIR}" \ LDFLAGS="-L${TP_LIB_DIR} -static-libstdc++ -static-libgcc -Wl,--undefined=pthread_create" \ ./configure --prefix=${TP_INSTALL_DIR} --disable-shared --enable-static --with-zlib=${TP_INSTALL_DIR}/include - cd src - sed -i 's/^AM_LDFLAGS\(.*\)$/AM_LDFLAGS\1 -all-static/' Makefile - cd - + + # ATTN: If protoc is built fully statically with clang-14 on ubuntu, + # it may core dump when parse some protobuf source files. + # The root cause remains unknown, but it is possibly related glibc... + # And, we don't actually need to be that static, + # dyn-linking to glibc and etc. is OK + # cd src + # sed -i 's/^AM_LDFLAGS\(.*\)$/AM_LDFLAGS\1 -all-static/' Makefile + # cd - + make -j $PARALLEL && make install } @@ -525,7 +532,7 @@ build_mysql() { -DWITHOUT_SERVER=1 -DWITH_ZLIB=1 -DZLIB_ROOT=$TP_INSTALL_DIR \ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -std=gnu++11" \ -DDISABLE_SHARED=1 -DBUILD_SHARED_LIBS=0 -DZLIB_LIBRARY=$TP_INSTALL_DIR/lib/libz.a -DENABLE_DTRACE=0 - ${BUILD_SYSTEM} -v -j $PARALLEL mysqlclient + ${BUILD_SYSTEM} -j $PARALLEL mysqlclient # copy headers manually rm -rf ../../../installed/include/mysql/ @@ -868,6 +875,10 @@ build_aws_sdk() { # lzma build_lzma() { + if [ ! -x "$(command -v autopoint)" ]; then + echo "autopoint is required by $0, install it first" + return -1 + fi check_if_source_exist $LZMA_SOURCE cd $TP_SOURCE_DIR/$LZMA_SOURCE export ACLOCAL_PATH=/usr/share/aclocal @@ -879,6 +890,10 @@ build_lzma() { # xml2 build_xml2() { + if [ ! -x "$(command -v pkg-config)" ]; then + echo "pkg-config is required by $0, install it first" + return -1 + fi check_if_source_exist $XML2_SOURCE cd $TP_SOURCE_DIR/$XML2_SOURCE export ACLOCAL_PATH=/usr/share/aclocal