-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow running x.py test --stage 2 src/tools/linkchecker
with download-rustc = true
#84471
Conversation
…true` Previously, the LD_LIBRARY_PATH for the linkchecker looked like `build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib`, because the linkchecker depends on the master copy of the standard library. This is true, but doesn't include the library path for the compiler libraries: ``` /home/joshua/src/rust/rust/build/x86_64-unknown-linux-gnu/stage1-tools-bin/error_index_generator: error while loading shared libraries: libLLVM-12-rust-1.53.0-nightly.so: cannot open shared object file: No such file or directory ``` That file is in `build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-12-rust-1.53.0-nightly.so`, which wasn't included in the dynamic path. This adds `build/x86_64-unknown-linux-gnu/stage1/lib` to the dynamic path for the linkchecker.
(rust-highfive has picked a reviewer for you, use r? to override) |
I think the reason it tries to load LLVM in the first place is because it depends on rustdoc. I wonder if it makes sense to separate out just the markdown module into a separate crate? |
Oh boo, error_index_generate depends on rustc_span::Edition :( |
I tested it locally and it doesn't work (same error). |
It works with |
x.py test src/test/linkchecker
with download-llvm = true
x.py test src/tools/linkchecker
with download-llvm = true
@jyn514 I'm not sure, but my guess is this may have worked already with stage 2 prior to this PR as well? At least, local tests seems to suggest that's true. In that case it's not clear that this is meaningfully changing anything - right? |
Before this PR:
After this PR:
So this doesn't fix all the issues, but it's strictly better than before. |
x.py test src/tools/linkchecker
with download-llvm = true
x.py test --stage 2 src/tools/linkchecker
with download-rustc = true
I think --stage 1 is broken because libLLVM only shows up in the stage1 sysroot for some reason:
|
@bors r+ |
📌 Commit 7d4c388 has been approved by |
This is really odd -
|
Well, I guess |
Those all look as expected to me, though without download-rustc; I don't really have an intuition for it. |
@Mark-Simulacrum well the reason it causes issues is that I tried this: diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 4f2426648fd..42085a1bdae 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -391,6 +391,10 @@ pub fn command(builder: &Builder<'_>) -> Command {
// use new syntax, but it should work otherwise.)
let compiler = builder.compiler(builder.top_stage.saturating_sub(1), builder.config.build);
let mut cmd = Command::new(builder.ensure(ErrorIndex { compiler }));
+ // because rustdoc depends on rustc_driver, error_index transitively depends on libLLVM.so.
+ // by default libLLVM is only copied in the assemble stage, so copy it explicitly here.
+ let sysroot = builder.sysroot(compiler);
+ crate::dist::maybe_install_llvm_runtime(builder, compiler.host, dbg!(&sysroot));
add_dylib_path(
vec![
PathBuf::from(&builder.sysroot_libdir(compiler, compiler.host)), but that breaks because |
I don't think download-rustc is particularly relevant for the --stage 1 issue; I would expect it to be the same with or without. |
I really do think making the error-index not depend on LLVM is the simplest solution - happy to work on separating out the markdown part of rustdoc into a (perma-unstable) in-tree crate if you and @GuillaumeGomez are ok with it. |
Hm, but I wouldn't expect a compiler to exist in stage0-sysroot? That directory should only be used for building rustc with beta rustc and in-tree std, freshly built. So we shouldn't be putting things like LLVM in it. stage1/bin/rustdoc should use LLVM in stage1/lib. Stage 0 rustdoc should use stage0/lib LLVM, I believe. Likewise for error index built at each of those stages. |
Ok, that seems reasonable. How do I get bootstrap to give me |
Having the error index use rustdoc as a binary is likely simpler (maybe with some unstable opts), to the point of just moving its source in, likely would fix this too. We shouldn't need to install LLVM into stage0/lib, it should already be there. |
Ok, I can take a look at that.
It is not: #84471 (comment) |
Well, I said I'd take a look at it, but this seems to work ok: diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 4f2426648fd..a7c7ff9730b 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -391,10 +391,18 @@ pub fn command(builder: &Builder<'_>) -> Command {
// use new syntax, but it should work otherwise.)
let compiler = builder.compiler(builder.top_stage.saturating_sub(1), builder.config.build);
let mut cmd = Command::new(builder.ensure(ErrorIndex { compiler }));
+ // because rustdoc depends on rustc_driver, error_index transitively depends on libLLVM.so.
+ // by default libLLVM is only copied in the assemble stage, so copy it explicitly here.
+ // NOTE: this does *not* use `builder.sysroot(compiler)` because that gives `stage0-sysroot/` for the stage0 compiler,
+ // but we want `stage0/` to be consistent with the dynamic load path.
+ let rustc_libdir = builder.rustc_libdir(compiler);
+ let sysroot = rustc_libdir.parent().unwrap();
+ crate::dist::maybe_install_llvm_runtime(builder, compiler.host, dbg!(&sysroot));
+
add_dylib_path(
vec![
- PathBuf::from(&builder.sysroot_libdir(compiler, compiler.host)),
- PathBuf::from(builder.rustc_libdir(compiler)),
+ builder.sysroot_libdir(compiler, compiler.host).to_path_buf(),
+ rustc_libdir,
],
&mut cmd,
); |
-beta is though: |
Oh, well, I don't think that's actually true - you could have an LLVM bump between beta and nightly. Naming the .so after the commit seems like a good cleanup, but I don't think it would actually help anything (other than get rid of a few duplicate |
…acrum Allow running `x.py test --stage 2 src/tools/linkchecker` with `download-rustc = true` Previously, the LD_LIBRARY_PATH for the linkchecker looked like `build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib`, because the linkchecker depends on the master copy of the standard library. This is true, but doesn't include the library path for the compiler libraries: ``` /home/joshua/src/rust/rust/build/x86_64-unknown-linux-gnu/stage1-tools-bin/error_index_generator: error while loading shared libraries: libLLVM-12-rust-1.53.0-nightly.so: cannot open shared object file: No such file or directory ``` That file is in `build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-12-rust-1.53.0-nightly.so`, which wasn't included in the dynamic path. This adds `build/x86_64-unknown-linux-gnu/stage1/lib` to the dynamic path for the linkchecker.
☀️ Test successful - checks-actions |
Previously, the LD_LIBRARY_PATH for the linkchecker looked like
build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib
, because the linkchecker depends on the master copy of the standard library. This is true, but doesn't include the library path for the compiler libraries:That file is in
build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-12-rust-1.53.0-nightly.so
,which wasn't included in the dynamic path. This adds
build/x86_64-unknown-linux-gnu/stage1/lib
to the dynamic path for the linkchecker.