Skip to content

darwin.stdenv: propagate sdkRoot via extraBuildInputs#308366

Closed
reckenrode wants to merge 1 commit intoNixOS:stagingfrom
reckenrode:sdkRoot-cross-fix
Closed

darwin.stdenv: propagate sdkRoot via extraBuildInputs#308366
reckenrode wants to merge 1 commit intoNixOS:stagingfrom
reckenrode:sdkRoot-cross-fix

Conversation

@reckenrode
Copy link
Contributor

@reckenrode reckenrode commented May 1, 2024

Description of changes

This ensures it is properly dropped when cross-compiling.

I tested by building the Darwin bootstrap on aarch64-darwin and building psutil in the bootstrap to confirm the sdk root is being propagated correctly. It should have an SDK version of 11.0 (and did).

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.05 Release Notes (or backporting 23.05 and 23.11 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 ensures it is properly dropped when cross-compiling.
@github-actions github-actions bot added the 6.topic: stdenv Standard environment label May 1, 2024
@ofborg ofborg bot added 6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels May 1, 2024
Copy link
Contributor

@toonn toonn left a comment

Choose a reason for hiding this comment

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

Couple questions because I've really not grokked all the cross setup yet.

extraNativeBuildInputs = extraNativeBuildInputs
++ [ prevStage.darwin.apple_sdk.sdkRoot ];
extraBuildInputs = [ prevStage.darwin.CF prevStage.darwin.apple_sdk.sdkRoot ];
extraNativeBuildInputs = extraNativeBuildInputs;
Copy link
Contributor

Choose a reason for hiding this comment

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

Potentially use inherit?


install -D '${../../../build-support/setup-hooks/role.bash}' "$out/nix-support/setup-hook"
cat >> "$out/nix-support/setup-hook" <<-hook
#
Copy link
Contributor

Choose a reason for hiding this comment

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

So we're dropping the exception when the hook isn't a build-time dependency and we're not doing a native compile?

Seems like a good thing to have it apply consistently.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It needs to be depsHostTarget (i.e., a buildInput), but the hook wasn’t being run unless I took this out. The doc seems to suggest it should work, but maybe I was doing something wrong.

if [[ ! \$NIX_CFLAGS_COMPILE =~ isysroot ]]; then
local cflagsVar=NIX_CFLAGS_COMPILE\''${role_post}
if [[ ! \''${!cflagsVar} =~ isysroot ]]; then
export NIX_CFLAGS_COMPILE\''${role_post}+=' -isysroot $out/${sdkName}.sdk'
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we want to reuse the cflagsVar here or can you not use an indirect reference with export?

Comment on lines 56 to 58
# See ../../../build-support/setup-hooks/role.bash
getTargetRole

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# See ../../../build-support/setup-hooks/role.bash
getTargetRole

If the below is correct I believe this no longer serves a purpose. Actually seems to be redundant even without the change from target to host offset because this sets role_post, which is unset right after.

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 10, 2024
@aviallon
Copy link
Contributor

Closed by #346043

@aviallon aviallon closed this Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: darwin Running or building packages on Darwin 6.topic: stdenv Standard environment 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants