Skip to content

Commit 1283441

Browse files
committed
Let llvm-config tell us where to find its tools
1 parent 43c22af commit 1283441

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/bootstrap/native.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -497,18 +497,13 @@ impl Step for Llvm {
497497

498498
// https://llvm.org/docs/HowToCrossCompileLLVM.html
499499
if target != builder.config.build {
500-
builder.ensure(Llvm { target: builder.config.build });
501-
// FIXME: if the llvm root for the build triple is overridden then we
502-
// should use llvm-tblgen from there, also should verify that it
503-
// actually exists most of the time in normal installs of LLVM.
504-
let host_bin = builder.llvm_out(builder.config.build).join("bin");
500+
let llvm_config = builder.ensure(Llvm { target: builder.config.build });
501+
let llvm_bindir = output(Command::new(&llvm_config).arg("--bindir"));
502+
let host_bin = Path::new(llvm_bindir.trim());
505503
cfg.define("LLVM_TABLEGEN", host_bin.join("llvm-tblgen").with_extension(EXE_EXTENSION));
506504
// LLVM_NM is required for cross compiling using MSVC
507505
cfg.define("LLVM_NM", host_bin.join("llvm-nm").with_extension(EXE_EXTENSION));
508-
cfg.define(
509-
"LLVM_CONFIG_PATH",
510-
host_bin.join("llvm-config").with_extension(EXE_EXTENSION),
511-
);
506+
cfg.define("LLVM_CONFIG_PATH", llvm_config);
512507
if builder.config.llvm_clang {
513508
let build_bin = builder.llvm_out(builder.config.build).join("build").join("bin");
514509
let clang_tblgen = build_bin.join("clang-tblgen").with_extension(EXE_EXTENSION);

0 commit comments

Comments
 (0)