-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
zig: fix darwin SDK lookup #376427
base: master
Are you sure you want to change the base?
zig: fix darwin SDK lookup #376427
Conversation
0e37410
to
f92762e
Compare
f92762e
to
cfadb65
Compare
Zig 0.11 still fails to build in the sandbox, looking into it Edit: this was fixed by #320374 but the PR only addresses 0.12 and 0.13, so I'm adding this change to 0.11 as well |
cfadb65
to
cb30108
Compare
Edit: This is finalized by #331011 |
|
|
|
cb30108
to
1bab826
Compare
1bab826
to
a4f58b1
Compare
This fixes the ghostty on darwin incident see here for context: #369788 |
a4f58b1
to
d3a64dc
Compare
Looks like the CI is broken |
This has absolutely nothing to do with that. |
substituteInPlace lib/std/zig/system/darwin.zig \ | ||
--replace-fail /usr/bin/xcrun xcrun \ | ||
--replace-fail /usr/bin/xcode-select '${lib.getExe' xcbuild "xcode-select"}' | ||
''; |
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 like that this is duplicated three times over the span of three compilers. This is something unlikely to change in the future compilers as well, so this will continue to be duplicated in 0.14, 0.15, ...
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 also applies to code above, but I don't know how you can select a range of lines in GitHub PR reviews
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 already addressed by #331011
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.
Amazing, I didn't know about that PR, sorry :(
Zig 0.11 for Linux is broken on master as well, so it's not caused by the changes of this PR: |
Building Zig packages on darwin can currently fail because of the hardcoded
/usr/bin/xcrun
call in Zig's macOS SDK lookup method (ziglang/zig#22600).https://github.com/ziglang/zig/blob/f3c29dcb247be5e50d2d05f9fb2e814ebf115a86/lib/std/zig/system/darwin.zig#L51
This is fixed by replacing it with just
xcrun
, which will then use thexcrun
provided by the nixpkgs darwin stdenv. I decided against using an absolute nix store path forxcrun
as replacement as @reckenrode raised concerns about that causing issues in Nix development shells.Zig also calls
/usr/bin/xcode-select
, which I have replaced byxcode-select
in thexcbuild
package. In this case, the absolute path to the nix store is acceptable even for devShells as Zig discards the output ofxcode-select
and just checks if the command is successful:https://github.com/ziglang/zig/blob/f77e1b86225cd49c2d04dfa6ca4a7ede315dc0b1/lib/std/zig/system/darwin.zig#L18
I also removed the by now rather old Zig versions 0.9 and 0.10 (not completely arbitrarily, they are the only releases marked as "pre-release" on https://github.com/ziglang/zig/releases and had either no or only one dependant in nixpkgs). ForThis part has been moved to a separate PR: #376540zig_0_9
, there was a single dependant colorstorm which already is Zig 0.13 compatible in its HEAD state. I opened an issue requesting a new tagged release for colorstorm as the last one is three years old, and in the meanwhile bumped colorstorm to the commit bringing Zig 0.13 compatibility.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.