mirror of https://github.com/rust-lang/rust.git
Auto merge of #43117 - MJDSys:fix_rustbuild_libdir_2, r=alexcrichton
Fix stage 2 builds with a custom libdir. When copying libstd for the stage 2 compiler, the builder ignores the configured libdir/libdir_relative configuration parameters. This causes the compiler to fail to find libstd, which cause any tools built with the stage 2 compiler to fail. To fix this, make the copy steps of rustbuild aware of the libdir_relative parameter when the stage >= 2. Also update the dist target to be aware of the new location of libstd.
This commit is contained in:
commit
55ad73b026
|
@ -405,8 +405,9 @@ pub fn std(build: &Build, compiler: &Compiler, target: &str) {
|
||||||
|
|
||||||
let dst = image.join("lib/rustlib").join(target);
|
let dst = image.join("lib/rustlib").join(target);
|
||||||
t!(fs::create_dir_all(&dst));
|
t!(fs::create_dir_all(&dst));
|
||||||
let src = build.sysroot(compiler).join("lib/rustlib");
|
let mut src = build.sysroot_libdir(compiler, target);
|
||||||
cp_r(&src.join(target), &dst);
|
src.pop(); // Remove the trailing /lib folder from the sysroot_libdir
|
||||||
|
cp_r(&src, &dst);
|
||||||
|
|
||||||
let mut cmd = rust_installer(build);
|
let mut cmd = rust_installer(build);
|
||||||
cmd.arg("generate")
|
cmd.arg("generate")
|
||||||
|
|
|
@ -645,8 +645,14 @@ impl Build {
|
||||||
/// Returns the libdir where the standard library and other artifacts are
|
/// Returns the libdir where the standard library and other artifacts are
|
||||||
/// found for a compiler's sysroot.
|
/// found for a compiler's sysroot.
|
||||||
fn sysroot_libdir(&self, compiler: &Compiler, target: &str) -> PathBuf {
|
fn sysroot_libdir(&self, compiler: &Compiler, target: &str) -> PathBuf {
|
||||||
self.sysroot(compiler).join("lib").join("rustlib")
|
if compiler.stage >= 2 {
|
||||||
.join(target).join("lib")
|
if let Some(ref libdir_relative) = self.config.libdir_relative {
|
||||||
|
return self.sysroot(compiler).join(libdir_relative)
|
||||||
|
.join("rustlib").join(target).join("lib")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.sysroot(compiler).join("lib").join("rustlib")
|
||||||
|
.join(target).join("lib")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the root directory for all output generated in a particular
|
/// Returns the root directory for all output generated in a particular
|
||||||
|
|
Loading…
Reference in New Issue