Skip to content

Rustbuild: Building stage0 with system installed rust with rustlib in /usr/lib64 fails #51698

@aclemons

Description

@aclemons

I initially built rust version 1.19.0 from source using the downloaded stage0 snapshot compiler and have been building each successive version with the previous version with this config.toml:

[build]
build = "x86_64-unknown-linux-gnu"
host = ["x86_64-unknown-linux-gnu"]
target = ["x86_64-unknown-linux-gnu"]
full-bootstrap = false
submodules = false
vendor = true
extended = true
rustc = "/usr/bin/rustc"
cargo = "/usr/bin/cargo"

[install]
prefix = "/usr"
docdir = "doc/rust"
libdir = "lib64"
mandir = "man"

[rust]
codegen-units = 0
channel = "stable"
rpath = true
codegen-tests = false
ignore-git = true

(The 1.19.0 config.toml did not include rustc/cargo configs)

This worked fine until rust 1.26.x. This now breaks building stage0 (further details below).

Environment:
Slackware64 14.2

It does not break on Slackware 14.2 (32bit) using libdir = "lib" in the config.toml.

After some research, I've found a workaround.

In the file src/bootstrap/builder.rs, fn sysroot_libdir always sets the libdir to Path::new("lib") for stage0. This is fine for the case of building with the downloaded stage0, but not for the case of using the system rustc with rustlib in /usr/lib64.

After I changed the source to use lib64 when building on x86_64, I could finally build 1.26.x successfully.

Meta

rustc --version --verbose:

rustc 1.25.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.25.0
LLVM version: 6.0

Backtrace:

[...]
Dist docs (x86_64-unknown-linux-gnu)
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling cc v1.0.9
   Compiling build_helper v0.1.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/build_helper)
   Compiling core v0.0.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/libcore)
   Compiling unwind v0.0.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/libunwind)
   Compiling std v0.0.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/libstd)
   Compiling cmake v0.1.29
   Compiling compiler_builtins v0.0.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/rustc/compiler_builtins_shim)
   Compiling alloc_jemalloc v0.0.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/liballoc_jemalloc)
   Compiling rustc_tsan v0.0.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/librustc_tsan)
   Compiling rustc_asan v0.0.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/librustc_asan)
   Compiling rustc_msan v0.0.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/librustc_msan)
   Compiling rustc_lsan v0.0.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/librustc_lsan)
   Compiling std_unicode v0.0.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/libstd_unicode)
   Compiling libc v0.0.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/rustc/libc_shim)
   Compiling alloc v0.0.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/liballoc)
   Compiling panic_abort v0.0.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/libpanic_abort)
   Compiling alloc_system v0.0.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/liballoc_system)
   Compiling panic_unwind v0.0.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/libpanic_unwind)
    Finished release [optimized] target(s) in 49.9 secs
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling term v0.0.0 (file:///home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/libterm)
   Compiling getopts v0.2.15
error[E0463]: can't find crate for `std`
error: aborting due to previous error
error: Could not compile `term`.
Caused by:
  process didn't exit successfully: `/home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/build/bootstrap/debug/rustc --crate-name term libterm/lib.rs --error-format json --crate-type dylib --crate-type rlib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=2548365409e71e93 -C extra-filename=-2548365409e71e93 --out-dir /home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/build/x86_64-unknown-linux-gnu/stage0-test/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/build/x86_64-unknown-linux-gnu/stage0-test/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/build/x86_64-unknown-linux-gnu/stage0-test/release/deps` (exit code: 101)
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `std`
error: aborting due to previous error
error: Could not compile `getopts`.
Caused by:
  process didn't exit successfully: `/home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/build/bootstrap/debug/rustc --crate-name getopts vendor/getopts/src/lib.rs --error-format json --crate-type lib --emit=dep-info,link -C opt-level=2 -C metadata=1df97bed08af6795 -C extra-filename=-1df97bed08af6795 --out-dir /home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/build/x86_64-unknown-linux-gnu/stage0-test/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/build/x86_64-unknown-linux-gnu/stage0-test/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/build/x86_64-unknown-linux-gnu/stage0-test/release/deps --cap-lints allow` (exit code: 101)
command did not execute successfully: "/usr/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "10" "--release" "--frozen" "--manifest-path" "/home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/src/libtest/Cargo.toml" "--message-format" "json"
expected success, got: exit code: 101
thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1064:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
failed to run: /home/acl/slack-rust-bootstrap/rust/tmp/rustc-1.26.2-src/build/bootstrap/debug/bootstrap dist
Build completed unsuccessfully in 0:01:38

Metadata

Metadata

Assignees

No one assigned

    Labels

    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