Skip to content

Allow x perf to find rustc.exe on Windows #141283

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

Merged
merged 1 commit into from
May 21, 2025

Conversation

Sol-Ell
Copy link
Contributor

@Sol-Ell Sol-Ell commented May 20, 2025

Related issue: #141281

@rustbot
Copy link
Collaborator

rustbot commented May 20, 2025

r? @clubby789

rustbot has assigned @clubby789.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels May 20, 2025
Comment on lines +164 to +167
let mut rustc = sysroot.clone();
rustc.push("bin");
rustc.push("rustc");
rustc.set_extension(EXE_EXTENSION);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the changes away from .join are not necessary. Simply use let mut instead of adding two lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Contributor

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'm afraid that you are going to find all sorts of funny bugs if you try to use rustc-perf and x perf on Windows 😆

Could you please squash the commits? Such a tiny change doesn't need to be in three commits. Thanks!

@workingjubilee workingjubilee changed the title Fix benchmarking on windows (#141281 - Cannot Find rustc Executable) Allow x perf to find rustc.exe on Windows May 20, 2025
@rustbot

This comment has been minimized.

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 20, 2025
@clubby789
Copy link
Contributor

I don't have a Windows system available to test this - would you mind showing what the new output of running ./x perf benchmark is?

@Sol-Ell
Copy link
Contributor Author

Sol-Ell commented May 20, 2025

It appears that generated Cargo.lock file mutates on Windows.

> ./x perf benchmark some-benchmark
Building bootstrap
    Blocking waiting for file lock on package cache
    Finished `dev` profile [unoptimized] target(s) in 11.74s
Building stage0 tool collector (x86_64-pc-windows-msvc)
    Finished `release` profile [optimized + debuginfo] target(s) in 21.19s
Building stage0 library artifacts (x86_64-pc-windows-msvc)
    Finished `release` profile [optimized + debuginfo] target(s) in 1.32s
Building compiler artifacts (stage0 -> stage1, x86_64-pc-windows-msvc)
    Finished `release` profile [optimized + debuginfo] target(s) in 15.24s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 library artifacts (x86_64-pc-windows-msvc)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.91s
Using database `C:\Users\ahunp\Desktop\projects\rust\build\tmp\rustc-perf\results\results.db`
Benchmarking some-benchmark (2025-05-20T15:26:12.014304300+00:00) for triple x86_64-unknown-linux-gnu
45 normal benchmarks remaining
Preparing await-call-tree

thread '<unnamed>' panicked at src\tools\rustc-perf\collector\src\utils\fs.rs:178:9:
assertion `left == right` failed: C:\Users\ahunp\AppData\Local\Temp\.tmpECDEg2\Cargo.lock (await-call-tree) has changed during a build
  left: 14528352884948837976
 right: 7553766770747164988
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thread '<unnamed>' panicked at src\tools\rustc-perf\collector\src\utils\fs.rs:178:9:
assertion `left == right` failed: C:\Users\ahunp\AppData\Local\Temp\.tmpkMI3TC\Cargo.lock (await-call-tree) has changed during a build
  left: 14528352884948837976
 right: 7553766770747164988

thread '<unnamed>' panicked at src\tools\rustc-perf\collector\src\utils\fs.rs:178:9:
assertion `left == right` failed: C:\Users\ahunp\AppData\Local\Temp\.tmp2sVN34\Cargo.lock (await-call-tree) has changed during a build
  left: 14528352884948837976
 right: 7553766770747164988

thread 'main' panicked at C:\Users\ahunp\Desktop\projects\rust\src\tools\rustc-perf\collector\src\compile\benchmark\mod.rs:310:9:
a scoped thread panicked
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:01:01

@workingjubilee
Copy link
Member

You needed to rebase instead of merge.

@Kobzol
Copy link
Contributor

Kobzol commented May 21, 2025

It appears that generated Cargo.lock file mutates on Windows.

> ./x perf benchmark some-benchmark
Building bootstrap
    Blocking waiting for file lock on package cache
    Finished `dev` profile [unoptimized] target(s) in 11.74s
Building stage0 tool collector (x86_64-pc-windows-msvc)
    Finished `release` profile [optimized + debuginfo] target(s) in 21.19s
Building stage0 library artifacts (x86_64-pc-windows-msvc)
    Finished `release` profile [optimized + debuginfo] target(s) in 1.32s
Building compiler artifacts (stage0 -> stage1, x86_64-pc-windows-msvc)
    Finished `release` profile [optimized + debuginfo] target(s) in 15.24s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 library artifacts (x86_64-pc-windows-msvc)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.91s
Using database `C:\Users\ahunp\Desktop\projects\rust\build\tmp\rustc-perf\results\results.db`
Benchmarking some-benchmark (2025-05-20T15:26:12.014304300+00:00) for triple x86_64-unknown-linux-gnu
45 normal benchmarks remaining
Preparing await-call-tree

thread '<unnamed>' panicked at src\tools\rustc-perf\collector\src\utils\fs.rs:178:9:
assertion `left == right` failed: C:\Users\ahunp\AppData\Local\Temp\.tmpECDEg2\Cargo.lock (await-call-tree) has changed during a build
  left: 14528352884948837976
 right: 7553766770747164988
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thread '<unnamed>' panicked at src\tools\rustc-perf\collector\src\utils\fs.rs:178:9:
assertion `left == right` failed: C:\Users\ahunp\AppData\Local\Temp\.tmpkMI3TC\Cargo.lock (await-call-tree) has changed during a build
  left: 14528352884948837976
 right: 7553766770747164988

thread '<unnamed>' panicked at src\tools\rustc-perf\collector\src\utils\fs.rs:178:9:
assertion `left == right` failed: C:\Users\ahunp\AppData\Local\Temp\.tmp2sVN34\Cargo.lock (await-call-tree) has changed during a build
  left: 14528352884948837976
 right: 7553766770747164988

thread 'main' panicked at C:\Users\ahunp\Desktop\projects\rust\src\tools\rustc-perf\collector\src\compile\benchmark\mod.rs:310:9:
a scoped thread panicked
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:01:01

This is interesting, I wonder if it's expected Cargo behavior. If you go to collector/compile-benchmarks/await-call-tree and do cargo build, does it invalidate the Cargo.lock file?

@Sol-Ell Sol-Ell force-pushed the fix-benchmarking-on-windows branch from 71b9e49 to 6ac8e51 Compare May 21, 2025 07:29
@rustbot rustbot removed has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 21, 2025
@Kobzol
Copy link
Contributor

Kobzol commented May 21, 2025

The code now contains the version with push, but I don't think it's really that important. Thank you!

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 21, 2025

📌 Commit 6ac8e51 has been approved by Kobzol

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 21, 2025
@Sol-Ell
Copy link
Contributor Author

Sol-Ell commented May 21, 2025

Yes, Cargo.lock of collector/compile-benchmarks/await-call-tree was modified.

# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
+version = 4
+
[[package]]
name = "await-call-tree"
version = "0.1.0"

-

@Kobzol
Copy link
Contributor

Kobzol commented May 21, 2025

Yes, Cargo.lock of collector/compile-benchmarks/await-call-tree was modified.

# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
+version = 4
+
[[package]]
name = "await-call-tree"
version = "0.1.0"

-

Oh, ok, that's just a version bump. I guess that we could regenerate the lockfiles to have a new Cargo lock version.

bors added a commit to rust-lang-ci/rust that referenced this pull request May 21, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#137759 (Add `std::os::unix::process::CommandExt::chroot` to safely chroot a child process)
 - rust-lang#140994 (replace `cc_detect::cc2ar` with `cc::try_get_archiver`)
 - rust-lang#141213 (Suggest use "{}", self.x instead of {self.x} when resolve x as field of `self`)
 - rust-lang#141283 (Allow `x perf` to find rustc.exe on Windows)
 - rust-lang#141284 (Allow trailing comma after argument in query definition)
 - rust-lang#141317 (typeck: catch `continue`s pointing to blocks)
 - rust-lang#141318 (Avoid creating an empty identifer in `Symbol::to_ident_string`.)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 04a7c2c into rust-lang:master May 21, 2025
6 checks passed
@rustbot rustbot added this to the 1.89.0 milestone May 21, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 21, 2025
Rollup merge of rust-lang#141283 - Sol-Ell:fix-benchmarking-on-windows, r=Kobzol

Allow `x perf` to find rustc.exe on Windows

Related issue: rust-lang#141281
@Sol-Ell Sol-Ell deleted the fix-benchmarking-on-windows branch May 21, 2025 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants