Skip to content
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

{bintools-wrapper,cc-wrapper}: factor out Darwin SDK logic, allow paths relative to the Darwin SDK #351315

Merged
merged 2 commits into from
Oct 26, 2024

Conversation

emilazy
Copy link
Member

@emilazy emilazy commented Oct 26, 2024

-L and -I are interpreted relative to the $SDKROOT by the Darwin toolchain, so we have to avoid filtering out such paths in the purity filter hacks in order to not break e.g. the .NET Core build system. It’s also just the correct thing to do for the platform.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

This reduces code duplication, makes the SDK variables available
earlier in the wrappers, and makes the behaviour between the two
wrappers more consistent.
@emilazy emilazy requested review from a team October 26, 2024 00:35
@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Oct 26, 2024
@emilazy emilazy marked this pull request as ready for review October 26, 2024 12:17
@emilazy
Copy link
Member Author

emilazy commented Oct 26, 2024

I’ve confirmed that dotnetCorePackages.dotnet_{8,9}.sdk build successfully with this change without any further hacks.

`-L` and `-I` are interpreted relative to the `$SDKROOT` by the
Darwin toolchain, so we have to avoid filtering out such paths in the
purity filter hacks in order to not break e.g. the .NET Core build
system. It’s also just the correct thing to do for the platform.
@Artturin
Copy link
Member

Building tests.cc-wrapper.default on linux
Do the same on darwin

@emilazy
Copy link
Member Author

emilazy commented Oct 26, 2024

I hate to be the one to tell you this, but tests.cc-wrapper.default doesn’t work on Darwin even on master 🙃 (/nix/store/22a6p8311lg3z4ksrjbj018i7z3vgkva-clang-wrapper-16.0.6/bin/cc: line 254: mktemp: No such file or directory – not sure why since mktemp is part of the stdenv, but I think it’s been like this for a while. I’ll take a look and see if I can fix it.)

FWIW I have built like a thousand derivations with this change to test .NET (which also goes through Swift).

@paparodeo
Copy link
Contributor

I hate to be the one to tell you this, but tests.cc-wrapper.default doesn’t work on Darwin even on master 🙃 (/nix/store/22a6p8311lg3z4ksrjbj018i7z3vgkva-clang-wrapper-16.0.6/bin/cc: line 254: mktemp: No such file or directory – not sure why since mktemp is part of the stdenv, but I think it’s been like this for a while. I’ll take a look and see if I can fix it.)

FWIW I have built like a thousand derivations with this change to test .NET (which also goes through Swift).

broken by #349585

the fix is in staging #349589

tho #349585 could get backed out on master and merged to staging so the cc tests work at the end of the release cycle.

@emilazy
Copy link
Member Author

emilazy commented Oct 26, 2024

Oh, cool. I’ll test the merge then.

@emilazy
Copy link
Member Author

emilazy commented Oct 26, 2024

FWIW we’re meant to have one more staging cycle before the release so it should be fine.

Copy link
Member

@Artturin Artturin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests.cc-wrapper.default passes on linux

Copy link
Contributor

@reckenrode reckenrode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll defer to the testing done here. Regarding the Darwin flags changes, those LGTM. They’re essentially identical between cc-wrapper and bintools-wrapper, so it makes sense to consolidate them to wrapper-common.

@wegank wegank added 12.approvals: 2 This PR was reviewed and approved by two reputable people 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package labels Oct 26, 2024
Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great and builds on Linux.

@emilazy
Copy link
Member Author

emilazy commented Oct 26, 2024

It still fails because bintools-wrapper has copy‐pasted code from cc-wrapper that didn’t get the #349589 treatment :(

I will open a PR to fix that, but I just undid the tests changes locally for now, and they pass successfully 🎉

Merging on the strength of that, I hope that is okay.

@emilazy emilazy merged commit 6c6037a into NixOS:staging Oct 26, 2024
29 checks passed
@emilazy emilazy deleted the push-tlytkynvxlmy branch October 26, 2024 21:20
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/title-the-darwin-sdks-have-been-updated/55295/1

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/the-darwin-sdks-have-been-updated/55295/26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 501+ 10.rebuild-darwin: 5001+ 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild 10.rebuild-linux: 501+ 10.rebuild-linux: 5001+ 10.rebuild-linux-stdenv This PR causes stdenv to rebuild 12.approvals: 2 This PR was reviewed and approved by two reputable people 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants