Skip to content

Commit d5c2b1b

Browse files
claudebranchseer
authored andcommitted
ci(musl): move -crt-static to .cargo/config.toml
Add -C target-feature=-crt-static to the musl target rustflags in .cargo/config.toml so it applies for all musl builds (local and cross). Keep it in the CI RUSTFLAGS override as well since the env var overrides both [build] and [target] level config. https://claude.ai/code/session_01R3RoGqPDBRtNa2NRg3SeBM
1 parent d2fe67d commit d5c2b1b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

.cargo/config.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ bindeps = true
66

77
# Linker wrappers for musl targets. On Linux hosts these use the system cc directly;
88
# on non-Linux hosts (macOS, Windows) they cross-compile via cargo-zigbuild.
9+
# -crt-static: link musl dynamically so fspy preload .so can be injected into
10+
# host processes that are themselves dynamically linked (e.g. node on Alpine).
911
[target.x86_64-unknown-linux-musl]
10-
rustflags = ["-C", "linker=.cargo/zigcc-x86_64-unknown-linux-musl"]
12+
rustflags = ["-C", "target-feature=-crt-static", "-C", "linker=.cargo/zigcc-x86_64-unknown-linux-musl"]
1113

1214
[target.aarch64-unknown-linux-musl]
13-
rustflags = ["-C", "linker=.cargo/zigcc-aarch64-unknown-linux-musl"]
15+
rustflags = ["-C", "target-feature=-crt-static", "-C", "linker=.cargo/zigcc-aarch64-unknown-linux-musl"]

.github/workflows/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,8 @@ jobs:
144144
env:
145145
# Override all rustflags to skip the zig cross-linker from .cargo/config.toml.
146146
# Alpine's cc is already musl-native, so no custom linker is needed.
147-
# Must mirror [build].rustflags from .cargo/config.toml.
148-
# -crt-static: link musl dynamically so fspy preload .so can be injected into
149-
# host processes that are themselves dynamically linked (e.g. node on Alpine).
147+
# Must mirror [build].rustflags and target rustflags from .cargo/config.toml
148+
# (RUSTFLAGS env var overrides both levels).
150149
RUSTFLAGS: --cfg tokio_unstable -D warnings -C target-feature=-crt-static
151150
steps:
152151
- name: Install Alpine dependencies

0 commit comments

Comments
 (0)