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

patching cargo's elf with libsecret causes infinte recursion #198

Open
nihirash opened this issue Dec 4, 2024 · 2 comments
Open

patching cargo's elf with libsecret causes infinte recursion #198

nihirash opened this issue Dec 4, 2024 · 2 comments
Labels
question Further information is requested

Comments

@nihirash
Copy link

nihirash commented Dec 4, 2024

Hello!

Thank you for your overlay but recently we got some issues after updating flakes.

I've check what was changed for this time and found that patching cargo's elf with libsecret was added.

To prove my idea I've forked overlay and removed lines with adding libsecret as conditional dependency - it solved issues.

… while evaluating derivation 'cargo-1.82.0-x86_64-unknown-linux-gnu'
         whose name attribute is located at /nix/store/808lp63z6yiraikjpzcfk3xg1frpd2s0-source/pkgs/stdenv/generic/make-derivation.nix:333:7
       … while evaluating attribute 'postFixup' of derivation 'cargo-1.82.0-x86_64-unknown-linux-gnu'
         at /nix/store/95imprpvbwx51z45gywhvx881dwgsrjw-source/lib/mk-component-set.nix:108:7:
          107|       # Darwin binaries usually just work... except for these linking to rustc from another drv.
          108|       postFixup = optionalString (hostPlatform.isDarwin && linksToRustc) ''
             |       ^
          109|         for f in $out/bin/*; do
       … from call site
         at /nix/store/95imprpvbwx51z45gywhvx881dwgsrjw-source/lib/mk-component-set.nix:157:9:
          156|       ''
          157|       + optionalString (stdenv.isLinux && pname == "cargo") ''
             |         ^
          158|         patchelf --add-needed ${pkgsHostHost.libsecret}/lib/libsecret-1.so.0 $out/bin/cargo
       … while calling 'optionalString'
         at /nix/store/808lp63z6yiraikjpzcfk3xg1frpd2s0-source/lib/strings.nix:268:5:
          267|     # String to return if condition is true
          268|     string: if cond then string else "";
             |     ^
          269|
       error: infinite recursion encountered
       at /nix/store/95imprpvbwx51z45gywhvx881dwgsrjw-source/lib/mk-component-set.nix:158:31:
          157|       + optionalString (stdenv.isLinux && pname == "cargo") ''
          158|         patchelf --add-needed ${pkgsHostHost.libsecret}/lib/libsecret-1.so.0 $out/bin/cargo
             |                               ^
          159|       '';
@xokdvium
Copy link

Just ran into a similar problem for cross-compilation to thumbv7m-none-eabi and for me that was due to an overlay similar to this:

final: _prev: {
  rustc = rustToolchain.overrideAttrs { unwrapped = rustToolchain; };
  cargo = rustToolchain.overrideAttrs { unwrapped = rustToolchain; };
}

This indeed causes an infinite recursion cargo -> libsecret -> gjs -> spidermonkey -> rustc + cargo -> libsecret. I just got rid of this (seemingly erroneous) overlay and all is well.

@oxalica oxalica added the question Further information is requested label Dec 31, 2024
@oxalica
Copy link
Owner

oxalica commented Dec 31, 2024

final: _prev: {
  rustc = rustToolchain.overrideAttrs { unwrapped = rustToolchain; };
  cargo = rustToolchain.overrideAttrs { unwrapped = rustToolchain; };
}

We strongly recommend NOT to overlay the global Rust platform unless you know what you are doing. It will rebuild all packages involving Rust and their descendants, thus causing a dependency loop in a high probability. rust-overlay are not meant to replace nixpkgs's rust platform but to extend it. nixpkgs-bootstrap-ability is not in our goals, thus we don't avoid (transitive-)dependency to nixpkgs' rustc, at least for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants