-
Notifications
You must be signed in to change notification settings - Fork 14k
Description
Summary
(I know building stage 0 std is not officially supported)
This is kinda a reopen of #145859, because in 1.91.0 we shipped 5ce678a that errors out if codegen-backend is set to an empty list [].
We set rust.codegen-backends = [] is to avoid in in bootstrap sanity check that it determines CMake requirement by looking whether codegen-backend contains LLVM.
rust/src/bootstrap/src/core/sanity.rs
Lines 140 to 164 in f8297e3
| // We need cmake, but only if we're actually building LLVM or sanitizers. | |
| let building_llvm = !build.config.llvm_from_ci | |
| && build.hosts.iter().any(|host| { | |
| build.config.llvm_enabled(*host) | |
| && build | |
| .config | |
| .target_config | |
| .get(host) | |
| .map(|config| config.llvm_config.is_none()) | |
| .unwrap_or(true) | |
| }); | |
| let need_cmake = building_llvm || build.config.any_sanitizers_to_build(); | |
| if need_cmake && cmd_finder.maybe_have("cmake").is_none() { | |
| eprintln!( | |
| " | |
| Couldn't find required command: cmake | |
| You should install cmake, or set `download-ci-llvm = true` in the | |
| `[llvm]` section of `bootstrap.toml` to download LLVM rather | |
| than building it. | |
| " | |
| ); | |
| crate::exit!(1); | |
| } |
rust/src/bootstrap/src/core/config/config.rs
Lines 1700 to 1702 in f8297e3
| pub fn llvm_enabled(&self, target: TargetSelection) -> bool { | |
| self.enabled_codegen_backends(target).contains(&CodegenBackendKind::Llvm) | |
| } |
Since we build rust-std with the local rust toolchain, we should not need any llvm rebuild.
Below is pretty much the same as #145859 except commit sha.
We are actually building rust-std from rust-src with local rust built from the same rust-src.
For example,
- I have a full toolchain installed locally and built from
rust-stcin f8297e3 - I'd like to build a dist tarball of
rust-stdwith the toolchain I just built in the same f8297e3 commit.
Command used
A stripped down version of our configuration is roughly this:
./congfigure
# we have this historically to avoid building LLVM
--codegen-backends=
--enable-locked-deps
--set rust.codegen-units-std=1
--set rust.remap-debuginfo
--debuginfo-level-std=1
--dist-compression-formats=xz
--release-channel=stable
--enable-vendor
--enable-local-rust
--enable-local-rebuild
--set "target.$TARGET_TRIPLE.linker=cc"
--set "target.$TARGET_TRIPLE.ar=ar"
--set "target.$TARGET_TRIPLE.ranlib=ranlib"
--prefix "$INSTALL_DIR"
--sysconfdir "etc"
--build "$TARGET_TRIPLE"
--target "$CROSS_TARGET"
# other corss-target-specific flags…
python x.py dist --stage 0 rust-std
Expected behaviour
Before the bootstrap redesign, it worked without recompiling LLVM and stage1 compiler artifacts.
Now you need to rebuild them all, which is a bit undesired.
Proposed solution
Not sure. Maybe check whether build.local-rebuild is set to true in the bootstrap sanity check?