Skip to content

Commit 3747df7

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 cf9cf7c commit 3747df7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/bootstrap/dist.rs

+16
Original file line numberDiff line numberDiff line change
@@ -2335,6 +2335,22 @@ fn maybe_install_llvm(builder: &Builder<'_>, target: TargetSelection, dst_libdir
23352335
return;
23362336
}
23372337

2338+
if let Some(config) = builder.config.target_config.get(&target) {
2339+
if config.llvm_config.is_some() {
2340+
// If the LLVM was externally provided, then we don't currently copy
2341+
// artifacts into the sysroot. This is not necessarily the right
2342+
// choice (in particular, it will require the LLVM dylib to be in
2343+
// the linker's load path at runtime), but the common use case for
2344+
// external LLVMs is distribution provided LLVMs, and in that case
2345+
// they're usually in the standard search path (e.g., /usr/lib) and
2346+
// copying them here is going to cause problems as we may end up
2347+
// with the wrong files and isn't what distributions want.
2348+
//
2349+
// This behavior may be revisited in the future though.
2350+
return;
2351+
}
2352+
}
2353+
23382354
// On macOS, rustc (and LLVM tools) link to an unversioned libLLVM.dylib
23392355
// instead of libLLVM-11-rust-....dylib, as on linux. It's not entirely
23402356
// clear why this is the case, though. llvm-config will emit the versioned

0 commit comments

Comments
 (0)