From c7435b52a93d96c47a84e505f9eb6a505d6037b5 Mon Sep 17 00:00:00 2001 From: Mark Simulacrum Date: Fri, 7 Jul 2017 23:00:38 -0400 Subject: [PATCH] Cherry pick changes from ce3abc5801f94292be9bc5fbe00b52f1ccb28672. 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. --- src/bootstrap/builder.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index e284e4b9d0a..fbfe442d8f6 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -192,8 +192,13 @@ impl<'a> Builder<'a> { impl<'a> Step<'a> for Libdir<'a> { type Output = PathBuf; fn run(self, builder: &Builder) -> PathBuf { - let sysroot = builder.sysroot(self.compiler) - .join("lib").join("rustlib").join(self.target).join("lib"); + let lib = if compiler.stage >= 2 && builder.build.config.libdir_relative.is_some() { + builder.build.config.libdir_relative.cloned().unwrap() + } else { + PathBuf::from("lib") + }; + let sysroot = builder.sysroot(self.compiler).join(lib) + .join("rustlib").join(self.target).join("lib"); let _ = fs::remove_dir_all(&sysroot); t!(fs::create_dir_all(&sysroot)); sysroot