Skip to content

Commit 7fb4512

Browse files
committed
fix llvm_out to use the correct LLVM root
When `download-ci-llvm` is enabled, `llvm_out` ends up with the error below due to an incorrect path on cross-compilations. This change fixes that. ``` failed to execute command: "/rust/build/x86_64-unknown-linux-gnu/llvm/build/bin/llvm-config" "--version" ERROR: No such file or directory (os error 2) ``` Signed-off-by: onur-ozkan <[email protected]>
1 parent 4a2fe44 commit 7fb4512

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/bootstrap/src/core/build_steps/llvm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub fn prebuilt_llvm_config(
9898
let out_dir = builder.llvm_out(target);
9999

100100
let mut llvm_config_ret_dir = builder.llvm_out(builder.config.build);
101-
if !builder.config.build.is_msvc() || builder.ninja() {
101+
if (!builder.config.build.is_msvc() || builder.ninja()) && !builder.config.llvm_from_ci {
102102
llvm_config_ret_dir.push("build");
103103
}
104104
llvm_config_ret_dir.push("bin");

src/bootstrap/src/lib.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -796,12 +796,16 @@ impl Build {
796796
self.stage_out(compiler, mode).join(&*target.triple).join(self.cargo_dir())
797797
}
798798

799-
/// Root output directory for LLVM compiled for `target`
799+
/// Root output directory of LLVM for `target`
800800
///
801801
/// Note that if LLVM is configured externally then the directory returned
802802
/// will likely be empty.
803803
fn llvm_out(&self, target: TargetSelection) -> PathBuf {
804-
self.out.join(&*target.triple).join("llvm")
804+
if self.config.llvm_from_ci && self.config.build == target {
805+
self.config.ci_llvm_root()
806+
} else {
807+
self.out.join(&*target.triple).join("llvm")
808+
}
805809
}
806810

807811
fn lld_out(&self, target: TargetSelection) -> PathBuf {

0 commit comments

Comments
 (0)