Skip to content

Commit b0d01e7

Browse files
committed
ensure that sysroot is properly set for cross-targets
Previously, doing `x test compiler/*` would fail the build due to missing std. This change ensures that it is prepared. Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent 735f758 commit b0d01e7

File tree

1 file changed

+11
-2
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+11
-2
lines changed

Diff for: src/bootstrap/src/core/build_steps/test.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -2563,8 +2563,17 @@ impl Step for Crate {
25632563
let target = self.target;
25642564
let mode = self.mode;
25652565

2566-
// See [field@compile::Std::force_recompile].
2567-
builder.ensure(compile::Std::force_recompile(compiler, target));
2566+
// If we're not in stage 0, then we won't have a std from the beta
2567+
// compiler around. That means we need to make sure there's one in
2568+
// the sysroot for the compiler to find. Otherwise, we're going to
2569+
// fail when building crates that need to generate code (e.g., build
2570+
// scripts and their dependencies).
2571+
if compiler.stage != 0 {
2572+
// See [field@compile::Std::force_recompile].
2573+
builder.ensure(compile::Std::force_recompile(compiler, target));
2574+
builder.ensure(compile::Std::force_recompile(compiler, compiler.host));
2575+
}
2576+
25682577
builder.ensure(RemoteCopyLibs { compiler, target });
25692578

25702579
// If we're not doing a full bootstrap but we're testing a stage2

0 commit comments

Comments
 (0)