Skip to content

Commit

Permalink
[overcome problem of fully static executables not working with std.ne…
Browse files Browse the repository at this point in the history
…t.curl]

Incl. the Phobos test runner, and dub.
  • Loading branch information
kinke committed Jan 19, 2025
1 parent 8165790 commit 094ab42
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
12 changes: 5 additions & 7 deletions .github/actions/7-package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ runs:
fi
echo "DMD=$DMD" >> $GITHUB_ENV
- name: 'Alpine: Set DFLAGS environment variable (-Xcc=-static)' # for fully statically linked dub etc.
if: inputs.os == 'alpine'
shell: bash
run: |
set -eux
echo "DFLAGS=-Xcc=-static${DFLAGS:+ $DFLAGS}" >> $GITHUB_ENV
- name: Build & copy dub
shell: bash
run: |
Expand All @@ -56,6 +49,11 @@ runs:
cd dlang-tools
git checkout "$(cat ../ldc/packaging/dlang-tools_version)"
# Alpine: build these tools as fully static executables
if [[ '${{ inputs.os }}' == 'alpine' ]]; then
export DFLAGS="-Xcc=-static${DFLAGS:+ $DFLAGS}"
fi
mkdir bin
$DMD -w -de -dip1000 rdmd.d -of=bin/rdmd
$DMD -w -de -dip1000 ddemangle.d -of=bin/ddemangle
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ jobs:
-DCOMPILER_RT_LIBDIR_OS=linux
-DLDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH=x86_64
-DTEST_COMPILER_RT_LIBRARIES="profile;lsan;asan;msan;fuzzer"
-DCMAKE_EXE_LINKER_FLAGS=-static
-DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++
-DD_LINKER_ARGS=-static
-DD_COMPILER_FLAGS="-O -flto=full"
# FIXME: -defaultlib=phobos2-ldc-lto,druntime-ldc-lto
with_pgo: false
Expand Down
2 changes: 1 addition & 1 deletion cmake/Modules/BuildDExecutable.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function(build_d_executable target_name output_exe d_src_files compiler_args lin
list(APPEND dep_libs "-L$<TARGET_LINKER_FILE:${l}>")
endforeach()

set(full_linker_args ${CMAKE_EXE_LINKER_FLAGS} ${linker_args})
set(full_linker_args ${CMAKE_EXE_LINKER_FLAGS} ${linker_args} ${D_LINKER_ARGS})
translate_linker_args(full_linker_args translated_linker_args)

# We need to link against the C++ runtime library.
Expand Down

0 comments on commit 094ab42

Please sign in to comment.