Skip to content

Commit

Permalink
Rollup merge of rust-lang#97041 - eddyb:nixos-llvm-ci-patchelf, r=Mar…
Browse files Browse the repository at this point in the history
…k-Simulacrum

Fix `download-ci-llvm` NixOS patching for `.so`s.

See rust-lang#95170 (comment) - in short, `Path::ends_with` doesn't do the same thing as `str::ends_with`, and can only be used to check for whole file names, not extensions.

With this PR, I get the full suite of:
```
extracting /home/eddy/Projects/rust-A/build/cache/llvm-ebb80ec4e90f8622440f3e33562db0d6e6c66555-true/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz to /home/eddy/Projects/rust-A/build/x86_64-unknown-linux-gnu/ci-llvm
info: you seem to be using Nix. Attempting to patch /home/eddy/Projects/rust-A/build/x86_64-unknown-linux-gnu/ci-llvm/bin/llvm-config
/nix/store/r4bzq2xilvv8fmqjg626hzwi22ah3hf4-rust-stage0-dependencies
info: you seem to be using Nix. Attempting to patch /home/eddy/Projects/rust-A/build/x86_64-unknown-linux-gnu/ci-llvm/bin/FileCheck
info: you seem to be using Nix. Attempting to patch /home/eddy/Projects/rust-A/build/x86_64-unknown-linux-gnu/ci-llvm/lib/libLLVM-14-rust-1.62.0-nightly.so
```
(that `libLLVM-14-rust-1.62.0-nightly.so` at the end having been missing before)

r? `@Mark-Simulacrum` cc `@jyn514`
  • Loading branch information
matthiaskrgr authored May 15, 2022
2 parents 673d451 + f38555c commit a37ba96
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ pub(crate) fn maybe_download_ci_llvm(builder: &Builder<'_>) {
let llvm_lib = llvm_root.join("lib");
for entry in t!(fs::read_dir(&llvm_lib)) {
let lib = t!(entry).path();
if lib.ends_with(".so") {
if lib.extension().map_or(false, |ext| ext == "so") {
fix_bin_or_dylib(builder, &lib);
}
}
Expand Down Expand Up @@ -284,7 +284,7 @@ fn fix_bin_or_dylib(builder: &Builder<'_>, fname: &Path) {
entries
};
patchelf.args(&[OsString::from("--set-rpath"), rpath_entries]);
if !fname.ends_with(".so") {
if !fname.extension().map_or(false, |ext| ext == "so") {
// Finally, set the corret .interp for binaries
let dynamic_linker_path = nix_deps_dir.join("nix-support/dynamic-linker");
// FIXME: can we support utf8 here? `args` doesn't accept Vec<u8>, only OsString ...
Expand Down

0 comments on commit a37ba96

Please sign in to comment.