Skip to content

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

@kira-bruneau

Description

@kira-bruneau

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`

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken1.severity: significantNovel ideas, large API changes, notable refactorings, issues with RFC potential, etc.6.topic: rustGeneral-purpose programming language emphasizing performance, type safety, and concurrency.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions