Skip to content

Commit 094ab42

Browse files
committed
[overcome problem of fully static executables not working with std.net.curl]
Incl. the Phobos test runner, and dub.
1 parent 8165790 commit 094ab42

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

.github/actions/7-package/action.yml

+5-7
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ runs:
2424
fi
2525
echo "DMD=$DMD" >> $GITHUB_ENV
2626
27-
- name: 'Alpine: Set DFLAGS environment variable (-Xcc=-static)' # for fully statically linked dub etc.
28-
if: inputs.os == 'alpine'
29-
shell: bash
30-
run: |
31-
set -eux
32-
echo "DFLAGS=-Xcc=-static${DFLAGS:+ $DFLAGS}" >> $GITHUB_ENV
33-
3427
- name: Build & copy dub
3528
shell: bash
3629
run: |
@@ -56,6 +49,11 @@ runs:
5649
cd dlang-tools
5750
git checkout "$(cat ../ldc/packaging/dlang-tools_version)"
5851
52+
# Alpine: build these tools as fully static executables
53+
if [[ '${{ inputs.os }}' == 'alpine' ]]; then
54+
export DFLAGS="-Xcc=-static${DFLAGS:+ $DFLAGS}"
55+
fi
56+
5957
mkdir bin
6058
$DMD -w -de -dip1000 rdmd.d -of=bin/rdmd
6159
$DMD -w -de -dip1000 ddemangle.d -of=bin/ddemangle

.github/workflows/main.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ jobs:
6969
-DCOMPILER_RT_LIBDIR_OS=linux
7070
-DLDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH=x86_64
7171
-DTEST_COMPILER_RT_LIBRARIES="profile;lsan;asan;msan;fuzzer"
72-
-DCMAKE_EXE_LINKER_FLAGS=-static
72+
-DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++
73+
-DD_LINKER_ARGS=-static
7374
-DD_COMPILER_FLAGS="-O -flto=full"
7475
# FIXME: -defaultlib=phobos2-ldc-lto,druntime-ldc-lto
7576
with_pgo: false

cmake/Modules/BuildDExecutable.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function(build_d_executable target_name output_exe d_src_files compiler_args lin
9595
list(APPEND dep_libs "-L$<TARGET_LINKER_FILE:${l}>")
9696
endforeach()
9797

98-
set(full_linker_args ${CMAKE_EXE_LINKER_FLAGS} ${linker_args})
98+
set(full_linker_args ${CMAKE_EXE_LINKER_FLAGS} ${linker_args} ${D_LINKER_ARGS})
9999
translate_linker_args(full_linker_args translated_linker_args)
100100

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

0 commit comments

Comments
 (0)