Link rustc tools into the correct sysroot#123384
Link rustc tools into the correct sysroot#123384Noratrieb wants to merge 1 commit intorust-lang:masterfrom
Conversation
|
|
||
| if (false $(|| !$add_bins_to_sysroot.is_empty())?) && $sel.compiler.stage > 0 { | ||
| let bindir = $builder.sysroot($sel.compiler).join("bin"); | ||
| if (false $(|| !$add_bins_to_sysroot.is_empty())?) { |
There was a problem hiding this comment.
Now that we put it into the correct stage, there's nothing wrong with x build clippy --stage 0 anymore, and we can put that into the sysroot too.
There was a problem hiding this comment.
This conflicts with the idea of ToolStd and ToolRustc
Lines 257 to 266 in 029cb1b
There was a problem hiding this comment.
I don't quite understand what you mean with this. The two ToolStd built here don't have any bins added to the sysroot anyways, so this doesn't affect them. As for the ToolRustc, this change was targetted specifically at them.
| Clippy, "src/tools/clippy", "clippy-driver", stable=true, add_bins_to_sysroot = ["clippy-driver", "cargo-clippy"]; | ||
| Miri, "src/tools/miri", "miri", stable=false, add_bins_to_sysroot = ["miri"]; | ||
| CargoMiri, "src/tools/miri/cargo-miri", "cargo-miri", stable=true, add_bins_to_sysroot = ["cargo-miri"]; | ||
| Cargofmt, "src/tools/rustfmt", "cargo-fmt", mode=Mode::ToolRustc, stable=true; |
There was a problem hiding this comment.
I've also made this a bit more obvious as to which tools are what, looking for the tool_std=true was a bit annoying.
There was a problem hiding this comment.
I agree that tool_std seems a bit awkward, but this macro shouldn't accept any modes other than ToolRustc and ToolStd.
There was a problem hiding this comment.
I'm gonna revert this change to keep the PR minimal as it's complicated enough as-is, but will keep that in mind if I do this change in the future.
da31765 to
53db4e2
Compare
|
I tested clippy manually, it works like a charm: |
This comment has been minimized.
This comment has been minimized.
|
So what will Because for rustdoc that is kind of broken, it doesn't actually do anything. |
It will build a Miri linked against stage1 rustc and put it into stage1. Rustdoc is off by one here, the equivalent rustdoc invocation is using --stage 1. |
|
Okay, nice. :) rust/src/bootstrap/src/core/builder.rs Line 1260 in 8938f88 can now use |
|
linking this because it's relevant thanks jyn for finding it https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/Stage.20numbering.20for.20tools |
53db4e2 to
2b66f46
Compare
This comment has been minimized.
This comment has been minimized.
87bbdc4 to
ec20e7a
Compare
When copying tool binaries, we were linking them into the sysroot of the compiler that built the binaries. This makes no sense, the binaries are for the next sysroot. So when the stage0 compiler builds clippy, this clippy belongs into stage1, and when the stage1 compiler builds clippy, this clippy belongs into stage2. This puts it right next to the librustc_driver it actually links against. Additionally, we `ensure(Assemble)` of this librustc_driver such that the tool will be working as expected. To run the tool manually, we still need to set LD_LIBRARY_PATH, but now with this, setting the rpath to `$ORIGIN/../lib` (like the `rustc` and `rustdoc` binaries) should be possible as future work now. Rustdoc, with its special treatment, was already getting the correct behavior.
ec20e7a to
48d1b9b
Compare
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
@Noratrieb |
|
i haven't abandoned it but I need to find the time to work on it |
|
#137215 did this! |
When copying tool binaries, we were linking them into the sysroot of the compiler that built the binaries. This makes no sense, the binaries are for the next sysroot. So when the stage0 compiler builds clippy, this clippy belongs into stage1, and when the stage1 compiler builds clippy, this clippy belongs into stage2.
This puts it right next to the librustc_driver it actually links against.
Additionally, we
ensure(Assemble)of this librustc_driver such that the tool will be working as expected.To run the tool manually, we still need to set LD_LIBRARY_PATH, but now with this, setting the rpath to
$ORIGIN/../lib(like therustcandrustdocbinaries) should be possible as future work now.Rustdoc, with its special treatment, was already getting the correct behavior.
See https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/Stage.20for.20copying.20tools.20into.20the.20sysroot for a bit more context.
fixes this comment but not the issue #119946 (comment)
r? onur-ozkan cc @RalfJung