Skip to content

Commit

Permalink
fix: Static linkage (#1551)
Browse files Browse the repository at this point in the history
Fixes #1507
  • Loading branch information
godexsoft authored and kuznetsss committed Oct 18, 2024
1 parent 854749a commit 189098d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ jobs:
include:
- os: macos14
build_type: Release
static: false
- os: heavy
build_type: Release
static: true
container:
image: rippleci/clio_ci:latest
- os: heavy
build_type: Debug
static: true
container:
image: rippleci/clio_ci:latest
runs-on: [self-hosted, "${{ matrix.os }}"]
Expand Down Expand Up @@ -50,6 +53,7 @@ jobs:
conan_profile: ${{ steps.conan.outputs.conan_profile }}
conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }}
build_type: ${{ matrix.build_type }}
static: ${{ matrix.static }}

- name: Build Clio
uses: ./.github/actions/build_clio
Expand Down
14 changes: 6 additions & 8 deletions src/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,16 @@ target_sources(clio_server PRIVATE Main.cpp)
target_link_libraries(clio_server PRIVATE clio)

if (static)
target_link_options(clio_server PRIVATE -static)

if (is_gcc AND NOT san)
if (san)
message(FATAL_ERROR "Static linkage not allowed when using sanitizers")
elseif (is_appleclang)
message(FATAL_ERROR "Static linkage not supported on AppleClang")
else ()
target_link_options(
# For now let's assume that we only using libstdc++ under gcc.
# Note: -static-libstdc++ can statically link both libstdc++ and libc++
clio_server PRIVATE -static-libstdc++ -static-libgcc
)
endif ()

if (is_appleclang)
message(FATAL_ERROR "Static linkage not supported on AppleClang")
endif ()
endif ()

set_target_properties(clio_server PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

0 comments on commit 189098d

Please sign in to comment.