-
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
Link rustc tools into the correct sysroot #123384
Conversation
path: $path, | ||
extra_features: $sel.extra_features, | ||
source_type: SourceType::InTree, | ||
allow_features: concat!($($allow_features)*), | ||
}); | ||
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This conflicts with the idea of ToolStd
and ToolRustc
Lines 257 to 266 in 029cb1b
/// Build a tool which uses the locally built std, placing output in the | |
/// "stageN-tools" directory. Its usage is quite rare, mainly used by | |
/// compiletest which needs libtest. | |
ToolStd, | |
/// Build a tool which uses the locally built rustc and the target std, | |
/// placing the output in the "stageN-tools" directory. This is used for | |
/// anything that needs a fully functional rustc, such as rustdoc, clippy, | |
/// cargo, rls, rustfmt, miri, etc. | |
ToolRustc, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 therustc
andrustdoc
binaries) 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