-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
stdenv, binutils: Build cctools targeting macOS on Linux without pointless rebuilds #40933
Conversation
''; | ||
postInstall = '' | ||
cat >$out/bin/dsymutil << EOF | ||
#!${stdenv.shell} |
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 this intended to be a noop?
# think the best solution would just be to fixup linux RPATHs so we don't | ||
# need to set `-rpath` anywhere. | ||
# + lib.optionalString targetPlatform.isDarwin '' | ||
# export NIX_TARGET_DONT_SET_RPATH=1 |
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.
We don't really want rpaths on darwin, can we keep this for native darwin builds?
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.
Yeah due to the way cc-wrapper works, mapping these to the infix salt, it will also do depsTargetTarget
(intended effect of NIX_TARGET_DONT_SET_RPATH
) for native builds. Yay impurities!
9a074d3
to
752fb0a
Compare
We want `buildPackages` to be almost the same as `buildPackages.buildPackges`, but that is only true if most packages don't care about the target platform. The commented code however made them all care about whether the target platform was Darwin.
Unfortunately this is a crude hack that we use the same binutils source everywhere in the bootstrap chain.
752fb0a
to
4ffa8b6
Compare
@@ -19,10 +19,11 @@ in | |||
stdenv.mkDerivation rec { | |||
name = targetPrefix + basename; | |||
|
|||
src = fetchurl { | |||
# HACK to ensure that we preserve source from bootstrap binutils to not rebuild LLVM | |||
src = stdenv.__bootPackages.binutils-unwrapped.src or (fetchurl { |
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.
This is really gross. Maybe we should just builtins.fetchurl
everywhere? IMO with fetchurl
, builtins.fetchurl
, fetchurlBoot
and <nix/fetchurl.nix>
, there are too many ways to fetch in nixpkgs.
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 good enough for now though. At least we avoid the mass rebuild. Any improvement can be another mass rebuild.
Motivation for this change
Most things that used to be in here could get merged straight to master (yay!). What's left is these two ugly things. Contrary to the branch name, this does not give full linux->darwin cross, as that requires #36867, but it does allow doing:
And not waiting far too long for pointless rebuilds.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)CC @alexfmpe @ElvishJerricco