Describe the bug
The "static" variant of a Darwin platform has the same cargoShortTarget as its regular, non-static counterpart (e.g., aarch64-apple-darwin). This causes an issue in rust.envVars.setEnv which sets environment variables for cargo invocations in the following order:
CC_AARCH64_APPLE_DARWIN: "Static" host CC
CXX_AARCH64_APPLE_DARWIN: "Static" host CXX
CC_AARCH64_APPLE_DARWIN: Regular build CC <- Incorrect!
CXX_AARCH64_APPLE_DARWIN: Regular build CXX <- Incorrect!
As a result, the correct host CC/CXX variables are clobbered:
$ nix-instantiate --eval --json -A pkgsStatic.rust.envVars.setEnv | jq -r
env \
"CC_AARCH64_APPLE_DARWIN=/nix/store/gsn92905sn6zqslsa9asljic1bglx4hl-aarch64-apple-darwin-clang-wrapper-16.0.6/bin/aarch64-apple-darwin-cc" \
"CXX_AARCH64_APPLE_DARWIN=/nix/store/gsn92905sn6zqslsa9asljic1bglx4hl-aarch64-apple-darwin-clang-wrapper-16.0.6/bin/aarch64-apple-darwin-c++" \
"CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=/nix/store/gsn92905sn6zqslsa9asljic1bglx4hl-aarch64-apple-darwin-clang-wrapper-16.0.6/bin/aarch64-apple-darwin-cc" \
"CC_AARCH64_APPLE_DARWIN=/nix/store/700a0ayy1s1h7zg9dqiqy0xvmhfr26l6-clang-wrapper-16.0.6/bin/cc" \
"CXX_AARCH64_APPLE_DARWIN=/nix/store/700a0ayy1s1h7zg9dqiqy0xvmhfr26l6-clang-wrapper-16.0.6/bin/c++" \
...
Here gsn92... (pkgsStatic.stdenv.cc) should be used instead of 700a0...-clang-wrapper-16.0.6 (stdenv.cc) for hostPlatform builds. This causes Rust packages like rtrtr to fail linking:
$ nix-build -A pkgsStatic.rtrtr
...
warning: `rtrtr` (lib) generated 1 warning
error: linking with `/nix/store/700a0ayy1s1h7zg9dqiqy0xvmhfr26l6-clang-wrapper-16.0.6/bin/cc` failed: exit status: 1
|
= note: env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET -u XROS_DEPLOYMENT_TARGET LC_ALL="C" (...) "/nix/store/700a0ayy1s1h7zg9dqiqy0xvmhfr26l6-clang-wrapper-16.0.6/bin/cc" (...)
= note: ld: library not found for -liconv
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
(libiconv-static is present)
Ref: #346043 which enabled building almost-static packages on macOS/Darwin 🎊
Steps To Reproduce
Steps to reproduce the behavior:
nix-build -A pkgsStatic.rtrtr on aarch64-darwin
Expected behavior
Screenshots
Additional context
Metadata
Notify maintainers
Darwin people:
@reckenrode
@emilazy
@toonn
Rust people:
@figsoda
@Mic92
@winterqt
Note for maintainers: Please tag this issue in your PR.
Add a 👍 reaction to issues you find important.
Describe the bug
The "static" variant of a Darwin platform has the same
cargoShortTargetas its regular, non-static counterpart (e.g.,aarch64-apple-darwin). This causes an issue inrust.envVars.setEnvwhich sets environment variables forcargoinvocations in the following order:CC_AARCH64_APPLE_DARWIN: "Static" host CCCXX_AARCH64_APPLE_DARWIN: "Static" host CXXCC_AARCH64_APPLE_DARWIN: Regular build CC <- Incorrect!CXX_AARCH64_APPLE_DARWIN: Regular build CXX <- Incorrect!As a result, the correct host CC/CXX variables are clobbered:
Here
gsn92...(pkgsStatic.stdenv.cc) should be used instead of700a0...-clang-wrapper-16.0.6(stdenv.cc) for hostPlatform builds. This causes Rust packages likertrtrto fail linking:(
libiconv-staticis present)Ref: #346043 which enabled building almost-static packages on macOS/Darwin 🎊
Steps To Reproduce
Steps to reproduce the behavior:
nix-build -A pkgsStatic.rtrtron aarch64-darwinExpected behavior
Screenshots
Additional context
Metadata
Notify maintainers
Darwin people:
@reckenrode
@emilazy
@toonn
Rust people:
@figsoda
@Mic92
@winterqt
Note for maintainers: Please tag this issue in your PR.
Add a 👍 reaction to issues you find important.