diff --git a/.github/workflows/custom_build.yml b/.github/workflows/custom_build.yml index 93316c47a..45b57eecf 100644 --- a/.github/workflows/custom_build.yml +++ b/.github/workflows/custom_build.yml @@ -22,6 +22,7 @@ on: options: - Debug - RelWithDebInfo + - Release default: RelWithDebInfo jobs: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7a73c85ef..211fe676a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -91,7 +91,7 @@ jobs: export CC=gcc-9 export CXX=g++-9 export TARGET=all - export CMAKE_BUILD_TYPE=RelWithDebInfo + export CMAKE_BUILD_TYPE=Release cd deps ./clean.sh rm -f ./libwebsockets-from-git.tar.gz @@ -105,7 +105,6 @@ jobs: export CMAKE_BUILD_TYPE=RelWithDebInfo mkdir -p build cd build - # -DCMAKE_C_FLAGS=-O3 -DCMAKE_CXX_FLAGS=-O3 cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE .. cd .. - name: Build all @@ -116,9 +115,8 @@ jobs: export CMAKE_BUILD_TYPE=RelWithDebInfo cd build 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: | @@ -128,7 +126,6 @@ jobs: export CMAKE_BUILD_TYPE=RelWithDebInfo mkdir -p build-historic cd build-historic - # -DCMAKE_C_FLAGS=-O3 -DCMAKE_CXX_FLAGS=-O3 cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DHISTORIC_STATE=1 .. cd .. - name: Build historic state version @@ -139,9 +136,8 @@ jobs: export CMAKE_BUILD_TYPE=RelWithDebInfo cd build-historic 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 d1b15117f..d223106a5 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 b034843c3..9952809ea 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 664c42448..735dc5e7f 100755 --- a/deps/build.sh +++ b/deps/build.sh @@ -1,5 +1,6 @@ #!/bin/bash + set -e export SKALED_DEPS_CHAIN=1 @@ -1158,16 +1159,20 @@ then # echo -e "${COLOR_INFO}configuring it${COLOR_DOTS}...${COLOR_RESET}" cd libuv - eval ./autogen.sh - eval ./configure "${CONF_CROSSCOMPILING_OPTS_GENERIC}" --enable-static --disable-shared --with-pic --prefix="$INSTALL_ROOT" "${CONF_DEBUG_OPTIONS}" + # 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" - cd .. + 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 \ + .. + cd ../.. fi echo -e "${COLOR_INFO}building it${COLOR_DOTS}...${COLOR_RESET}" - cd libuv + cd libuv/build eval "$MAKE" "${PARALLEL_MAKE_OPTIONS}" eval "$MAKE" "${PARALLEL_MAKE_OPTIONS}" install - cd .. + cd ../.. cd "$SOURCES_ROOT" else echo -e "${COLOR_SUCCESS}SKIPPED${COLOR_RESET}" @@ -1391,13 +1396,21 @@ then cd boost_1_68_0 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 [ ${ARCH} = "arm" ] then sed -i -e 's#using gcc ;#using gcc : arm : /usr/local/toolchains/gcc7.2-arm/bin/arm-linux-gnueabihf-g++ ;#g' project-config.jam - eval ./b2 "${CONF_CROSSCOMPILING_OPTS_BOOST}" cxxflags=-fPIC cflags=-fPIC "${PARALLEL_MAKE_OPTIONS}" --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install + eval ./b2 "${CONF_CROSSCOMPILING_OPTS_BOOST}" cxxflags=-fPIC cflags=-fPIC "${PARALLEL_MAKE_OPTIONS}" --prefix="$INSTALL_ROOT" --layout=system variant=$variant link=static threading=multi install else - eval ./b2 cxxflags=-fPIC cflags=-fPIC "${PARALLEL_MAKE_OPTIONS}" --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install + eval ./b2 cxxflags=-fPIC cflags=-fPIC "${PARALLEL_MAKE_OPTIONS}" --prefix="$INSTALL_ROOT" --layout=system variant=$variant link=static threading=multi install fi + cd .. cd "$SOURCES_ROOT" else @@ -2082,6 +2095,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/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 @@ -2091,6 +2105,8 @@ then -DBOOST_ROOT="$INSTALL_ROOT" -DBOOST_LIBRARYDIR="$INSTALL_ROOT/lib" -DBoost_NO_WARN_NEW_VERSIONS=1 -DBoost_DEBUG=ON \ -DBUILD_SHARED_LIBS=OFF \ -DBUILD_TESTS=OFF -DBUILD_BROKEN_TESTS=OFF -DBUILD_HANGING_TESTS=OFF -DBUILD_SLOW_TESTS=OFF \ + -DCMAKE_INCLUDE_PATH="${INSTALL_ROOT}/include" \ + -DCMAKE_LIBRARY_PATH="${INSTALL_ROOT}/lib" \ .. cd .. else @@ -2100,6 +2116,9 @@ then cd build2 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 cd "$SOURCES_ROOT" else echo -e "${COLOR_SUCCESS}SKIPPED${COLOR_RESET}"