Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 4ee7538

Browse files
Avoid installing external LLVM dylibs
If the LLVM was externally provided, then we don't currently copy artifacts into the sysroot. This is not necessarily the right choice (in particular, it will require the LLVM dylib to be in the linker's load path at runtime), but the common use case for external LLVMs is distribution provided LLVMs, and in that case they're usually in the standard search path (e.g., /usr/lib) and copying them here is going to cause problems as we may end up with the wrong files and isn't what distributions want. This behavior may be revisited in the future though.
1 parent 61bc95a commit 4ee7538

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/bootstrap/dist.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2377,6 +2377,22 @@ fn maybe_install_llvm(builder: &Builder<'_>, target: TargetSelection, dst_libdir
23772377
return;
23782378
}
23792379

2380+
if let Some(config) = builder.config.target_config.get(&target) {
2381+
if config.llvm_config.is_some() {
2382+
// If the LLVM was externally provided, then we don't currently copy
2383+
// artifacts into the sysroot. This is not necessarily the right
2384+
// choice (in particular, it will require the LLVM dylib to be in
2385+
// the linker's load path at runtime), but the common use case for
2386+
// external LLVMs is distribution provided LLVMs, and in that case
2387+
// they're usually in the standard search path (e.g., /usr/lib) and
2388+
// copying them here is going to cause problems as we may end up
2389+
// with the wrong files and isn't what distributions want.
2390+
//
2391+
// This behavior may be revisited in the future though.
2392+
return;
2393+
}
2394+
}
2395+
23802396
// On macOS, rustc (and LLVM tools) link to an unversioned libLLVM.dylib
23812397
// instead of libLLVM-11-rust-....dylib, as on linux. It's not entirely
23822398
// clear why this is the case, though. llvm-config will emit the versioned

0 commit comments

Comments
 (0)