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

Rust build support doesn't use NIX_LDFLAGS in link flags #326944

Open
kira-bruneau opened this issue Jul 13, 2024 · 3 comments
Open

Rust build support doesn't use NIX_LDFLAGS in link flags #326944

kira-bruneau opened this issue Jul 13, 2024 · 3 comments
Labels
0.kind: bug 6.topic: rust significant Novel ideas, large API changes, notable refactorings, issues with RFC potential, etc.

Comments

@kira-bruneau
Copy link
Contributor

Describe the bug

I was trying to use NIX_LDFLAGS instead of LD_LIBRARY_PATH in ukmm to link extra runtime libraries, but ukmm would silently fail to start: #325139 (comment). I noticed that a bunch of other packages were defining RUSTFLAGS to handle this, so I just ended up using that instead, but it was surprising to see that NIX_LDFLAGS wouldn't work.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Create a rust package with NIX_LDFLAGS set
  2. Notice that the libraries listed in NIX_LDFLAGS don't actually get linked in resulting binaries

Expected behavior

NIX_LDFLAGS should link extra libraries in rust like it does with packages built with c.

Notify maintainers

@zowoq @winterqt @figsoda

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.9.6, NixOS, 24.05 (Uakari), 24.05.20240623.e4509b3`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - nixpkgs: `/nix/store/h5hhc58qp2rcv0f3d9di6569pxrpsi1j-source`
@Qyriad Qyriad added 6.topic: rust significant Novel ideas, large API changes, notable refactorings, issues with RFC potential, etc. labels Jul 23, 2024
@nbdd0121
Copy link
Contributor

I believe this is another case caused by rust-lang/rust#124129

@kira-bruneau
Copy link
Contributor Author

I don't think this is a regression, it just looks like it was something that wasn't considered when the rust builder was created.

It seems like all other packages that use the same workaround I used for ukmm were merged before rust-lang/rust#124129:

@nbdd0121
Copy link
Contributor

Cosmic ones use dlopen so they require the no-as-needed flag to have the libraries added even without any symbol reference.

What I have observed is that with Rust nightly even referenced symbols will not have rpath set properly. I guess what I see is a different bug with similar symptom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug 6.topic: rust significant Novel ideas, large API changes, notable refactorings, issues with RFC potential, etc.
Projects
None yet
Development

No branches or pull requests

3 participants