Skip to content

strip binary is PATH dependent which breaks builds in MacOS #123114

Closed
@n8henrie

Description

@n8henrie

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.

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

fn strip_symbols_with_external_utility<'a>(

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-discussionCategory: Discussion or questions that doesn't represent real issues.O-macosOperating system: macOS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions