Skip to content

Commit

Permalink
add the correct version of LLVM into the stage0 sysroot
Browse files Browse the repository at this point in the history
In some cases(see rust-lang#109314), when the stage0
compiler relies on more recent version of LLVM than the beta compiler, it may not
be able to locate the correct LLVM in the sysroot. This situation typically occurs
when we upgrade LLVM version while the beta compiler continues to use an older version.

Signed-off-by: ozkanonur <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Aug 7, 2023
1 parent ec5b882 commit aec4b59
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,16 @@ impl Step for Sysroot {
let _ = fs::remove_dir_all(&sysroot);
t!(fs::create_dir_all(&sysroot));

// In some cases(see https://github.com/rust-lang/rust/issues/109314), when the stage0
// compiler relies on more recent version of LLVM than the beta compiler, it may not
// be able to locate the correct LLVM in the sysroot. This situation typically occurs
// when we upgrade LLVM version while the beta compiler continues to use an older version.
//
// Make sure to add the correct version of LLVM into the stage0 sysroot.
if compiler.stage == 0 {
dist::maybe_install_llvm_target(builder, compiler.host, &sysroot);
}

// If we're downloading a compiler from CI, we can use the same compiler for all stages other than 0.
if builder.download_rustc() && compiler.stage != 0 {
assert_eq!(
Expand Down

0 comments on commit aec4b59

Please sign in to comment.