Skip to content

Commit e3d52b8

Browse files
authored
Rollup merge of rust-lang#78986 - Mark-Simulacrum:fix-llvm, r=alexcrichton
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. Fixes rust-lang#78932.
2 parents 4fcb617 + 3747df7 commit e3d52b8

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
@@ -2357,6 +2357,22 @@ fn maybe_install_llvm(builder: &Builder<'_>, target: TargetSelection, dst_libdir
23572357
return;
23582358
}
23592359

2360+
if let Some(config) = builder.config.target_config.get(&target) {
2361+
if config.llvm_config.is_some() {
2362+
// If the LLVM was externally provided, then we don't currently copy
2363+
// artifacts into the sysroot. This is not necessarily the right
2364+
// choice (in particular, it will require the LLVM dylib to be in
2365+
// the linker's load path at runtime), but the common use case for
2366+
// external LLVMs is distribution provided LLVMs, and in that case
2367+
// they're usually in the standard search path (e.g., /usr/lib) and
2368+
// copying them here is going to cause problems as we may end up
2369+
// with the wrong files and isn't what distributions want.
2370+
//
2371+
// This behavior may be revisited in the future though.
2372+
return;
2373+
}
2374+
}
2375+
23602376
// On macOS, rustc (and LLVM tools) link to an unversioned libLLVM.dylib
23612377
// instead of libLLVM-11-rust-....dylib, as on linux. It's not entirely
23622378
// clear why this is the case, though. llvm-config will emit the versioned

0 commit comments

Comments
 (0)