diff --git a/.github/workflows/release/build.sh b/.github/workflows/release/build.sh index b1548f73..247c6010 100644 --- a/.github/workflows/release/build.sh +++ b/.github/workflows/release/build.sh @@ -59,9 +59,15 @@ elif [[ ${OS} =~ "centos" ]]; then export PATH="/opt/rh/devtoolset-7/root/usr/bin:$PATH" PACKAGE_RELEASE="-DPACKAGE_RELEASE=${RELEASE_NO}.el7" COMPILER="-DCMAKE_C_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/gcc -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/g++" + /opt/rh/devtoolset-7/root/usr/bin/gcc --version + /opt/rh/devtoolset-7/root/usr/bin/g++ --version elif [[ ${OS} == "centos:8" ]]; then rm -rf /etc/yum.repos.d/* && curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo - yum install -y gcc gcc-c++ + + yum install -y gcc-toolset-9-gcc gcc-toolset-9-gcc-c++ + COMPILER="-DCMAKE_C_COMPILER=/opt/rh/gcc-toolset-9/root/usr/bin/gcc -DCMAKE_CXX_COMPILER=/opt/rh/gcc-toolset-9/root/usr/bin/g++" + /opt/rh/gcc-toolset-9/root/usr/bin/gcc --version + /opt/rh/gcc-toolset-9/root/usr/bin/g++ --version PACKAGE_RELEASE="-DPACKAGE_RELEASE=${RELEASE_NO}.el8" fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 271ea536..16a0602a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,9 @@ project( ) enable_language(C) +set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -DNDEBUG -g") + # Get CPU arch execute_process(COMMAND uname -m OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) if (NOT (${ARCH} STREQUAL x86_64) AND NOT (${ARCH} STREQUAL aarch64) AND NOT (${ARCH} STREQUAL arm64)) @@ -23,7 +26,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpic -Wall -Werror=sign-compare") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic -Wall -Werror=sign-compare -DOVERLAYBD_VER=${OBD_VER}") if (${ARCH} STREQUAL aarch64) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsigned-char") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8-a+crc -fsigned-char -fno-stack-protector -fomit-frame-pointer") endif () set(CMAKE_CXX_STANDARD_LIBRARIES "-static-libgcc ${CMAKE_CXX_STANDARD_LIBRARIES}") diff --git a/src/overlaybd/zfile/CMakeLists.txt b/src/overlaybd/zfile/CMakeLists.txt index 6d7eeb41..49af3e11 100644 --- a/src/overlaybd/zfile/CMakeLists.txt +++ b/src/overlaybd/zfile/CMakeLists.txt @@ -17,7 +17,7 @@ target_include_directories(crc32_lib PUBLIC if (${ARCH} STREQUAL x86_64) target_compile_options(crc32_lib PUBLIC -msse4.2 -mcrc32) else() - target_compile_options(crc32_lib PUBLIC -march=native -mcpu=generic+crc) + target_compile_options(crc32_lib PRIVATE -march=native -mcpu=generic+crc) endif() if(ENABLE_DSA OR ENABLE_ISAL)