From 26fc0353957da36355681b4ce7ca9a1ce650c46e Mon Sep 17 00:00:00 2001 From: Oleh Nikolaiev Date: Tue, 7 Jan 2025 17:56:41 +0000 Subject: [PATCH 1/4] #1900 enhance the build --- .github/workflows/publish.yml | 4 ++-- .github/workflows/setup-build-publish.yml | 7 +++++++ CMakeLists.txt | 8 ++------ deps/build.sh | 6 +++--- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c0e0952c1..369defe32 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -118,7 +118,7 @@ jobs: make skaled -j$(nproc) #echo "Ensure release mode skaled does not have any debug markers" cp skaled/skaled skaled/skaled-debug - strip skaled/skaled + strip --strip-all skaled/skaled cd .. - name: Configure historic state build run: | @@ -141,7 +141,7 @@ jobs: make skaled -j$(nproc) #echo "Ensure release mode skaled does not have any debug markers" cp skaled/skaled skaled/skaled-debug - strip skaled/skaled + strip --strip-all skaled/skaled cd .. - name: Build and publish container run: | diff --git a/.github/workflows/setup-build-publish.yml b/.github/workflows/setup-build-publish.yml index 1a54febd6..c71721c37 100644 --- a/.github/workflows/setup-build-publish.yml +++ b/.github/workflows/setup-build-publish.yml @@ -150,6 +150,13 @@ jobs: export CMAKE_BUILD_TYPE=$BUILD_TYPE cd build make skaled -j$(nproc) + if [[ "$BUILD_TYPE" = "Release" ]]; then + debug_wc=$(objdump -h skaled/skaled | grep -i debug | wc -l) + sym_wc=$(readelf -s skaled/skaled | wc -l) + if (( debug_wc != 0 || sym_wc > 10000 )); then + exit 1 + fi + fi cd .. - name: Build and publish container env: diff --git a/CMakeLists.txt b/CMakeLists.txt index 027d36198..1cc66d51c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,12 +18,6 @@ list( APPEND CMAKE_MODULE_PATH ${DEPS_INSTALL_ROOT}/lib/cmake ) link_directories( ${CMAKE_BINARY_DIR}/deps/lib ) # HACK for not-found -lff in testeth -if( NOT CMAKE_BUILD_TYPE MATCHES "Debug" ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic" ) - set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic" ) - set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -rdynamic" ) -endif() - option( SKALED_PROFILING "Build for profiling" OFF ) if( SKALED_PROFILING ) set( CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -pg" ) @@ -32,6 +26,8 @@ if( SKALED_PROFILING ) set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg" ) endif() +set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s") + if( CMAKE_BUILD_TYPE STREQUAL "Release" ) set( CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -O3" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3" ) diff --git a/deps/build.sh b/deps/build.sh index 30b59ed63..0bd75bb34 100755 --- a/deps/build.sh +++ b/deps/build.sh @@ -2099,7 +2099,7 @@ then eval tar -xzf folly-from-git.tar.gz fi echo -e "${COLOR_INFO}fixing it${COLOR_DOTS}...${COLOR_RESET}" - sed -i 's/list(APPEND FOLLY_LINK_LIBRARIES ${LIBUNWIND_LIBRARIES})/list(APPEND FOLLY_LINK_LIBRARIES ${LIBUNWIND_LIBRARIES} lzma)/' ./folly/CMake/folly-deps.cmake + sed -i 's/list(APPEND FOLLY_LINK_LIBRARIES ${LIBUNWIND_LIBRARIES})/list(APPEND FOLLY_LINK_LIBRARIES ${LIBUNWIND_LIBRARIES} lzma)/' ./folly/CMake/folly-deps.cmake sed -i 's/google::InstallFailureFunction(abort);/google::InstallFailureFunction( reinterpret_cast < google::logging_fail_func_t > ( abort ) );/g' ./folly/folly/init/Init.cpp echo -e "${COLOR_INFO}configuring it${COLOR_DOTS}...${COLOR_RESET}" cd folly @@ -2123,8 +2123,8 @@ then eval "$MAKE" "${PARALLEL_MAKE_OPTIONS}" eval "$MAKE" "${PARALLEL_MAKE_OPTIONS}" install if [ "$DEBUG" = "0" ]; then - eval strip --strip-debug "${INSTALL_ROOT}"/lib/libfolly*.a - fi + eval strip --strip-debug "${INSTALL_ROOT}"/lib/libfolly*.a + fi cd "$SOURCES_ROOT" else echo -e "${COLOR_SUCCESS}SKIPPED${COLOR_RESET}" From 6a37913296a2df883faafb2535f64e7525464a83 Mon Sep 17 00:00:00 2001 From: Oleh Nikolaiev Date: Wed, 8 Jan 2025 15:49:27 +0000 Subject: [PATCH 2/4] #1900 disable asserts --- cmake/EthCompilerSettings.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index 0a7d82cba..13388f40f 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -70,7 +70,7 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -DNDEBUG -g") option(USE_LD_GOLD "Use GNU gold linker" ON) if (USE_LD_GOLD) From ade3bd6b83eb7e19ed94ef959d8e1a4e6b238088 Mon Sep 17 00:00:00 2001 From: Oleh Nikolaiev Date: Wed, 8 Jan 2025 16:21:55 +0000 Subject: [PATCH 3/4] #1900 build deps without debug symbols --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 369defe32..5707bcee0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -91,7 +91,7 @@ jobs: export CC=gcc-11 export CXX=g++-11 export TARGET=all - export CMAKE_BUILD_TYPE=RelWithDebInfo + export CMAKE_BUILD_TYPE=Release cd deps ./clean.sh rm -f ./libwebsockets-from-git.tar.gz From 230272287c48ccc42b7ad4a7ea5056a8ff41241f Mon Sep 17 00:00:00 2001 From: Oleh Nikolaiev Date: Wed, 8 Jan 2025 16:22:15 +0000 Subject: [PATCH 4/4] #1900 format code --- deps/build.sh | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/deps/build.sh b/deps/build.sh index 0bd75bb34..ce723c200 100755 --- a/deps/build.sh +++ b/deps/build.sh @@ -1166,11 +1166,10 @@ then # eval ./autogen.sh # eval ./configure "${CONF_CROSSCOMPILING_OPTS_GENERIC}" --enable-static --disable-shared --with-pic --prefix="$INSTALL_ROOT" "${CONF_DEBUG_OPTIONS}" #--with-sysroot=="$INSTALL_ROOT" - mkdir build && cd build - eval "$CMAKE" "${CMAKE_CROSSCOMPILING_OPTS}" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$TOP_CMAKE_BUILD_TYPE" \ - -DBUILD_SHARED_LIBS=OFF -DLIBUV_BUILD_SHARED=OFF\ - .. - cd ../.. + mkdir -p build && cd build + eval "$CMAKE" "${CMAKE_CROSSCOMPILING_OPTS}" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$TOP_CMAKE_BUILD_TYPE" \ + -DBUILD_SHARED_LIBS=OFF -DLIBUV_BUILD_SHARED=OFF .. + cd ../.. fi echo -e "${COLOR_INFO}building it${COLOR_DOTS}...${COLOR_RESET}" cd libuv/build @@ -1401,11 +1400,11 @@ then echo -e "${COLOR_INFO}configuring and building it${COLOR_DOTS}...${COLOR_RESET}" eval ./bootstrap.sh --prefix="$INSTALL_ROOT" --with-libraries=atomic,context,filesystem,program_options,regex,system,thread,date_time,iostreams - if [ "$DEBUG" = "1" ]; then - variant=debug - else - variant=release - fi + if [ "$DEBUG" = "1" ]; then + variant=debug + else + variant=release + fi if [ ${ARCH} = "arm" ] then