When I try to build rust-1.17.0 using the system installation of rust-1.16.0, I run into an error where rustc cannot find the newly built libstd when building stage0-test:
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Dirty - /var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/build/x86_64-unknown-linux-gnu/stage0-test/x86_64-unknown-linux-gnu/release
running: "/var/tmp/portage/dev-lang/rust-1.17.0/work/cargo-nightly-x86_64-unknown-linux-gnu/cargo/bin/cargo" "build" "-j" "4" "--target" "x86_64-unknown-linux-gnu" "-v" "--release" "--manifest-path" "/var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/src/libtest/Cargo.toml"
Compiling term v0.0.0 (file:///var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/src/libterm)
Compiling getopts v0.0.0 (file:///var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/src/libgetopts)
Running `/var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/build/bootstrap/debug/rustc --crate-name term src/libterm/lib.rs --crate-type dylib --crate-type rlib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=3a0fef509712fa1f -C extra-filename=-3a0fef509712fa1f --out-dir /var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/build/x86_64-unknown-linux-gnu/stage0-test/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/build/x86_64-unknown-linux-gnu/stage0-test/x86_64-unknown-linux-gnu/release/deps -L dependency=/var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/build/x86_64-unknown-linux-gnu/stage0-test/release/deps`
Running `/var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/build/bootstrap/debug/rustc --crate-name getopts src/libgetopts/lib.rs --crate-type dylib --crate-type rlib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=b6a379af3b1f8c20 -C extra-filename=-b6a379af3b1f8c20 --out-dir /var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/build/x86_64-unknown-linux-gnu/stage0-test/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/build/x86_64-unknown-linux-gnu/stage0-test/x86_64-unknown-linux-gnu/release/deps -L dependency=/var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/build/x86_64-unknown-linux-gnu/stage0-test/release/deps`
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: `/var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/build/bootstrap/debug/rustc --crate-name term src/libterm/lib.rs --crate-type dylib --crate-type rlib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=3a0fef509712fa1f -C extra-filename=-3a0fef509712fa1f --out-dir /var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/build/x86_64-unknown-linux-gnu/stage0-test/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/build/x86_64-unknown-linux-gnu/stage0-test/x86_64-unknown-linux-gnu/release/deps -L dependency=/var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/build/x86_64-unknown-linux-gnu/stage0-test/release/deps` (exit code: 101)
Build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `std`
error: aborting due to previous error
error: build failed
command did not execute successfully: "/var/tmp/portage/dev-lang/rust-1.17.0/work/cargo-nightly-x86_64-unknown-linux-gnu/cargo/bin/cargo" "build" "-j" "4" "--target" "x86_64-unknown-linux-gnu" "-v" "--release" "--manifest-path" "/var/tmp/portage/dev-lang/rust-1.17.0/work/rustc-1.17.0-src/src/libtest/Cargo.toml"
expected success, got: exit code: 101
Before I ran into this error, I tried to build rust using the official rustc-1.16.0 tarball, which failed for more obvious reasons with the same error in stage0 when building the first rustc -- that rustc tarball does include libstd, but is missing libcore on which it depends.
I am mostly following the official building-from-source documentation (README.md in the rust GitHub repo), with the notable exception that I am not making use of cargo's online registry, in order to have a network-less build.
The full build log and build script (Gentoo ebuild) is available.
I would be very glad if someone could hint me at what I am doing wrong.