Skip to content

Commit

Permalink
Fix centos 6 build
Browse files Browse the repository at this point in the history
  • Loading branch information
amosbird committed Jan 18, 2022
1 parent 4b441f8 commit 0b2714d
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 17 deletions.
2 changes: 1 addition & 1 deletion be/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ endif()
# NOTE(amos): This should come before -lc -lm to interpose symbols correctly.
if (GLIBC_COMPATIBILITY)
add_subdirectory(${SRC_DIR}/glibc-compatibility)
set(DORIS_LINK_LIBS ${DORIS_LINK_LIBS} glibc-compatibility-getrandom glibc-compatibility)
set(DORIS_LINK_LIBS ${DORIS_LINK_LIBS} glibc-compatibility-explicit glibc-compatibility)
endif()

set(DORIS_LINK_LIBS ${DORIS_LINK_LIBS}
Expand Down
9 changes: 6 additions & 3 deletions be/src/glibc-compatibility/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if (GLIBC_COMPATIBILITY)
list(APPEND glibc_compatibility_sources musl/getentropy.c)
endif()

list(REMOVE_ITEM glibc_compatibility_sources musl/getrandom.c)
list(REMOVE_ITEM glibc_compatibility_sources musl/getrandom.c memcpy_wrapper.c)

# Need to omit frame pointers to match the performance of glibc
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer")
Expand All @@ -57,7 +57,10 @@ if (GLIBC_COMPATIBILITY)
# without glibc-compatibility. Also sanitizers might generate getrandom
# libcalls. Workaround: Use object file so that linker will always take a
# look at its symbol table.
add_library(glibc-compatibility-getrandom OBJECT musl/getrandom.c)
# NOTE(amos): sanitizers might generate memcpy references that are too late to
# refer. Let's also extract memcpy definitions explicitly to avoid UNDEF GLIBC 2.14.
add_library(glibc-compatibility-explicit OBJECT musl/getrandom.c memcpy_wrapper.c)
target_compile_options(glibc-compatibility-explicit PRIVATE -fPIC)
add_library(glibc-compatibility STATIC ${glibc_compatibility_sources})

if (COMPILER_CLANG)
Expand All @@ -67,7 +70,7 @@ if (GLIBC_COMPATIBILITY)
endif ()

target_include_directories(glibc-compatibility PRIVATE ${musl_arch_include_dir})
target_include_directories(glibc-compatibility-getrandom PRIVATE ${musl_arch_include_dir})
target_include_directories(glibc-compatibility-explicit PRIVATE ${musl_arch_include_dir})

message (STATUS "Some symbols from glibc will be replaced for compatibility")
else()
Expand Down
Binary file modified be/test/plugin/plugin_test/source/test.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion be/test/plugin/plugin_test/source/test.zip.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c68ae6cce50da90a5fd8a818d4e85c96 test.zip
726cac15e3326403285c19c66fe2c44b test.zip
11 changes: 7 additions & 4 deletions env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ if [[ "${DORIS_TOOLCHAIN}" == "gcc" ]]; then
fi
export CC=${DORIS_GCC_HOME}/bin/gcc
export CXX=${DORIS_GCC_HOME}/bin/g++
if test -x ${DORIS_GCC_HOME}/bin/ld; then
export DORIS_BIN_UTILS=${DORIS_GCC_HOME}/bin/
fi
elif [[ "${DORIS_TOOLCHAIN}" == "clang" ]]; then
# set CLANG HOME
if [[ -z ${DORIS_CLANG_HOME} ]]; then
Expand All @@ -85,15 +88,15 @@ elif [[ "${DORIS_TOOLCHAIN}" == "clang" ]]; then
fi
export CC=${DORIS_CLANG_HOME}/bin/clang
export CXX=${DORIS_CLANG_HOME}/bin/clang++
if test -x ${DORIS_CLANG_HOME}/bin/ld.lld; then
export DORIS_BIN_UTILS=${DORIS_CLANG_HOME}/bin/
fi
else
echo "Error: unknown DORIS_TOOLCHAIN=${DORIS_TOOLCHAIN}, currently only 'gcc' and 'clang' are supported"
exit 1
fi

# find binutils
if test -x ${DORIS_GCC_HOME}/bin/ld; then
export DORIS_BIN_UTILS=${DORIS_GCC_HOME}/bin/
else
if [ -z "$DORIS_BIN_UTILS" ]; then
export DORIS_BIN_UTILS=/usr/bin/
fi

Expand Down
20 changes: 12 additions & 8 deletions thirdparty/build-thirdparty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ build_thrift() {
cd $TP_SOURCE_DIR/$THRIFT_SOURCE

echo ${TP_LIB_DIR}
./configure CPPFLAGS="-I${TP_INCLUDE_DIR}" LDFLAGS="-L${TP_LIB_DIR} -static-libstdc++ -static-libgcc" LIBS="-lcrypto -ldl -lssl" CFLAGS="-fPIC" \
# NOTE(amos): libtool discard -static. --static works.
./configure CPPFLAGS="-I${TP_INCLUDE_DIR}" LDFLAGS="-L${TP_LIB_DIR} --static" LIBS="-lcrypto -ldl -lssl" CFLAGS="-fPIC" \
--prefix=$TP_INSTALL_DIR --docdir=$TP_INSTALL_DIR/doc --enable-static --disable-shared --disable-tests \
--disable-tutorial --without-qt4 --without-qt5 --without-csharp --without-erlang --without-nodejs \
--without-lua --without-perl --without-php --without-php_extension --without-dart --without-ruby \
Expand Down Expand Up @@ -468,6 +469,7 @@ build_boost() {
check_if_source_exist $BOOST_SOURCE
cd $TP_SOURCE_DIR/$BOOST_SOURCE

CXXFLAGS="-static" \
./bootstrap.sh --prefix=$TP_INSTALL_DIR --with-toolset=$boost_toolset
# -q: Fail at first error
./b2 -q link=static runtime-link=static -j $PARALLEL --without-mpi --without-graph --without-graph_parallel --without-python cxxflags="-std=c++11 -g -fPIC -I$TP_INCLUDE_DIR -L$TP_LIB_DIR" install
Expand All @@ -486,11 +488,13 @@ build_mysql() {
cp -rf $TP_SOURCE_DIR/$BOOST_SOURCE ./
fi

${CMAKE_CMD} -G "${GENERATOR}" ../ -DWITH_BOOST=`pwd`/$BOOST_SOURCE -DCMAKE_INSTALL_PREFIX=$TP_INSTALL_DIR/mysql/ \
-DCMAKE_INCLUDE_PATH=$TP_INCLUDE_DIR -DWITHOUT_SERVER=1 -DWITH_ZLIB=$TP_INSTALL_DIR \
CFLAGS="-static -pthread -lrt" CXXFLAGS="-static -pthread -lrt" \
${CMAKE_CMD} -G "${GENERATOR}" ../ -DCMAKE_LINK_SEARCH_END_STATIC=1 \
-DWITH_BOOST=`pwd`/$BOOST_SOURCE -DCMAKE_INSTALL_PREFIX=$TP_INSTALL_DIR/mysql/ \
-DCMAKE_INCLUDE_PATH=$TP_INCLUDE_DIR -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} -j $PARALLEL mysqlclient
${BUILD_SYSTEM} -v -j $PARALLEL mysqlclient

# copy headers manually
rm -rf ../../../installed/include/mysql/
Expand Down Expand Up @@ -612,8 +616,8 @@ build_arrow() {
export ARROW_Thrift_URL=${TP_SOURCE_DIR}/${THRIFT_NAME}
export ARROW_SNAPPY_URL=${TP_SOURCE_DIR}/${SNAPPY_NAME}
export ARROW_ZLIB_URL=${TP_SOURCE_DIR}/${ZLIB_NAME}
export LDFLAGS="-L${TP_LIB_DIR} -static-libstdc++ -static-libgcc"

LDFLAGS="-L${TP_LIB_DIR} -static-libstdc++ -static-libgcc" \
${CMAKE_CMD} -G "${GENERATOR}" -DARROW_PARQUET=ON -DARROW_IPC=ON -DARROW_BUILD_SHARED=OFF \
-DARROW_BUILD_STATIC=ON -DARROW_WITH_BROTLI=ON -DARROW_WITH_LZ4=ON -DARROW_USE_GLOG=ON \
-DARROW_WITH_SNAPPY=ON -DARROW_WITH_ZLIB=ON -DARROW_WITH_ZSTD=ON -DARROW_JSON=ON \
Expand Down Expand Up @@ -787,8 +791,8 @@ build_orc() {
build_cctz() {
check_if_source_exist $CCTZ_SOURCE
cd $TP_SOURCE_DIR/$CCTZ_SOURCE
export PREFIX=$TP_INSTALL_DIR
make -j $PARALLEL && make install
PREFIX=$TP_INSTALL_DIR make -j $PARALLEL
PREFIX=$TP_INSTALL_DIR make install
}

# all js and csss related
Expand Down Expand Up @@ -952,7 +956,7 @@ build_benchmark() {
cmake -E make_directory "build"
# NOTE(amos): -DHAVE_STD_REGEX=1 avoid runtime checks as it will fail when compiling with non-standard toolchain
CXXFLAGS="-lresolv -pthread -lrt" cmake -E chdir "build" \
cmake ../ -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DHAVE_STD_REGEX=1
cmake ../ -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DHAVE_STD_REGEX=1
cmake --build "build" --config Release

mkdir $TP_INCLUDE_DIR/benchmark
Expand Down
12 changes: 12 additions & 0 deletions thirdparty/patches/libhdfs3-master.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
--- a/src/CMakeLists.txt 2021-09-23 22:03:55.000000000 +0800
+++ b/src/CMakeLists.txt 2022-01-18 00:58:22.411061469 +0800
@@ -46,7 +46,7 @@ SET(HEADER
common/XmlConfig.h)

ADD_LIBRARY(libhdfs3-static STATIC ${libhdfs3_SOURCES} ${libhdfs3_PROTO_SOURCES} ${libhdfs3_PROTO_HEADERS})
-ADD_LIBRARY(libhdfs3-shared SHARED ${libhdfs3_SOURCES} ${libhdfs3_PROTO_SOURCES} ${libhdfs3_PROTO_HEADERS})
+ADD_LIBRARY(libhdfs3-shared STATIC ${libhdfs3_SOURCES} ${libhdfs3_PROTO_SOURCES} ${libhdfs3_PROTO_HEADERS})

ADD_CUSTOM_COMMAND(
TARGET libhdfs3-shared libhdfs3-static
diff --git a/src/client/FileSystem.cpp b/src/client/FileSystem.cpp
index 6c347c7..6aec1a3 100644
--- a/src/client/FileSystem.cpp
Expand Down
12 changes: 12 additions & 0 deletions thirdparty/patches/mysql-server-mysql-5.7.18.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
diff -uprN a/cmake/zlib.cmake b/cmake/zlib.cmake
--- a/cmake/zlib.cmake 2022-01-18 00:21:44.993277439 +0800
+++ b/cmake/zlib.cmake 2022-01-18 00:21:21.943260690 +0800
@@ -52,7 +52,7 @@ MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
INCLUDE(FindZLIB)
IF(ZLIB_FOUND)
INCLUDE(CheckFunctionExists)
- SET(CMAKE_REQUIRED_LIBRARIES z)
+ SET(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES})
CHECK_FUNCTION_EXISTS(crc32 HAVE_CRC32)
CHECK_FUNCTION_EXISTS(compressBound HAVE_COMPRESSBOUND)
CHECK_FUNCTION_EXISTS(deflateBound HAVE_DEFLATEBOUND)
diff -uprN a/cmake/boost.cmake b/cmake/boost.cmake
--- a/cmake/boost.cmake 2021-09-28 17:56:01.656714647 +0800
+++ b/cmake/boost.cmake 2021-09-28 17:58:09.156339908 +0800
Expand Down

0 comments on commit 0b2714d

Please sign in to comment.