-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
llvm: fix crossbuilding on Darwin #381878
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
base: master
Are you sure you want to change the base?
Conversation
The `--build-id=sha1` flag isn't supported on Darwin, and we need to check that neither the host or build platform is Darwin.
@@ -329,7 +329,7 @@ stdenv.mkDerivation (finalAttrs: { | |||
''; | |||
|
|||
# E.g. Mesa uses the build-id as a cache key (see #93946): | |||
LDFLAGS = optionalString (enableSharedLibraries && !stdenv.hostPlatform.isDarwin) "-Wl,--build-id=sha1"; | |||
LDFLAGS = optionalString (enableSharedLibraries && !stdenv.hostPlatform.isDarwin && !stdenv.buildPlatform.isDarwin) "-Wl,--build-id=sha1"; |
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.
Is there no way to specify separate link flags for the build and host platforms? The comment above sounds like it would be suboptimal to produce builds for Linux hosts that didn't use --build-id.
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.
I'm not entirely sure, but I think it might make sense to drop the check for hostPlatform
here. If you're cross-compiling from Linux, it would be fine to include the build flag (i.e., the compiler is being build to run on Linux, but produce binaries for Darwin).
I think you should be able to compile binaries for macOS from Linux, but I haven't tried this yet.
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.
It's not something you can currently do in Nixpkgs. Checking hostPlatform seems right to me, because it's the host linker that needs to support the argument. Checking the build linker seems like a workaround for not being able to distinguish between build and host flags, which I bet there's a way to do.
The
--build-id=sha1
flag isn't supported on Darwin, and we need to check that neither the host or build platform is Darwin.Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.