Description
I use MacOS frequently, and I've been bitten multiple times by issues related to the fact that one must have /usr/bin/strip
first on PATH
, prior to any strip
command that may be installed by homebrew, nix, or a custom command.
- nightly 1.78 build error on macOS for several crates #122641
- 1.77 produced release binaries die w/ SIGKILL on macos 14.4 #122902
- Setting strip = true in Cargo.toml makes build scripts fail in release mode on MacOS #110536
As I also use Linux quite a bit, I prefer having the GNU version of utilities like grep, sed, and find, and I keep these first in my PATH
so that my scripts keep the behavior I'm accustomed to. However, this leads to the wrong strip
also being first on PATH
, which breaks things.
Rust's current behavior with strip
leaves me in a bit of a tough spot. In particular with the recent change to strip by default for release builds, I've found that cargo install foo
unexpectedly crashes and burns if my PATH
doesn't lead with /usr/bin:...
.
It seems like this behavior might be coming from
rust/compiler/rustc_codegen_ssa/src/back/link.rs
Line 1102 in 47ecded
If so, it seems like it would be trivial to prefix PATH
with /usr/bin
(on MacOS specifically) in this function to work around this difficult behavior in a way that shouldn't affect other OSes and that should be universally correct on MacOS.
Would such a change be reasonable to consider? If so, I'd happily work on a PR.