Skip to content

Commit

Permalink
Merge pull request #1969 from skalenetwork/enhancement/SKALED-1900-re…
Browse files Browse the repository at this point in the history
…lease-build-debug-info

SKALED-1900 release build with separate debug info
  • Loading branch information
dimalit authored Sep 27, 2024
2 parents c2dd5c6 + 69f689c commit cb87613
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 20 deletions.
1 change: 1 addition & 0 deletions .github/workflows/custom_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ on:
options:
- Debug
- RelWithDebInfo
- Release
default: RelWithDebInfo

jobs:
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand 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: |
Expand All @@ -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
Expand All @@ -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: |
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/setup-build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 2 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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" )
Expand All @@ -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" )
Expand Down
33 changes: 26 additions & 7 deletions deps/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash


set -e
export SKALED_DEPS_CHAIN=1

Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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}"
Expand Down

0 comments on commit cb87613

Please sign in to comment.