-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cc-wrapper: fix wrapper tests and building for darwin on staging-next #107336
Conversation
Disable the dynamic linker if the platform is darwin. On darwin the dynamic linker cannot be passed using the -dynamic-linker argument, but needs to be explicitly set via environment variables. Passing the linker via -dynamic-linker results in an error: ld: unknown option: -dynamic-linker=/usr/lib/dyld Pass a isdarwin variable to the build script and disable the linker on darwin systems.
Since commit 11302dc ("clang, cc-wrapper: Move `--gcc-toolchain` logic into CC wrapper") --gcc-toolchain was only passed i useGccForLibs is true. However useGccForLibs is disabled if libcxx is null, which results in the libcxxStdenv failing, since the linker can't find libgcc while linking. Remove the condition check for libcxx == null, to let the wrapper tests pass again.
/cc @NixOS/darwin-maintainers I guess? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Polluting the wrappers with this type of logic doesn't seem ideal. Allowing this to be set in the environment and inheriting that from the stdenv seems like a nicer approach. Some similar things are done like that here.
nixpkgs/pkgs/stdenv/darwin/default.nix
Lines 36 to 38 in 8946ff8
export NIX_ENFORCE_NO_NATIVE=''${NIX_ENFORCE_NO_NATIVE-1} | |
export NIX_ENFORCE_PURITY=''${NIX_ENFORCE_PURITY-1} | |
export NIX_IGNORE_LD_THROUGH_GCC=1 |
I strongly agree, that is why I opened it as a draft. What do you think is the correct approach here, setting Edit: pushed a fixup commit which implements the special handling for |
I would change @Ericson2314 That's just the test, the stdenv is still broken. |
beb710a
to
7b4f7da
Compare
Okay, I just realized that my first fixup was also broken… it's late here so I'll be going to bed, if this hasn't been resolved by tomorrow I'll work on this some more. |
Closing this, since the two changes have been reverted in staging-next. |
Motivation for this change
Fix darwin builds and the cc-wrapper-libcxx tests for staging-next. Opening as draft since I am not sure the first commit is the correct fix for this.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)