From 7470592d0ba8a7be88d5d897fe4f0796fdbfa318 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sun, 27 Mar 2022 17:04:21 -0500 Subject: Fix `x test src/tools/error_index_generator --stage {0,1}` There were two fixes needed: 1. Use `top_stage` instead of `top_stage - 1`. There was a long and torturous comment about trying to match rustdoc's version, but it works better without the hard-coding than with. 2. Make sure that `ci-llvm/lib` is added to LD_LIBRARY_PATH. Previously the error index would be unable to load LLVM for stage0 builds. At some point we should probably have a discussion about how rustdoc stages should be numbered; confusion between 0/1/2 has come up several times in bootstrap now. Note that this is still broken when using `download-rustc = true` and `--stage 1`, but that's *really* a corner case and should affect almost no one. `--stage {0,2}` work fine with download-rustc. --- src/bootstrap/builder.rs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/bootstrap/builder.rs') diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 32ccca8bcdd..f8f2676e10b 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -835,6 +835,18 @@ impl<'a> Builder<'a> { } } + pub fn rustc_lib_paths(&self, compiler: Compiler) -> Vec { + let mut dylib_dirs = vec![self.rustc_libdir(compiler)]; + + // Ensure that the downloaded LLVM libraries can be found. + if self.config.llvm_from_ci { + let ci_llvm_lib = self.out.join(&*compiler.host.triple).join("ci-llvm").join("lib"); + dylib_dirs.push(ci_llvm_lib); + } + + dylib_dirs + } + /// Adds the compiler's directory of dynamic libraries to `cmd`'s dynamic /// library lookup path. pub fn add_rustc_lib_path(&self, compiler: Compiler, cmd: &mut Command) { @@ -845,15 +857,7 @@ impl<'a> Builder<'a> { return; } - let mut dylib_dirs = vec![self.rustc_libdir(compiler)]; - - // Ensure that the downloaded LLVM libraries can be found. - if self.config.llvm_from_ci { - let ci_llvm_lib = self.out.join(&*compiler.host.triple).join("ci-llvm").join("lib"); - dylib_dirs.push(ci_llvm_lib); - } - - add_dylib_path(dylib_dirs, cmd); + add_dylib_path(self.rustc_lib_paths(compiler), cmd); } /// Gets a path to the compiler specified. -- cgit 1.4.1-3-g733a5