From cfc7488bc46ad8c513d7e22efa7e244e8c3e67d9 Mon Sep 17 00:00:00 2001 From: Kevin Cai Date: Thu, 2 Jan 2025 10:46:02 +0800 Subject: [PATCH] [Enhancement] remove gcc14 detect in build-thirdparty script (#54576) Signed-off-by: Kevin Xiaohua Cai (cherry picked from commit e494f6e3fbd20dcfb7574a20e624133b5ce174c3) --- thirdparty/build-thirdparty.sh | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh index f6c90a584b021..343b2ae27bf8d 100755 --- a/thirdparty/build-thirdparty.sh +++ b/thirdparty/build-thirdparty.sh @@ -80,18 +80,6 @@ check_prerequest() { fi } -# echo if gcc version is greater than 14.0.0 -# else echo "" -echo_gt_gcc14() { - local version=$($CC --version | grep -oP '(?<=\s)\d+\.\d+\.\d+' | head -1) - if [[ $(echo -e "14.0.0\n$version" | sort -V | tail -1) == "14.0.0" ]]; then - echo "" - else - #gt gcc14 - echo "$1" - fi -} - # sudo apt-get install cmake # sudo yum install cmake check_prerequest "${CMAKE_CMD} --version" "cmake" @@ -599,7 +587,7 @@ build_rocksdb() { CFLAGS= \ EXTRA_CFLAGS="-I ${TP_INCLUDE_DIR} -I ${TP_INCLUDE_DIR}/snappy -I ${TP_INCLUDE_DIR}/lz4 -L${TP_LIB_DIR} ${FILE_PREFIX_MAP_OPTION}" \ - EXTRA_CXXFLAGS=$(echo_gt_gcc14 -Wno-error=redundant-move)" -fPIC -Wno-deprecated-copy -Wno-stringop-truncation -Wno-pessimizing-move -I ${TP_INCLUDE_DIR} -I ${TP_INCLUDE_DIR}/snappy ${FILE_PREFIX_MAP_OPTION}" \ + EXTRA_CXXFLAGS="-fPIC -Wno-redundant-move -Wno-deprecated-copy -Wno-stringop-truncation -Wno-pessimizing-move -I ${TP_INCLUDE_DIR} -I ${TP_INCLUDE_DIR}/snappy ${FILE_PREFIX_MAP_OPTION}" \ EXTRA_LDFLAGS="-static-libstdc++ -static-libgcc" \ PORTABLE=1 make USE_RTTI=1 -j$PARALLEL static_lib @@ -664,8 +652,9 @@ build_flatbuffers() { cd $BUILD_DIR rm -rf CMakeCache.txt CMakeFiles/ - export CXXFLAGS="-O3 -fno-omit-frame-pointer -fPIC -g "$(echo_gt_gcc14 "-Wno-error=stringop-overread") - export CPPFLAGS="-O3 -fno-omit-frame-pointer -fPIC -g "$(echo_gt_gcc14 "-Wno-error=stringop-overread") + # reset the optimization level to O2 to avoid "stringop-overread" warnings/errors + export CXXFLAGS="$CXXFLAGS -O2" + export CPPFLAGS="$CPPFLAGS -O2" LDFLAGS="-static-libstdc++ -static-libgcc" \ ${CMAKE_CMD} .. -G "${CMAKE_GENERATOR}" -DFLATBUFFERS_BUILD_TESTS=OFF