diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 47b0637538b24..75a4473f27bee 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::Rustc::new(compiler, target)); + } + let mut cargo = builder::Cargo::new( builder, compiler,