-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
treewide: change various flags to allow x64 darwin to default to sdk 11.0 when ready #324155
Conversation
] ++ lib.optional (stdenv.isDarwin && !stdenv.isAarch64) ( | ||
] ++ lib.optional (stdenv.isDarwin && apple_sdk ? sdk) ( |
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 still necessary? libproc.h
is included in the 10.12 SDK Libsystem and should be identical to this one.
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.
hmm, webkitgtk is marked as broken on darwin so not sure. i added a comment stating it might not be necessary and switched the check to sdk is < 11
# use unwrapped clang to generate headers because wrapper is not compatible with a 32 bit -arch. | ||
# aarch64 should likely do this as well and remove the --replace MACHINE_ARCH above | ||
MIGCC = if stdenv.isx86_64 && lib.versionAtLeast stdenv.hostPlatform.darwinSdkVersion "11" | ||
then "${lib.getBin buildPackages.stdenv.cc.cc}/bin/clang" |
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.
mig
needs to target the build platform because it’s run at build time to generate headers.
then "${lib.getBin buildPackages.stdenv.cc.cc}/bin/clang" | |
then "${lib.getBin pkgsBuildBuild.stdenv.cc.cc}/bin/clang" |
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’d also add this can be done unconditionally. I do something similar in 37a87d0, but I think this way is probably cleaner. I can’t remember why I didn’t specify a full path to for MIGCC
in that commit.
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 don't have aarch64 to test on. i suspect that making it unconditional means that MACHINE_ARCH doesn't need to get patched for aarch64 as well, and thus observing the comment saying that the header build needs to use 32 bit arch. it does change the layouts for the x64 darwin structures so i assume that the aarch64 ones have mismatched structure sizes as well.
i'd like this to be part of a followup given the lack of hardware and would require the PR to move staging. created #324440 -- will cause a merge conflict with this PR but should be easy enough to resolve.
Also pinging @toonn. |
update code to not assume that x64 darwin must use sdk 10.12. After this change it's possible to build a sdk 11 stdenv on darwin x64
update code to not assume that x64 darwin uses sdk 10.12. These changes want to reach into apple_sdk.sdk to grab a header file which is only required for sdk 10.12.
b88d9a5
to
07cba93
Compare
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.
Most of it looks good to me, just a couple questions.
MIGCC = "cc"; | ||
# use unwrapped clang to generate headers because wrapper is not compatible with a 32 bit -arch. | ||
# aarch64 should likely do this as well and remove the --replace MACHINE_ARCH above | ||
MIGCC = if stdenv.isx86_64 && lib.versionAtLeast stdenv.hostPlatform.darwinSdkVersion "11" |
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 think this shouldn't be conditional? Even the 10.12 script relies on the 32-bit arch compiler. Or does the wrapper only force a 64-bit architecture when using the 11 SDK?
@@ -150,7 +154,7 @@ appleDerivation' (if headersOnly then stdenvNoCC else stdenv) ( | |||
mv $out/Library/Frameworks/IOKit.framework $out/Library/PrivateFrameworks | |||
''; | |||
|
|||
appleHeaders = builtins.readFile (./. + "/headers-${arch}.txt"); | |||
appleHeaders = builtins.readFile (./. + "/headers-${stdenv.hostPlatform.darwinSdkVersion}-${arch}.txt"); |
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.
Will we ever want to split on more than the architecture? I'd say the goal is to unsplit these header checks eventually. If they're even still useful.
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.
The way to do these in the future probably requires us to inventory the upstream SDKs and compare our headers to those in the SDK. Otherwise, using headers + stubs with more than a few SDKs is going to get painful quickly.
(Or I wouldn’t worry too much about the current situation because it’s going to need to change.)
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.
LGTM, however I would like to get #325175 in before we merge any other LLVM changes to minimize rebasing and conflicts.
@RossComputerGuy, how close is that PR to being marked ready? |
@toonn it's ready, trying to figure out CI failures. Should be ready tonight or within the next couple days. |
so it is not ready. |
The actual work is done, there's just CI roadblocks. I checked using nix-diff and rebuild count should be 0. It sounds like the CI issue it's having should be simpler enough and only affects Darwin. |
it only effects the builds which have a stdenv based on llvm. i am not sure how you think it is good etiquette to think that you should be able to open up a non-critical PR that creates merge conflicts with this one and then request that this not get merged so you don't have to resolve the merge conflicts with the files you deleted so I can deal with fixing them in this PR. And your PR doesn't even work yet. Fixing the merge conflicts is not really a big deal for me but your request is just rude. |
Sorry, it wasn't my intention to be rude. I'll merge this one first if nobody has anything left to address. |
it doesn't really matter. i overreacted. |
Hi, in the nix-ros-overlay project, we're experiencing the following eval failure:
Can somebody here suggests what's wrong? |
arm64 doesnt support 10.12 |
Somehow
|
Thanks for quick answers. I don't think we pin the SDK versions anywhere. Who and how can do that? Can you see something interesting from the trace? Posting just the end, which seems to contain some package names, not just generic nixpkgs stuff:
Full trace here. |
Do you have a flake command that reliably reproduces the failure? |
Yes: |
I added tracing to your flake. It’s failing when it tries to evaluate armv7a-darwin. Edit: This is a minimal reproducer: $ nix eval --impure -E 'import (builtins.getFlake "github:NixOS/nixpkgs") { system = "armv7a-darwin"; }'
error:
… while evaluating a branch condition
at /nix/store/7mfai28m4yqdnvhbyzd7jg57nzlwgc73-source/pkgs/stdenv/booter.nix:99:7:
98| thisStage =
99| if args.__raw or false
| ^
100| then args'
… while evaluating 'args' to select '__raw' on it
at /nix/store/7mfai28m4yqdnvhbyzd7jg57nzlwgc73-source/pkgs/stdenv/booter.nix:99:10:
98| thisStage =
99| if args.__raw or false
| ^
100| then args'
(stack trace truncated; use '--show-trace' to show the full trace)
error: opening file '/nix/store/7mfai28m4yqdnvhbyzd7jg57nzlwgc73-source/pkgs/os-specific/darwin/apple-source-releases/xnu/headers-10.12-arm64.txt': No such file or directory |
I guess, this is some niche platform, which we can disable. But probably it should not look for |
|
Sounds like a good idea. Thanks to all for help. |
armv7a-darwin is included in |
This gets rid of evaluation error for armv7a-darwin. It makes no sense to support this platform in this overlay. According to the discussion around around NixOS/nixpkgs#324155 (comment), it is better to support just the systems exposed by the nixpkgs flake. Currently, these are: - aarch64-darwin - aarch64-linux - armv6l-linux - armv7l-linux - i686-linux - powerpc64le-linux - riscv64-linux - x86_64-darwin - x86_64-freebsd - 86_64-linux
This gets rid of evaluation error for armv7a-darwin. It makes no sense to support this platform in this overlay. According to the discussion around around NixOS/nixpkgs#324155 (comment), it is better to support just the systems exposed by the nixpkgs flake. Currently, these are: - aarch64-darwin - aarch64-linux - armv6l-linux - armv7l-linux - i686-linux - powerpc64le-linux - riscv64-linux - x86_64-darwin - x86_64-freebsd - 86_64-linux
Description of changes
continuation of #323679 which i closed and can not re-open.
with this change and plus a modification to
lib/systems/default.nix
x64 darwin will default to sdk 11.0.the first commit modifies various conditionals to not assume that x86_64-darwin uses sdk 10.12 and instead checks the darwinSdkVersion. Additionally, darwin.xnu is modified so x64 darwin uses unwrapped clang when generating header files, as the headers require a 32 bit arch which is not allowed when using cc-wrapper as it sets -arch to x86_64. this commit is sufficient for building stdenv when
darwinSdkVersion
is set to "11.0" inlib/systems/default.nix
.the second commit fixes evaluation errors which assume that x64 darwin can access the
apple_sdk.sdk
attribute which is only available as part of the 10.12 sdk so rather than checking for x64 darwin, condition ondarwinSdkVersion
is older than "11.0".with these two commits and the following diff x64 darwin will default to using sdk 11.0
enable sdk 11 on all platforms
testing: using the patch to enable sdk 11, built inkscape and verified removing overrideSDK for a few sampled packages (vcpkg-tool, wasmedge) works.
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/
)cc: @emilazy @reckenrode
Add a 👍 reaction to pull requests you find important.