Skip to content

Commit a37ba96

Browse files
authored
Rollup merge of rust-lang#97041 - eddyb:nixos-llvm-ci-patchelf, r=Mark-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`
2 parents 673d451 + f38555c commit a37ba96

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/bootstrap/native.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pub(crate) fn maybe_download_ci_llvm(builder: &Builder<'_>) {
156156
let llvm_lib = llvm_root.join("lib");
157157
for entry in t!(fs::read_dir(&llvm_lib)) {
158158
let lib = t!(entry).path();
159-
if lib.ends_with(".so") {
159+
if lib.extension().map_or(false, |ext| ext == "so") {
160160
fix_bin_or_dylib(builder, &lib);
161161
}
162162
}
@@ -284,7 +284,7 @@ fn fix_bin_or_dylib(builder: &Builder<'_>, fname: &Path) {
284284
entries
285285
};
286286
patchelf.args(&[OsString::from("--set-rpath"), rpath_entries]);
287-
if !fname.ends_with(".so") {
287+
if !fname.extension().map_or(false, |ext| ext == "so") {
288288
// Finally, set the corret .interp for binaries
289289
let dynamic_linker_path = nix_deps_dir.join("nix-support/dynamic-linker");
290290
// FIXME: can we support utf8 here? `args` doesn't accept Vec<u8>, only OsString ...

0 commit comments

Comments
 (0)