summary refs log tree commit diff
path: root/src/bootstrap/dist.rs
diff options
context:
space:
mode:
authorjyn <github@jyn.dev>2023-04-12 21:17:08 -0500
committerjyn <github@jyn.dev>2023-04-12 21:17:08 -0500
commit7d64c7cd024ac22e71df104577037d2e2fb42c49 (patch)
tree9a5707976e5b302b87f17382850d49624b66f42e /src/bootstrap/dist.rs
parent4087deaccd8bceb458c9610d29744d5f3504c5c0 (diff)
downloadrust-7d64c7cd024ac22e71df104577037d2e2fb42c49.tar.gz
rust-7d64c7cd024ac22e71df104577037d2e2fb42c49.zip
Add `libLLVM.so` to the target libdir when download-rustc is enabled
Previously, we would only add it to the host libdir, which meant it
couldn't be loaded by `ui-fulldeps` tests that used rustc_private.
Diffstat (limited to 'src/bootstrap/dist.rs')
-rw-r--r--src/bootstrap/dist.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
index 8ce220c8647..28478aca403 100644
--- a/src/bootstrap/dist.rs
+++ b/src/bootstrap/dist.rs
@@ -1960,6 +1960,20 @@ fn maybe_install_llvm(builder: &Builder<'_>, target: TargetSelection, dst_libdir
         }
     }
 
+    // FIXME: for reasons I don't understand, the LLVM so in the `rustc` component is different than the one in `rust-dev`.
+    // Only the one in `rustc` works with the downloaded compiler.
+    if builder.download_rustc() && target == builder.build.build {
+        let src_libdir = builder.ci_rustc_dir(target).join("lib");
+        for entry in t!(std::fs::read_dir(&src_libdir)) {
+            let entry = t!(entry);
+            if entry.file_name().to_str().unwrap().starts_with("libLLVM-") {
+                install_llvm_file(builder, &entry.path(), dst_libdir);
+                return !builder.config.dry_run();
+            }
+        }
+        panic!("libLLVM.so not found in src_libdir {}!", src_libdir.display());
+    }
+
     // On macOS, rustc (and LLVM tools) link to an unversioned libLLVM.dylib
     // instead of libLLVM-11-rust-....dylib, as on linux. It's not entirely
     // clear why this is the case, though. llvm-config will emit the versioned