Skip to content
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

x check --stage 1 std doesn't work #98720

Closed
WaffleLapkin opened this issue Jun 30, 2022 · 9 comments
Closed

x check --stage 1 std doesn't work #98720

WaffleLapkin opened this issue Jun 30, 2022 · 9 comments
Assignees
Labels
C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@WaffleLapkin
Copy link
Member

WaffleLapkin commented Jun 30, 2022

For me currently x b --stage 1 library/std works fine, while x c --stage 1 library/std with a lot of errors related to core not being found.

error: could not compile ppv-lite86 due to 750 previous errors
error: could not compile test due to 60 previous errors
error: could not compile proc_macro due to 2 previous errors

This is the commit that I'm trying to check: c68cd2f

I had the same problem previously too, but it usually solves magically after rebase / x clean / etc. However the usual "reboot router" kind of solutions doesn't seem to help this time :')

Full output: log.txt

@jyn514 jyn514 changed the title checking std doesn't work x check --stage 1 std doesn't work Jun 30, 2022
@ehuss
Copy link
Contributor

ehuss commented Jun 30, 2022

It's not really clear to me how #81064 was supposed to work, but commenting out this line makes it work for me.

@jyn514
Copy link
Member

jyn514 commented Jul 14, 2022

Found the issue. I broke this when I added --all-targets in #88094. Not exactly sure why it's breaking, but it seems fine to me to only run --all-targets in stage 0.

Mentoring instructions: change

cargo.arg("--all-targets");
to only run in stage 0.

@jyn514 jyn514 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-bug Category: This is a bug. labels Jul 14, 2022
@jyn514
Copy link
Member

jyn514 commented Jul 14, 2022

It's not really clear to me how #81064 was supposed to work, but commenting out this line makes it work for me.

The way it works is by building all of libstd before checking the compiler:

rust/src/bootstrap/check.rs

Lines 195 to 202 in 601c5a2

if compiler.stage != 0 {
// If we're not in stage 0, then we won't have a std from the beta
// compiler around. That means we need to make sure there's one in
// the sysroot for the compiler to find. Otherwise, we're going to
// fail when building crates that need to generate code (e.g., build
// scripts and their dependencies).
builder.ensure(crate::compile::Std::new(compiler, compiler.host));
builder.ensure(crate::compile::Std::new(compiler, target));

That works fine and makes it ok not to call add_to_sysroot in check, but the same step is missing before checking tests and examples. That would be an alternate fix; call builder.ensure(compile::Std) before --all-targets, not just before building the compiler.

@jyn514
Copy link
Member

jyn514 commented Jul 14, 2022

Hmm, I wonder if we should start using --extern noprelude:core in bootstrap to avoid all these sysroot shenanigans. It would make the code a lot simpler I think, and avoid having to compile things twice.

@jo3bingham
Copy link
Contributor

@rustbot claim

@jo3bingham
Copy link
Contributor

@jyn514 is the fix here to still only run --all-targets in stage0, or is your latest comment a better solution? If the latter, is that an easy solution? This is my first contribution to rust so I'm not well versed on how bootstrap, or anything else for that matter, works.

@jyn514
Copy link
Member

jyn514 commented Jul 15, 2022

@jo3bingham my second comment is a harder but more correct solution. I would accept either as PRs, neither are terribly hard.

(My third comment about sysroots I think is the ideal solution, but involves several large refactors to bootstrap and isn't a good first PR.)

@jyn514
Copy link
Member

jyn514 commented Jul 15, 2022

Take a look at the bootstrapping section of the dev guide, especially the bit about contributing: https://rustc-dev-guide.rust-lang.org/building/bootstrapping.html#contributing-to-bootstrap

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 2, 2022
only run --all-targets in stage0 for Std

Repro'd the issue with `python3 x.py check --stage 1 library/std` and tested the fix with the same command.

r? `@jyn514`

I tried to implement [this solution](rust-lang#98720 (comment)), but didn't have any luck. I don't think I fully understood what needed to be done. However, I would love to be mentored on it since it would be a more correct solution, and I can learn more about how bootstrap works.
@jo3bingham
Copy link
Contributor

Fixed by #99293. I forgot to link the issue in the PR, but this can be closed now that it has merged.

@jyn514 jyn514 closed this as completed Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

4 participants