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

auto-patchelf: refactor structuredAttrs support #340858

Conversation

wolfgangwalther
Copy link
Contributor

Description of changes

Follow up to #318614 to use concatTo in setup-hooks/auto-patchelf.sh.

This needs to support * in the non-structuredAttrs case, so adjusted concatTo for that.

Can be tested via nix-build -A tests.auto-patchelf-hook. This will fail - but in the same way as on current master and the output clearly shows that flags are passed correctly. Not sure whether it is supposed to fail, though? CC @ConnorBaker and @yannham, who introduced it in #272752.

CC @emilazy @philiptaron @tie

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.

Copy link
Member

@tie tie left a comment

Choose a reason for hiding this comment

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

LGTM (with a single suggestion comment).

pkgs/stdenv/generic/setup.sh Outdated Show resolved Hide resolved
@ConnorBaker
Copy link
Contributor

Hello! I'll take a look at this when I'm able, but don't let me approval be a blocker.

I've noticed a lot of PRs targeting staging recently dealing with various aspects of support for __structuredAttrs -- is there a tracking issue for better support I can use to look at recent changes? For example, I'm not familiar with the function being used in this PR, concatTo.

@wolfgangwalther
Copy link
Contributor Author

I've noticed a lot of PRs targeting staging recently dealing with various aspects of support for __structuredAttrs -- is there a tracking issue for better support I can use to look at recent changes? For example, I'm not familiar with the function being used in this PR, concatTo.

There is no tracking issue, the discussion around this all happened in #318614.

@wolfgangwalther wolfgangwalther force-pushed the structured-attrs-setup-hooks-auto-patchelf branch from aab1529 to 57721a1 Compare September 10, 2024 17:40
@ConnorBaker
Copy link
Contributor

I've noticed a lot of PRs targeting staging recently dealing with various aspects of support for __structuredAttrs -- is there a tracking issue for better support I can use to look at recent changes? For example, I'm not familiar with the function being used in this PR, concatTo.

There is no tracking issue, the discussion around this all happened in #318614.

I updated an old tracking issue: #205690. If you do additional PRs, would you mind referencing it? Makes it easier to track related work (which will come in handy when I eventually need to update or troubleshoot the setup hooks the CUDA ecosystem uses).

@yannham
Copy link
Contributor

yannham commented Sep 10, 2024

I haven't looked at it yet, but will try to do it by tomorrow. I originally wrote the tests for #272752 - I don't think they were supposed to fail, but I can't be 100% sure either honestly as it's been some time. Will at least take a quick look at the output of nix-build -A tests.auto-patchelf-hook

@yannham
Copy link
Contributor

yannham commented Sep 11, 2024

@wolfgangwalther Thanks for pinging me. The test is broken on master, and fails at [auto-patchelf-hook-test]: Check that the runpath has the right number of entries, which differs between the actual number of entries in the RUNPATH and the expected number of entries.

I suspect it's a change in stdenv or something, but this simple patch should fix the test (at least it does on master and it's unrelated to what we're interested in testing):

--- a/pkgs/test/auto-patchelf-hook/package.nix
+++ b/pkgs/test/auto-patchelf-hook/package.nix
@@ -60,7 +60,6 @@ stdenv.mkDerivation {
   # Additional phase performing the actual test.
   installCheckPhase =
     let allDeps = runtimeDependencies ++ [
-        (lib.getLib stdenv.cc.libc)
         (lib.getLib freetype)
       ];
     in

If you want to make sure your change didn't break the test, given the one line diff, you can include the fix in this PR I guess.

Fix suggested by Yann Hamdaoui in
NixOS#340858 (comment).
stdenv now provides better tooling to support structuredAttrs without
depending on $__structuredAttrs itself.
@wolfgangwalther wolfgangwalther force-pushed the structured-attrs-setup-hooks-auto-patchelf branch from 57721a1 to bc0395e Compare September 11, 2024 17:55
@wolfgangwalther
Copy link
Contributor Author

If you want to make sure your change didn't break the test, given the one line diff, you can include the fix in this PR I guess.

Did that, thanks!

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.

I did a few builds and everything came up roses. Let's merge this in the next day or so.

@jcollie
Copy link

jcollie commented Sep 11, 2024

The Zig build hook appears to have been broken by these changes.

@philiptaron
Copy link
Contributor

The Zig build hook appears to have been broken by these changes.

Do you mean the autoPatchelfHook ones specifically, or a previous PR @jcollie?

@jcollie
Copy link

jcollie commented Sep 11, 2024

The Zig build hook appears to have been broken by these changes.

Do you mean the autoPatchelfHook ones specifically, or a previous PR @jcollie?

I'm not exactly sure which PR broke what, but I see this now when trying to build a Zig package:

/nix/store/3bwyb6sw8qzir9prnh3609anzw9nvp6g-zig-hook/nix-support/setup-hook: line 15: concatTo: command not found

@wolfgangwalther
Copy link
Contributor Author

wolfgangwalther commented Sep 11, 2024

The Zig build hook appears to have been broken by these changes.

Do you mean the autoPatchelfHook ones specifically, or a previous PR @jcollie?

I'm not exactly sure which PR broke what, but I see this now when trying to build a Zig package:

/nix/store/3bwyb6sw8qzir9prnh3609anzw9nvp6g-zig-hook/nix-support/setup-hook: line 15: concatTo: command not found

This is very likely unrelated to this PR here. The zig hooks were changed in #335666. This is already on master. From what I can tell, building packages with zig still works.

Where (on which branch?) and how (any specific package to build?) can we reproduce this?

@jcollie
Copy link

jcollie commented Sep 11, 2024

Where (on which branch?) and how (any specific package to build?) can we reproduce this?

This is unfortunately in a package that isn't open source (yet), but it was on unstable. I'll see if I can reproduce it tonight in another package that is open source.

@philiptaron philiptaron merged commit 05e5a56 into NixOS:staging Sep 12, 2024
23 checks passed
@wolfgangwalther wolfgangwalther deleted the structured-attrs-setup-hooks-auto-patchelf branch September 23, 2024 18:09
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.

7 participants