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

Improve "Building compiler artifacts" output #108051

Closed
jyn514 opened this issue Feb 14, 2023 · 8 comments · Fixed by #108171
Closed

Improve "Building compiler artifacts" output #108051

jyn514 opened this issue Feb 14, 2023 · 8 comments · Fixed by #108171
Assignees
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@jyn514
Copy link
Member

jyn514 commented Feb 14, 2023

Right, now x build --dry-run outputs something like this:

Building stage0 library artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
Copying stage0 library from stage0 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Building stage0 compiler artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
Copying stage0 rustc from stage0 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Assembling stage1 compiler (x86_64-apple-darwin)
Building stage1 library artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
Copying stage1 library from stage1 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Building stage1 tool rust-analyzer-proc-macro-srv (x86_64-apple-darwin)
Building rustdoc for stage1 (x86_64-apple-darwin)

There are a few things here that are not ideal.

  • x86_64-apple-darwin -> x86_64-apple-darwin doesn't give a lot of info and is very noisy. We should only print it when the host and target are different.
  • "Building stage0 compiler artifacts" is very unclear that stage0 is the one doing the compiling.

I'd like to change this to something like Building compiler artifacts (stage0 -> stage1) when the target/host are the same and Building compiler artifacts (stage0: x86_64-apple-darwin -> stage1: x86_64-unknown-linux-gnu) when they're different.

@jyn514 jyn514 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself labels Feb 14, 2023
@mattjperez
Copy link
Contributor

@rustbot claim

@mattjperez
Copy link
Contributor

mattjperez commented Feb 14, 2023

@jyn514 How's?

# ./x.py build --dry-run
Building library artifacts (stage0 -> stage1)
Copying stage0-library artifacts to stage0 sysroot
Building compiler artifacts (stage0 -> stage1)
Copying stage0-rustc artifacts to stage0 sysroot
Assembling stage1 compiler (x86_64-unknown-linux-gnu)
Building library artifacts (stage1 -> stage2)
Copying stage1-library artifacts to stage1 sysroot
Building stage1 tool rust-analyzer-proc-macro-srv (x86_64-unknown-linux-gnu)
Building rustdoc for stage1 (x86_64-unknown-linux-gnu)
# ./x.py build --target x86_64-apple-darwin --dry-run
Building library artifacts (stage0 -> stage1)
Copying stage0-library artifacts to stage0 sysroot
Building compiler artifacts (stage0 -> stage1)
Copying stage0-rustc artifacts to stage0 sysroot
Assembling stage1 compiler (x86_64-unknown-linux-gnu)
Building library artifacts (stage1: x86_64-unknown-linux-gnu -> stage2: x86_64-apple-darwin)
Copying stage1-library artifacts to stage1 sysroot
Building library artifacts (stage1 -> stage2)
Copying stage1-library artifacts to stage1 sysroot
Building stage1 tool rust-analyzer-proc-macro-srv (x86_64-unknown-linux-gnu)
Building rustdoc for stage1 (x86_64-unknown-linux-gnu)

There isn't an associated target_compiler.stage when building library and compiler artifacts, so I'm just +1'ing for filler atm.

@jyn514
Copy link
Member Author

jyn514 commented Feb 14, 2023

This is a good start, thanks! I have a few comments:

  • for the standard library, the build compiler and the target library will always be numbered the same (even if they might not be in the same sysroot), so you don't need an arrow, just "Building stage0 library artifacts".
  • The Copying step should either be named after the folder in build/host/ or the description in the "Building" step; right now it's not consistent with either. I personally would be ok with just removing it altogether: right now, the only time when it's different from Building is for tools, and people regularly ask on Zulip why tools don't show up in the sysroot so clearly "Copying only doesn't show up when building tools" is too subtle for it to be helpful.
  • I think we can remove the (x86_64-unknown-linux-gnu) output for Assemble and tools when it's the same as the host, like you've already done for the compiler and standard library.
  • "Building stage1 tool proc-macro-server" and "Building rustdoc for stage1" would ideally use the same wording.
  • All the tools are numbered differently than the host compiler so they should also show a stage arrow. For example rustdoc should show "Building rustdoc artifacts (stage0 -> stage1)"

@mattjperez
Copy link
Contributor

Added your suggestions

# ./x.py build --dry-run
Building stage0 library artifacts
Building stage0 compiler artifacts
Assembling stage1 compiler
Building stage1 library artifacts
Building tool rust-analyzer-proc-macro-srv (stage0 -> stage1)
Building rustdoc (stage0 -> stage1)
# ./x.py build --target x86_64-apple-darwin --dry-run
Building stage0 library artifacts
Building stage0 compiler artifacts
Assembling stage1 compiler
Building stage1 library artifacts (x86_64-unknown-linux-gnu -> x86_64-apple-darwin)
Building stage1 library artifacts
Building tool rust-analyzer-proc-macro-srv (stage0 -> stage1)
Building rustdoc (stage0 -> stage1)

@jyn514
Copy link
Member Author

jyn514 commented Feb 15, 2023

That looks great! The last thing I would do is

  • Add (stage0 -> stage1) for compiler artifacts, just like you have for rustdoc :)
  • Show "host" (or maybe just x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu?) for the standard library when the target and host are the same, but we're building for multiple targets (where you have Building stage1 library artifacts in the second output)

@mattjperez
Copy link
Contributor

mattjperez commented Feb 15, 2023

At least for the actual function in src/bootstrap/compiler.rs that generates the output, it doesn't appear to have context if there are multiple targets or only one. So it seems like for now printing the host is the most straightforward approach.

# ./x.py build --dry-run
Building stage0 library artifacts (x86_64-unknown-linux-gnu)
Building compiler artifacts (stage0 -> stage1)
Assembling stage1 compiler
Building stage1 library artifacts (x86_64-unknown-linux-gnu)
Building tool rust-analyzer-proc-macro-srv (stage0 -> stage1)
Building rustdoc (stage0 -> stage1)
# ./x.py build --target x86_64-apple-darwin --dry-run
Building stage0 library artifacts (x86_64-unknown-linux-gnu)
Building compiler artifacts (stage0 -> stage1)
Assembling stage1 compiler
Building stage1 library artifacts (x86_64-unknown-linux-gnu -> x86_64-apple-darwin)
Building stage1 library artifacts (x86_64-unknown-linux-gnu)
Building tool rust-analyzer-proc-macro-srv (stage0 -> stage1)
Building rustdoc (stage0 -> stage1)

@jyn514
Copy link
Member Author

jyn514 commented Feb 15, 2023

That looks amazing, thank you!

@mattjperez
Copy link
Contributor

Latest output

➜ ./x.py build --target x86_64-apple-darwin --stage 2 compiler/rustc --dry-run
Building bootstrap
    Finished dev [unoptimized] target(s) in 0.03s
Building stage0 library artifacts (x86_64-unknown-linux-gnu)
Building compiler artifacts (stage0 -> stage1)
Assembling stage1 compiler
Building stage1 library artifacts (x86_64-unknown-linux-gnu)
Building compiler artifacts (stage1 -> stage2)
Assembling stage2 compiler
Uplifting library (stage1 -> stage2)
Uplifting rustc (stage1 -> stage3)

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 20, 2023
…ut, r=jyn514

Improve building compiler artifacts output

Fixes rust-lang#108051

`@Manishearth,` `@jyn514` mentioned you might be interested in these changes to the outputs.
@bors bors closed this as completed in 1f5c2b1 Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants