Skip to content

./x.py test library fails when using the library profile (after stage0 redesign) #141983

Closed
@zachs18

Description

@zachs18

Summary

When using the library bootstrap profile, ./x.py test library does not work, and gives errors about being unable to find core and std.

Command used

git clone https://github.com/rust-lang/rust # or use `git clean -dfX` to get to a "fresh" state with no build artifacts or local config files
cd rust
echo 'profile = "library"' > bootstrap.toml
./x.py test library

Expected behaviour

No errors occur and the library tests are run.

Actual behaviour

error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-unknown-linux-gnu` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-unknown-linux-gnu`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

error[E0463]: can't find crate for `std`
  |
  = note: the `x86_64-unknown-linux-gnu` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-unknown-linux-gnu`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `alloctests` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `coretests` (lib) due to 1 previous error
error: could not compile `rand_core` (lib) due to 1 previous error
Build completed unsuccessfully in 0:00:41

Bootstrap configuration (bootstrap.toml)

profile = "library"

Operating system

Ubuntu (Xubuntu) 24.04.2 LTS

HEAD

aae43c4

Additional context

Removing bootstrap.toml, or changing it to profile = "compiler", makes ./x.py test library work again.

I think this is related to #119899. There is no error on 91fad92, but there is an error on 52882f6.

Build Log

downloading https://static.rust-lang.org/dist/2025-05-26/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz
############################################################################################################################################################################# 100.0%
downloading https://static.rust-lang.org/dist/2025-05-26/rustc-beta-x86_64-unknown-linux-gnu.tar.xz
############################################################################################################################################################################# 100.0%
downloading https://static.rust-lang.org/dist/2025-05-26/cargo-beta-x86_64-unknown-linux-gnu.tar.xz
############################################################################################################################################################################# 100.0%
extracting /tmp/rust/build/cache/2025-05-26/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz
extracting /tmp/rust/build/cache/2025-05-26/rustc-beta-x86_64-unknown-linux-gnu.tar.xz
extracting /tmp/rust/build/cache/2025-05-26/cargo-beta-x86_64-unknown-linux-gnu.tar.xz
Building bootstrap
   Compiling proc-macro2 v1.0.89
   Compiling memchr v2.7.4
   Compiling unicode-ident v1.0.13
   Compiling version_check v0.9.5
   Compiling typenum v1.17.0
   Compiling libc v0.2.172
   Compiling shlex v1.3.0
   Compiling crossbeam-utils v0.8.20
   Compiling rustix v1.0.7
   Compiling regex-syntax v0.8.5
   Compiling serde v1.0.215
   Compiling pkg-config v0.3.31
   Compiling cfg-if v1.0.0
   Compiling bitflags v2.6.0
   Compiling linux-raw-sys v0.9.3
   Compiling clap_lex v0.7.2
   Compiling anstyle v1.0.10
   Compiling heck v0.5.0
   Compiling cc v1.2.23
   Compiling same-file v1.0.6
   Compiling log v0.4.22
   Compiling clap_builder v4.5.20
   Compiling semver v1.0.23
   Compiling serde_json v1.0.132
   Compiling generic-array v0.14.7
   Compiling walkdir v2.5.0
   Compiling bootstrap v0.0.0 (/tmp/rust/src/bootstrap)
   Compiling ryu v1.0.18
   Compiling itoa v1.0.11
   Compiling cpufeatures v0.2.15
   Compiling aho-corasick v1.1.3
   Compiling object v0.36.5
   Compiling home v0.5.9
   Compiling termcolor v1.4.1
   Compiling crossbeam-epoch v0.9.18
   Compiling quote v1.0.37
   Compiling crossbeam-deque v0.8.5
   Compiling syn v2.0.87
   Compiling cmake v0.1.54
   Compiling filetime v0.2.25
   Compiling lzma-sys v0.1.20
   Compiling regex-automata v0.4.9
   Compiling xz2 v0.1.7
   Compiling crypto-common v0.1.6
   Compiling block-buffer v0.10.4
   Compiling digest v0.10.7
   Compiling sha2 v0.10.8
   Compiling xattr v1.5.0
   Compiling fd-lock v4.0.4
   Compiling tar v0.4.43
   Compiling toml v0.5.11
   Compiling clap_derive v4.5.18
   Compiling serde_derive v1.0.215
   Compiling bstr v1.10.0
   Compiling globset v0.4.15
   Compiling opener v0.5.2
   Compiling ignore v0.4.23
   Compiling clap v4.5.20
   Compiling clap_complete v4.5.37
   Compiling build_helper v0.1.0 (/tmp/rust/src/build_helper)
    Finished `dev` profile [unoptimized] target(s) in 16.99s
downloading https://static.rust-lang.org/dist/2025-05-27/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz
############################################################################################################################################################################# 100.0%
extracting /tmp/rust/build/cache/2025-05-27/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz to /tmp/rust/build/x86_64-unknown-linux-gnu/rustfmt
downloading https://static.rust-lang.org/dist/2025-05-27/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz
############################################################################################################################################################################# 100.0%
extracting /tmp/rust/build/cache/2025-05-27/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz to /tmp/rust/build/x86_64-unknown-linux-gnu/rustfmt
WARNING: The `change-id` is missing in the `bootstrap.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.
NOTE: to silence this warning, add `change-id = 119899` or `change-id = "ignore"` at the top of `bootstrap.toml`
downloading https://ci-artifacts.rust-lang.org/rustc-builds/aae43c4532690153af7465227816c93036bb1604/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz
############################################################################################################################################################################# 100.0%
extracting /tmp/rust/build/cache/aae43c4532690153af7465227816c93036bb1604-false/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz to /tmp/rust/build/x86_64-unknown-linux-gnu/ci-rustc
downloading https://ci-artifacts.rust-lang.org/rustc-builds/aae43c4532690153af7465227816c93036bb1604/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz
############################################################################################################################################################################# 100.0%
extracting /tmp/rust/build/cache/aae43c4532690153af7465227816c93036bb1604-false/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz to /tmp/rust/build/x86_64-unknown-linux-gnu/ci-rustc
downloading https://ci-artifacts.rust-lang.org/rustc-builds/aae43c4532690153af7465227816c93036bb1604/rustc-dev-nightly-x86_64-unknown-linux-gnu.tar.xz
############################################################################################################################################################################# 100.0%
extracting /tmp/rust/build/cache/aae43c4532690153af7465227816c93036bb1604-false/rustc-dev-nightly-x86_64-unknown-linux-gnu.tar.xz to /tmp/rust/build/x86_64-unknown-linux-gnu/ci-rustc
downloading https://ci-artifacts.rust-lang.org/rustc-builds/ae3b909a323aa771db8ee3919c1454b77db05fbf/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz
############################################################################################################################################################################# 100.0%
extracting /tmp/rust/build/cache/llvm-ae3b909a323aa771db8ee3919c1454b77db05fbf-false/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz to /tmp/rust/build/x86_64-unknown-linux-gnu/ci-llvm
/tmp/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/llvm-strip does not exist; skipping copy
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage0 library artifacts (x86_64-unknown-linux-gnu)
   Compiling compiler_builtins v0.1.160
   Compiling core v0.0.0 (/tmp/rust/library/core)
   Compiling libc v0.2.172
   Compiling object v0.36.7
   Compiling std v0.0.0 (/tmp/rust/library/std)
   Compiling rustc-std-workspace-core v1.99.0 (/tmp/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/tmp/rust/library/alloc)
   Compiling cfg-if v1.0.0
   Compiling memchr v2.7.4
   Compiling adler2 v2.0.0
   Compiling panic_abort v0.0.0 (/tmp/rust/library/panic_abort)
   Compiling rustc-demangle v0.1.24
   Compiling unwind v0.0.0 (/tmp/rust/library/unwind)
   Compiling rustc-std-workspace-alloc v1.99.0 (/tmp/rust/library/rustc-std-workspace-alloc)
   Compiling panic_unwind v0.0.0 (/tmp/rust/library/panic_unwind)
   Compiling gimli v0.31.1
   Compiling std_detect v0.1.5 (/tmp/rust/library/stdarch/crates/std_detect)
   Compiling miniz_oxide v0.8.8
   Compiling hashbrown v0.15.3
   Compiling addr2line v0.24.2
   Compiling rustc-std-workspace-std v1.99.0 (/tmp/rust/library/rustc-std-workspace-std)
   Compiling unicode-width v0.1.14
   Compiling rustc-literal-escaper v0.0.2
   Compiling proc_macro v0.0.0 (/tmp/rust/library/proc_macro)
   Compiling getopts v0.2.21
   Compiling test v0.0.0 (/tmp/rust/library/test)
   Compiling sysroot v0.0.0 (/tmp/rust/library/sysroot)
    Finished `release` profile [optimized] target(s) in 24.26s
Testing  {alloc, alloctests, core, coretests, panic_abort, panic_unwind, proc_macro, std, sysroot, test, unwind} (stage1 -> stage2, x86_64-unknown-linux-gnu)
   Compiling compiler_builtins v0.1.160
   Compiling core v0.0.0 (/tmp/rust/library/core)
   Compiling libc v0.2.172
   Compiling object v0.36.7
   Compiling std v0.0.0 (/tmp/rust/library/std)
   Compiling rand_core v0.9.3
   Compiling alloctests v0.0.0 (/tmp/rust/library/alloctests)
   Compiling coretests v0.0.0 (/tmp/rust/library/coretests)
error[E0463]: can't find crate for `std`
  |
  = note: the `x86_64-unknown-linux-gnu` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-unknown-linux-gnu`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `coretests` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `alloctests` (lib) due to 1 previous error
error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-unknown-linux-gnu` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-unknown-linux-gnu`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

error: could not compile `rand_core` (lib) due to 1 previous error
Build completed unsuccessfully in 0:01:47

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions