Skip to content

Commit

Permalink
static link libstdc++ and restore gcc-13 (#118)
Browse files Browse the repository at this point in the history
The libstdc++6 versions can vary much more dramatically than the libc6
versions on a given system, so statically link this library.

This was the cause of issues running on bionic, not gcc-13.
  • Loading branch information
copperlight authored Dec 11, 2024
1 parent 77c2d1e commit 56259c5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install System Dependencies
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update && sudo apt-get install -y binutils-dev g++-11 libiberty-dev
sudo apt-get update && sudo apt-get install -y binutils-dev g++-13 libiberty-dev
- name: Build
run: |
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ else()
Backward::Backward
)
endif()
# required to allow running on older systems, such as bionic
target_link_options(spectatord_main PRIVATE "-static-libstdc++")

#-- metrics_gen executable
add_executable(metrics_gen
Expand Down
8 changes: 3 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ fi
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
source /etc/os-release
if [[ "$NAME" == "Ubuntu" ]]; then
# gcc version cannot be updated without breaking standard bionic images
if [[ -z "$CC" ]]; then export CC=gcc-11; fi
if [[ -z "$CXX" ]]; then export CXX=g++-11; fi
if [[ -z "$CC" ]]; then export CC=gcc-13; fi
if [[ -z "$CXX" ]]; then export CXX=g++-13; fi
fi
fi

Expand All @@ -52,8 +51,7 @@ if [[ ! -d $BUILD_DIR ]]; then
if [[ "$BUILD_TYPE" == "Debug" ]]; then
conan install . --output-folder="$BUILD_DIR" --build="*" --settings=build_type="$BUILD_TYPE" --profile=./sanitized
else
# build "*" (all) instead of "missing" to avoid "unsupported GNU_PROPERTY_TYPE" errors with gcc-11
conan install . --output-folder="$BUILD_DIR" --build="*"
conan install . --output-folder="$BUILD_DIR" --build=missing
fi

# this switch is necessary for internal centos builds
Expand Down

0 comments on commit 56259c5

Please sign in to comment.