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

rustc: patch the path to llvm-strip instead of using /usr/bin/strip on darwin #362388

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

GaetanLepage
Copy link
Contributor

@GaetanLepage GaetanLepage commented Dec 6, 2024

Things done

Rust calls hardcoded /usr/bin/strip on darwin.
This leads to build failures in the sandbox.
Instead, hardcode the path to our own llvm-strip binary.

cc @alyssais @reckenrode @Havvy

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@GaetanLepage GaetanLepage changed the title rustc: patch the path to llvm-strip instead of using /usr/bin/strip on darwin rustc: patch the path to llvm-strip instead of using /usr/bin/strip on darwin Dec 6, 2024
pkgs/development/compilers/rust/rustc.nix Outdated Show resolved Hide resolved
pkgs/development/compilers/rust/rustc.nix Outdated Show resolved Hide resolved
substituteInPlace compiler/rustc_codegen_ssa/src/back/link.rs \
--replace-fail \
'let stripcmd = if cfg!(target_os = "macos") { "/usr/bin/strip" } else { "strip" };' \
'let stripcmd = "${lib.getExe' llvmPackages.llvm "llvm-strip"}";'
Copy link
Member

@alyssais alyssais Dec 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be llvmShared, so we don't end up referencing multiple LLVMs?

(Would appreciate input from somebody who understands all the LLVMs involved here better than me.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we punt on understanding the LLVMs and just use ${lib.getExe' stdenv.cc "strip"} ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we punt on understanding the LLVMs and just use ${lib.getExe' stdenv.cc "strip"} ?

eh, maybe that is even worse due to the symlinks. disregard.

Copy link
Contributor

@paparodeo paparodeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. on staging-next built rustc & cargo outside sandbox on aarch64-darwin and then built ruff in sandbox = relaxed; and built fine.

$ nix-store --query -R /nix/store/swy0zgm75f6385njibppbplsxqb8x9f6-rustc-1.83.0
/nix/store/1w5wdysl1sqnwxaa6j4j4llss93jfn5z-libiconv-107
/nix/store/1k3h865wpr3fzi1mp0j8lndnmmcdr4wr-libxml2-2.13.4
/nix/store/icai2b2bh2rrlhlhnasansdr0p1p7am6-zlib-1.3.1
/nix/store/s17z21xw3p164z0nlgd4v7h4jlr30sjq-libffi-3.4.6
/nix/store/x6xs2b06am37bx45xr59qi14bbws8s34-libcxx-19.1.4
/nix/store/7b9pbhkcqsww1miks3zql7qnqid38qa7-llvm-19.1.4-lib
/nix/store/ggbsv8vxj759k624wi6xvw1yfhi8j59k-bash-5.2p37
/nix/store/px76sq9i5mx39g17bsaj379yhqhdz9w7-llvm-19.1.4
/nix/store/swy0zgm75f6385njibppbplsxqb8x9f6-rustc-1.83.0

@GaetanLepage GaetanLepage mentioned this pull request Dec 6, 2024
13 tasks
@vcunat vcunat merged commit 43c5cd5 into NixOS:staging-next Dec 6, 2024
18 of 19 checks passed
@vcunat
Copy link
Member

vcunat commented Dec 6, 2024

I'll optimistically merge already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants