Skip to content

Rust 1.77 will clash harder with GNU binutils on Darwin Nix #299606

@workingjubilee

Description

@workingjubilee

Describe the bug

cargo 1.77 started stripping debuginfo by default for cargo build --release in order to make Rust binaries smaller by default, but on macOS, if somehow the "wrong" (GNU binutils ~2.41, I believe?) strip gets into the PATH, the strip call will result in a segfaulting binary when executed. nixpkgs does try to work around this already, and things work fine when the "right" strip is the path.

based on bug reports from macOS users, this is often not enough for many actually-extant user configurations. macOS users that use Nix are running into this anyways, due to their PATH rearranging (possibly after entering a nix shell? flake? no idea...). it is possible some specific Nix-based tooling is causing the problem, as a result, and not nixpkgs per se, but we have not gotten enough information from reports to narrow this down... it's simultaneously pervasive and elusive, despite the known reasons.

I decided to file this bug, even though it is incredibly vague, because you may wish to figure out a position on this issue before you land an upgrade to the Rust 1.77 toolchain for nixpkgs, and because people seem to prefer opening the issue against rust-lang as it regresses on the latest version of the toolchain, despite being a preexisting issue (i.e. the "wrong strip" could already be a problem if someone enabled it in their Cargo.toml's build settings, or used it "by hand"). please feel free to close it whenever.

Steps To Reproduce

steps to reproduce the behavior:

  1. put the GNU strip first in the PATH while on macOS
  2. set up the rust 1.77 toolchain
  3. cargo run --release

technically this also happens with compiling a C program and stripping it "manually", etc.

Expected behavior

printing "Hello world!", probably.

Screenshots

nah.

Additional context

apparently homebrew also sometimes causes this problem.

Notify maintainers

idk who should be bothered over this.

Metadata

not applicable.

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: darwinRunning or building packages on Darwin6.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