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

swift-corelibs: set NIX_COREFOUNDATION_RPATH in a hook #234861

Merged
merged 2 commits into from
Jun 11, 2023

Conversation

reckenrode
Copy link
Contributor

Description of changes

Closes #230870. Thanks to @eliasnaur for the test case and for rasining awareness and to @veprbl for the work done on #111385.

This takes a slightly different approach from those two PRs. The hook is set unconditionally. The stdenv bootstrap doesn’t really need CF at all, so setting the hook is harmless. This simplifies things.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • 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/)
  • 23.05 Release Notes (or backporting 22.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.

Closes NixOS#230870. Thanks to @eliasnaur for the test case and for rasining
awareness and to @veprbl for the work done on NixOS#111385.

This takes a slightly different approach from those two PRs. The hook is
set unconditionally. The stdenv bootstrap doesn’t really need CF at all,
so setting the hook is harmless. This simplifies things.
@veprbl
Copy link
Member

veprbl commented May 30, 2023

Closes #230870

I don't see how this can fix darwin-to-linux cross.

@reckenrode
Copy link
Contributor Author

Closes #230870

I don't see how this can fix darwin-to-linux cross.

The other part is in the stdenv rework that drops setting NIX_COREFOUNDATION_RPATH from the preHook. I can do that here even though it’ll just be replaced by the rework, so this PR is self-contained and complete.

Rely on swift-corefoundation to set this in its hook. That way, it will
be dropped from the `extraBuildInputs` during a cross build.
@github-actions github-actions bot added the 6.topic: stdenv Standard environment label May 30, 2023
@reckenrode
Copy link
Contributor Author

@veprbl Sorry about that. I pushed a commit that makes this self-contained. This PR should address the cross issue properly now independently of the rework PR (which is blocked by #234859).

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.

Just one question for clarification. Given the rebuilds staging is appropriate I'll try doing a build anyway though but that'll have to be tomorrow.

@veprbl
Copy link
Member

veprbl commented Jun 7, 2023

Result of nixpkgs-review pr 234861 run on x86_64-darwin 1

1 package built:
  • hello

@toonn
Copy link
Contributor

toonn commented Jun 9, 2023

I'm still testing this. I don't expect issues so feel free to merge if you're confident in the changes.
Just wanted to ping to say I'm not neglecting this so the PR isn't "stuck."

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.

Was finally able to reproduce on the staging commit, not sure what I was doing wrong before.

LGTM

@toonn toonn merged commit b7d4899 into NixOS:staging Jun 11, 2023
@eliasnaur
Copy link
Contributor

Thank you! I can confirm that this was the final piece of the puzzle in my quest towards bit-for-bit reproducibility: my project now builds the exact same bits across all 4 combinations of Linux/macOS and x86_64/M1.

@reckenrode reckenrode deleted the corefoundation-rpath branch June 20, 2023 02:19
reckenrode added a commit to reckenrode/nixpkgs that referenced this pull request Jul 2, 2023
@emilazy found a bug in NixOS#234861. Specifically, the hook is not actually
applied. e2fsprogs links against darwin.CF, but since it cannot find the
framework by rpath, it crashes.

Since the hook should always be used, it is copied directly to
`nix-support/setup-hook` instead of providing it as an attribute. This
preserves dropping the hook in the cross-compilation case while
providing it for everything else that needs it.

To avoid further churn and due to the complexity of building the stdenv
with the hook active, this change required the stdenv rework.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants