-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Rerun bootstrap's build script when RUSTC changes #93723
Conversation
Previously, rustbuild would give strange errors if you tried to reuse the same build directory under two names: ``` $ mkdir tmp && cd tmp $ ../x.py check Building rustbuild Finished dev [unoptimized] target(s) in 35.27s Checking stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) ^C $ cd .. $ mv tmp/build build $ ./x.py check Building rustbuild Compiling bootstrap v0.0.0 (/home/jnelson/rust-lang/rust/src/bootstrap) Finished dev [unoptimized] target(s) in 11.18s failed to execute command: "/home/jnelson/rust-lang/rust/tmp/build/x86_64-unknown-linux-gnu/stage0/bin/rustc" "--target" "x86_64-unknown-linux-gnu" "--print" "target-libdir" error: No such file or directory (os error 2) ``` This fixes the error. Reusing the same build directory is useful if you want to test path-things in bootstrap itself, without having to recompile it each time. For good measure, this also reruns the build script when PATH changes.
(rust-highfive has picked a reviewer for you, use r? to override) |
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.
Did you confirm that this fixes things? I would've guessed that the problem here is rather that Cargo doesn't view the build directory movement as cause for re-running build.rs (probably in some sense this is intentional/good), and neither of the env-changed keys would actually work to prevent that... but maybe I am wrong?
@@ -3,6 +3,8 @@ use std::path::PathBuf; | |||
|
|||
fn main() { | |||
println!("cargo:rerun-if-changed=build.rs"); | |||
println!("cargo:rerun-if-env-changed=RUSTC"); | |||
println!("cargo:rerun-if-env-changed=PATH"); |
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.
PATH seems correct, but I am surprised that RUSTC is needed: cargo docs claim that those variables set by Cargo are already taken care of by Cargo: "...it is not necessary to use this for environment variables like TARGET that Cargo sets."
Maybe RUSTC is missing there? It would be great if you could file an issue upstream, since presumably that's the cause?
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.
It would be great if you could file an issue upstream, since presumably that's the cause?
ok, but I suspect it will be a while before it's fixed
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.
yeah, happy to r+ this before then, just wanted something tracking things. I don't think the fix is that important.
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.
Did you confirm that this fixes things?
Yes, I confirmed that this fixes things.
@@ -3,6 +3,8 @@ use std::path::PathBuf; | |||
|
|||
fn main() { | |||
println!("cargo:rerun-if-changed=build.rs"); | |||
println!("cargo:rerun-if-env-changed=RUSTC"); | |||
println!("cargo:rerun-if-env-changed=PATH"); |
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.
It would be great if you could file an issue upstream, since presumably that's the cause?
ok, but I suspect it will be a while before it's fixed
@bors r+ rollup |
📌 Commit b5b2150 has been approved by |
…ulacrum Rerun bootstrap's build script when RUSTC changes Previously, rustbuild would give strange errors if you tried to reuse the same build directory under two names: ``` $ mkdir tmp && cd tmp $ ../x.py check Building rustbuild Finished dev [unoptimized] target(s) in 35.27s Checking stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) ^C $ cd .. $ mv tmp/build build $ ./x.py check Building rustbuild Compiling bootstrap v0.0.0 (/home/jnelson/rust-lang/rust/src/bootstrap) Finished dev [unoptimized] target(s) in 11.18s failed to execute command: "/home/jnelson/rust-lang/rust/tmp/build/x86_64-unknown-linux-gnu/stage0/bin/rustc" "--target" "x86_64-unknown-linux-gnu" "--print" "target-libdir" error: No such file or directory (os error 2) ``` This fixes the error. Reusing the same build directory is useful if you want to test path-related things in bootstrap itself, without having to recompile it each time. For good measure, this also reruns the build script when PATH changes.
…ulacrum Rerun bootstrap's build script when RUSTC changes Previously, rustbuild would give strange errors if you tried to reuse the same build directory under two names: ``` $ mkdir tmp && cd tmp $ ../x.py check Building rustbuild Finished dev [unoptimized] target(s) in 35.27s Checking stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) ^C $ cd .. $ mv tmp/build build $ ./x.py check Building rustbuild Compiling bootstrap v0.0.0 (/home/jnelson/rust-lang/rust/src/bootstrap) Finished dev [unoptimized] target(s) in 11.18s failed to execute command: "/home/jnelson/rust-lang/rust/tmp/build/x86_64-unknown-linux-gnu/stage0/bin/rustc" "--target" "x86_64-unknown-linux-gnu" "--print" "target-libdir" error: No such file or directory (os error 2) ``` This fixes the error. Reusing the same build directory is useful if you want to test path-related things in bootstrap itself, without having to recompile it each time. For good measure, this also reruns the build script when PATH changes.
Rollup of 13 pull requests Successful merges: - rust-lang#88313 (Make the pre-commit script pre-push instead) - rust-lang#91530 (Suggest 1-tuple parentheses on exprs without existing parens) - rust-lang#92724 (Cleanup c_str.rs) - rust-lang#93208 (Impl {Add,Sub,Mul,Div,Rem,BitXor,BitOr,BitAnd}Assign<$t> for Wrapping<$t> for rust 1.60.0) - rust-lang#93394 (Don't allow {} to refer to implicit captures in format_args.) - rust-lang#93416 (remove `allow_fail` test flag) - rust-lang#93487 (Fix linking stage1 toolchain in `./x.py setup`) - rust-lang#93673 (Linkify sidebar headings for sibling items) - rust-lang#93680 (Drop json::from_reader) - rust-lang#93682 (Update tracking issue for `const_fn_trait_bound`) - rust-lang#93722 (Use shallow clones for submodules managed by rustbuild, not just bootstrap.py) - rust-lang#93723 (Rerun bootstrap's build script when RUSTC changes) - rust-lang#93737 (bootstrap: prefer using '--config' over 'RUST_BOOTSTRAP_CONFIG') Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Previously, rustbuild would give strange errors if you tried to reuse the same build directory under two names:
This fixes the error. Reusing the same build directory is useful if you want to test path-related things in
bootstrap itself, without having to recompile it each time.
For good measure, this also reruns the build script when PATH changes.