wai-quantum-cli release: link the Linux binaries static, not static-pie #375

Merged
dcharlot merged 1 commit from wai/quantum-cli-release-static into main 2026-10-20 22:35:30 -04:00

View file

@ -121,7 +121,12 @@ jobs:
t="${{ matrix.triple }}"
T="$(echo "$t" | tr 'a-z-' 'A-Z_')"
export "CC_${t//-/_}=musl-gcc" "CARGO_TARGET_${T}_LINKER=musl-gcc"
cargo build --locked --release --target "$t"
# Static, not static-pie: rustc asks the linker for -static-pie on musl,
# which this musl-gcc's specs do not take (it links a dynamic PIE against
# ld-musl instead); without position-independent code it asks for
# -static, which they do. RUSTFLAGS reach the target only, since
# --target is given, so build scripts build for the host as before.
RUSTFLAGS="-C target-feature=+crt-static -C relocation-model=static" cargo build --locked --release --target "$t"
bin="target/$t/release/wai-quantum"
if command -v file >/dev/null 2>&1; then
file "$bin" | grep -q -E 'statically linked|static-pie linked' || { echo "::error::$bin is not static"; file "$bin"; exit 1; }