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

radicle-upstream: workaround build failure due to missing libgcc #250710

Closed
wants to merge 1 commit into from

Conversation

trofi
Copy link
Contributor

@trofi trofi commented Aug 22, 2023

Without the change build fails as:

   > searching for dependencies of /nix/store/gv5yvdd91vg3f4s1j6zf07xkclcpqn1c-git-remote-rad-0.3.0/bin/git-remote-rad
   >     libgcc_s.so.1 -> not found!
   > auto-patchelf: 1 dependencies could not be satisfied

This happens because autoPatchelfHook does not pull the dependency in automatically and requires explicitly exposing internal implementation details of the stdenv.

Description of changes

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.11 Release Notes (or backporting 23.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.

Without the change build fails as:

       > searching for dependencies of /nix/store/gv5yvdd91vg3f4s1j6zf07xkclcpqn1c-git-remote-rad-0.3.0/bin/git-remote-rad
       >     libgcc_s.so.1 -> not found!
       > auto-patchelf: 1 dependencies could not be satisfied

This happens because `autoPatchelfHook` does not pull the dependency in
automatically and requires explicitly exposing internal implementation
details of the `stdenv`.
@@ -25,7 +25,7 @@ let
src = contents;

nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [ zlib ];
buildInputs = [ zlib stdenv.cc.cc.libgcc or null ];
Copy link
Member

Choose a reason for hiding this comment

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

Please add parens for clarity. I'm surprised that even evals.

I think something along the lines of ++ optionals stdenv.cc.isGNU [ stdenv.cc.cc.libgcc ] would be cleaner and easier to read.
A comment explaining why it needs this would also be nice.

Also why is it cc.cc? Not very knowledgable about stdenv.

Copy link
Contributor Author

@trofi trofi Aug 22, 2023

Choose a reason for hiding this comment

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

Please add parens for clarity. I'm surprised that even evals.

I took stdenv.cc.cc.libgcc or null as is from one of those:

$ git grep -F 'stdenv.cc.cc.libgcc or null' | cat
pkgs/development/interpreters/python/pypy/prebuilt.nix:    stdenv.cc.cc.libgcc or null
pkgs/development/interpreters/python/pypy/prebuilt_2_7.nix:    stdenv.cc.cc.libgcc or null
pkgs/development/mobile/androidenv/tools.nix:        stdenv.cc.cc.libgcc or null # fix for https://github.com/NixOS/nixpkgs/issues/226357
pkgs/tools/admin/pulumi-bin/default.nix:  buildInputs = [ stdenv.cc.cc.libgcc or null ];
pkgs/tools/admin/realvnc-vnc-viewer/linux.nix:  buildInputs = [ libX11 libXext stdenv.cc.cc.libgcc or null ];
pkgs/top-level/all-packages.nix:  libgcc = stdenv.cc.cc.libgcc or null;

I agree it's confusing, but I though it's at least consistent.

I think something along the lines of ++ optionals stdenv.cc.isGNU [ stdenv.cc.cc.libgcc ] would be cleaner and easier to read.

I'm not sure if stdenv.cc.cc.libgcc is present in pkgsStatic (or expected to be present).

A comment explaining why it needs this would also be nice. Also why is it cc.cc? Not very knowledgable about stdenv.

Good question. I'm probably the worst person to defend the solution. I filed #250744 instead and added a note on the PR that caused the regression: #209870 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

I'm not sure if stdenv.cc.cc.libgcc is present in pkgsStatic (or expected to be present).

It isn't. pkgsStatic is one the common reasons for the or null.

dlopen() has always been an unsolved problem for autoPatchelfHook.

@trofi
Copy link
Contributor Author

trofi commented Aug 22, 2023

Closing in favour #250744 issue.

@trofi trofi closed this Aug 22, 2023
@trofi trofi deleted the radicle-upstream-patchelf-fix branch August 22, 2023 11:03
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.

Mention issue 225963 in the commit msg

approve

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