[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
This commit is contained in:
compiletheworld
2022-05-29 17:33:59 +08:00
committed by GitHub
parent e231273ddf
commit 635b5630e3

View File

@ -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