diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index e9e2a881d111d..06423ab407446 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -2575,6 +2575,12 @@ impl Step for Crate { // we're working with automatically. let compiler = builder.compiler_for(compiler.stage, compiler.host, target); + // During cross compilations, sysroot for the target may not be available. + // Ensure that it is prepared. + if builder.config.build != target { + builder.ensure(compile::Std::new(compiler, compiler.host)); + } + let mut cargo = builder::Cargo::new( builder, compiler,