-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Update all submodules that rustbuild doesn't depend on lazily #82653
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
d2e9de4
to
8da32b5
Compare
8da32b5
to
d1e899c
Compare
This comment has been minimized.
This comment has been minimized.
d1e899c
to
10966b7
Compare
This is mostly working, but it now tries to update stdarch 3 times in a row, which is slow especially on windows.
|
This comment has been minimized.
This comment has been minimized.
10966b7
to
0ad8075
Compare
|
☔ The latest upstream changes (presumably #85711) made this pull request unmergeable. Please resolve the merge conflicts. |
@jyn514 For submodules that are already initialized this results in a dirty git tree with out-of-date submodules - this is what I got after the recent LLVM changes. |
Hmm, I can't replicate this behavior:
Do you remember the command you ran? |
Move LLVM submodule updates back to native.rs Time to find more bugs! The first commit is a straight revert of rust-lang#85647, the second is a fix for https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/x.2Epy.20always.20updates.20LLVM.20submodule/near/240113320 and rust-lang#82653 (comment). I haven't been able to replicate rust-lang#82653 (comment).
No longer blocked since #86015 :) |
0ad8075
to
367bc72
Compare
💔 Test failed - checks-actions |
This comment has been minimized.
This comment has been minimized.
This only updates the submodules the first time they're needed, instead of unconditionally the first time you run x.py. Ideally, this would move *all* submodules and not exclude some tools and backtrace. Unfortunately, cargo requires all `Cargo.toml` files in the whole workspace to be present to build any crate. On my machine, this takes the time for an initial submodule clone (for `x.py --help`) from 55.70 to 15.87 seconds. This uses exactly the same logic as the LLVM update used, modulo some minor cleanups: - Use a local variable for `src.join(relative_path)` - Remove unnecessary arrays for `book!` macro and make the macro simpler to use - Add more comments
0471803
to
2ac0e9b
Compare
@bors r=Mark-Simulacrum rollup=iffy |
📌 Commit 2ac0e9b has been approved by |
☀️ Test successful - checks-actions |
While building -nightly from tarball, the build fails with:
it seems the build tries to run |
I have to look into how tarballs work - is there a reason they don't set |
We don't put any new default config in the tarballs (and I don't think we should); I imagine the right check here is something like is_git() and if so defaulting submodules to false. |
I confirm that setting |
…r=Mark-Simulacrum Don't default to `submodules = true` unless the rust repo has a .git directory Should hopefully fix rust-lang#82653 (comment) - `@semarie` can you confirm? r? `@Mark-Simulacrum`
@jyn514 How to reproduce:
If the submodule was already initialized, then updating it is very quick and can be done unconditionally, even if the given submodule is not strictly necessary for the given |
Contrary to what you seem to believe, I'm not trying to break your workflow. Not updating the submodules is just a bug, it's not intentional. I think #87443 should fix it. |
Don't treat git repos as non-existent when `ignore_git` is set The new submodule handling depends on `is_git()` to be accurate to decide whether it should handle submodules at all or not. Unfortunately, `is_git()` treated "this directory does not have a git repository" and "this repository should not be used for SHA/version/commit date info" the same. This changes it to distinguish the two. To clarify: ignore_get is set by default whenever channel == "dev", which it is by default whenever you're compiling locally. So basically everyone would hit this, not just people who had explicitly configured ignore_git. Here's an example of an error this fixes: ``` $ x build Updating only changed submodules Submodules updated in 0.01 seconds Finished dev [unoptimized + debuginfo] target(s) in 0.17s warning: x.py has made several changes recently you may want to look at help: consider looking at the changes in `src/bootstrap/CHANGELOG.md` note: to silence this warning, add `changelog-seen = 2` at the top of `config.toml` Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 0.16s Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu) Building LLVM for x86_64-unknown-linux-gnu detected home dir change, cleaning out entire build directory running: "cmake" "/home/joshua/rustc3/src/llvm-project/llvm" "-G" "Ninja" "-DLLVM_ENABLE_ASSERTIONS=OFF" "-DLLVM_TARGETS_TO_BUILD=AArch64;ARM;BPF;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=AVR" "-DLLVM_INCLUDE_EXAMPLES=OFF" "-DLLVM_INCLUDE_DOCS=OFF" "-DLLVM_INCLUDE_BENCHMARKS=OFF" "-DLLVM_ENABLE_TERMINFO=OFF" "-DLLVM_ENABLE_LIBEDIT=OFF" "-DLLVM_ENABLE_BINDINGS=OFF" "-DLLVM_ENABLE_Z3_SOLVER=OFF" "-DLLVM_PARALLEL_COMPILE_JOBS=48" "-DLLVM_TARGET_ARCH=x86_64" "-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-linux-gnu" "-DLLVM_ENABLE_ZLIB=ON" "-DLLVM_ENABLE_LIBXML2=OFF" "-DLLVM_VERSION_SUFFIX=-rust-dev" "-DCMAKE_INSTALL_MESSAGE=LAZY" "-DCMAKE_C_COMPILER=gcc" "-DCMAKE_CXX_COMPILER=g++" "-DCMAKE_ASM_COMPILER=gcc" "-DCMAKE_C_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_INSTALL_PREFIX=/home/joshua/rustc3/build/x86_64-unknown-linux-gnu/llvm" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_BUILD_TYPE=Release" CMake Error: The source directory "/home/joshua/rustc3/src/llvm-project/llvm" does not exist. Specify --help for usage, or press the help button on the CMake GUI. thread 'main' panicked at ' command did not execute successfully, got: exit status: 1 build script failed, must exit now', /home/joshua/.local/lib/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/cmake-0.1.44/src/lib.rs:885:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace finished in 0.783 seconds Build completed unsuccessfully in 0:00:01 ``` I *believe* this regression was only introduced in rust-lang#87380, not rust-lang#82653. `@petrochenkov` can you check that this fixes the issue you encountered in rust-lang#82653 (comment) ? r? `@Mark-Simulacrum`
Don't treat git repos as non-existent when `ignore_git` is set The new submodule handling depends on `is_git()` to be accurate to decide whether it should handle submodules at all or not. Unfortunately, `is_git()` treated "this directory does not have a git repository" and "this repository should not be used for SHA/version/commit date info" the same. This changes it to distinguish the two. To clarify: ignore_get is set by default whenever channel == "dev", which it is by default whenever you're compiling locally. So basically everyone would hit this, not just people who had explicitly configured ignore_git. Here's an example of an error this fixes: ``` $ x build Updating only changed submodules Submodules updated in 0.01 seconds Finished dev [unoptimized + debuginfo] target(s) in 0.17s warning: x.py has made several changes recently you may want to look at help: consider looking at the changes in `src/bootstrap/CHANGELOG.md` note: to silence this warning, add `changelog-seen = 2` at the top of `config.toml` Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 0.16s Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu) Building LLVM for x86_64-unknown-linux-gnu detected home dir change, cleaning out entire build directory running: "cmake" "/home/joshua/rustc3/src/llvm-project/llvm" "-G" "Ninja" "-DLLVM_ENABLE_ASSERTIONS=OFF" "-DLLVM_TARGETS_TO_BUILD=AArch64;ARM;BPF;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=AVR" "-DLLVM_INCLUDE_EXAMPLES=OFF" "-DLLVM_INCLUDE_DOCS=OFF" "-DLLVM_INCLUDE_BENCHMARKS=OFF" "-DLLVM_ENABLE_TERMINFO=OFF" "-DLLVM_ENABLE_LIBEDIT=OFF" "-DLLVM_ENABLE_BINDINGS=OFF" "-DLLVM_ENABLE_Z3_SOLVER=OFF" "-DLLVM_PARALLEL_COMPILE_JOBS=48" "-DLLVM_TARGET_ARCH=x86_64" "-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-linux-gnu" "-DLLVM_ENABLE_ZLIB=ON" "-DLLVM_ENABLE_LIBXML2=OFF" "-DLLVM_VERSION_SUFFIX=-rust-dev" "-DCMAKE_INSTALL_MESSAGE=LAZY" "-DCMAKE_C_COMPILER=gcc" "-DCMAKE_CXX_COMPILER=g++" "-DCMAKE_ASM_COMPILER=gcc" "-DCMAKE_C_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_INSTALL_PREFIX=/home/joshua/rustc3/build/x86_64-unknown-linux-gnu/llvm" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_BUILD_TYPE=Release" CMake Error: The source directory "/home/joshua/rustc3/src/llvm-project/llvm" does not exist. Specify --help for usage, or press the help button on the CMake GUI. thread 'main' panicked at ' command did not execute successfully, got: exit status: 1 build script failed, must exit now', /home/joshua/.local/lib/cargo/registry/src/git.luolix.top-1ecc6299db9ec823/cmake-0.1.44/src/lib.rs:885:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace finished in 0.783 seconds Build completed unsuccessfully in 0:00:01 ``` I *believe* this regression was only introduced in rust-lang#87380, not rust-lang#82653. ``@petrochenkov`` can you check that this fixes the issue you encountered in rust-lang#82653 (comment) ? r? ``@Mark-Simulacrum``
…ired These are required 100% of the time, but they are almost always required for any command that runs Cargo in the main workspace. Ideally, initializing these two standard library submodules would be lazy and only initialized when required (see rust-lang#82653). However, it would require updating these in almost every Step (anything that runs `cargo` in the main workspace).
This only updates the submodules the first time they're needed, instead
of unconditionally the first time you run x.py.
Ideally, this would move all submodules to rustbuild and not exclude some tools and
backtrace. Unfortunately, cargo requires all
Cargo.toml
files in thewhole workspace to be present to build any crate.
On my machine, this takes the time for an initial submodule clone (for
x.py --help
) from 55.70 to 15.87 seconds.Helps with #76653. Builds on #86015 and should not be merged before (only the last commit is relevant).