rust-toolset-7-rust-1.22.1-1.el7.src.rpm fails to build on brew. Steps to Reproduce: 1. Attempt to scratch-build devtools-2018.1-rust-toolset-7-rhel-7 rust rpm branch. Actual results: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=14932438 ... Documenting collections v0.0.0 (file:///builddir/build/BUILD/rustc-1.22.1-src/src/libcollections) Documenting std v0.0.0 (file:///builddir/build/BUILD/rustc-1.22.1-src/src/libstd) /builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc: symbol lookup error: /builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc: undefined symbol: _ZN12rustc_driver15target_features17add_configuration17hf4e36c9e237094ebE /builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc: symbol lookup error: /builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc: undefined symbol: _ZN12rustc_driver15target_features17add_configuration17hf4e36c9e237094ebE /builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc: symbol lookup error: /builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc: undefined symbol: _ZN12rustc_driver15target_features17add_configuration17hf4e36c9e237094ebE error: Could not document `std_unicode`. Caused by: process didn't exit successfully: `/builddir/build/BUILD/rustc-1.22.1-src/build/bootstrap/debug/rustdoc --crate-name std_unicode src/libstd_unicode/lib.rs --target x86_64-unknown-linux-gnu -o /builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/doc -L dependency=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --extern core=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcore-32a8ebcdac5c29b9.rlib` (exit code: 127) warning: build failed, waiting for other jobs to finish... error: Could not document `core`. Caused by: process didn't exit successfully: `/builddir/build/BUILD/rustc-1.22.1-src/build/bootstrap/debug/rustdoc --crate-name core src/libcore/lib.rs --target x86_64-unknown-linux-gnu -o /builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/doc -L dependency=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/release/deps` (exit code: 127) warning: build failed, waiting for other jobs to finish... error: Could not document `alloc`. Caused by: process didn't exit successfully: `/builddir/build/BUILD/rustc-1.22.1-src/build/bootstrap/debug/rustdoc --crate-name alloc src/liballoc/lib.rs --target x86_64-unknown-linux-gnu -o /builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/doc -L dependency=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --extern std_unicode=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libstd_unicode-2714a005e0db4de9.rlib --extern core=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcore-32a8ebcdac5c29b9.rlib` (exit code: 127) warning: build failed, waiting for other jobs to finish... /builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc: symbol lookup error: /builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc: undefined symbol: _ZN12rustc_driver15target_features17add_configuration17hf4e36c9e237094ebE error: Could not document `collections`. Caused by: process didn't exit successfully: `/builddir/build/BUILD/rustc-1.22.1-src/build/bootstrap/debug/rustdoc --crate-name collections src/libcollections/lib.rs --target x86_64-unknown-linux-gnu -o /builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/doc -L dependency=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --extern alloc=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/liballoc-430fea88d3906ff9.rlib --extern core=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcore-32a8ebcdac5c29b9.rlib` (exit code: 127) warning: build failed, waiting for other jobs to finish... /builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc: symbol lookup error: /builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc: undefined symbol: _ZN12rustc_driver15target_features17add_configuration17hf4e36c9e237094ebE error: Could not document `std`. Caused by: process didn't exit successfully: `/builddir/build/BUILD/rustc-1.22.1-src/build/bootstrap/debug/rustdoc --crate-name std src/libstd/lib.rs --target x86_64-unknown-linux-gnu -o /builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/doc --cfg feature="backtrace" --cfg feature="panic-unwind" --cfg feature="panic_unwind" -L dependency=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --extern core=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcore-32a8ebcdac5c29b9.rlib --extern alloc_system=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/liballoc_system-639025ffe4d4c56f.rlib --extern rustc_lsan=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/librustc_lsan-0c1649d07a21916c.rlib --extern rustc_asan=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/librustc_asan-119c595f1703b9a3.rlib --extern rustc_msan=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/librustc_msan-c09c7cf3e6369603.rlib --extern unwind=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libunwind-3f18ed6f161908e5.rlib --extern compiler_builtins=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcompiler_builtins-59de37ed7c28bccd.rlib --extern panic_unwind=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libpanic_unwind-c768f2be8f4139a0.rlib --extern libc=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/liblibc-bc902e7bf9d8c900.rlib --extern panic_abort=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libpanic_abort-4c7b5e008269b725.rlib --extern rustc_tsan=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/librustc_tsan-34aeb2c0361c940e.rlib --extern std_unicode=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libstd_unicode-2714a005e0db4de9.rlib --extern rand=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/librand-c987f8dbaa59130b.rlib --extern alloc=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/liballoc-430fea88d3906ff9.rlib --extern collections=/builddir/build/BUILD/rustc-1.22.1-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcollections-f2e8d12eed9a3e4d.rlib` (exit code: 127) command did not execute successfully: "/opt/rh/rust-toolset-7/root/usr/bin/cargo" "doc" "--target" "x86_64-unknown-linux-gnu" "-j" "24" "--release" "--frozen" "--features" "panic-unwind backtrace" "--manifest-path" "/builddir/build/BUILD/rustc-1.22.1-src/src/libstd/Cargo.toml" "--no-deps" "-p" "alloc" "-p" "collections" "-p" "core" "-p" "std" "-p" "std_unicode" expected success, got: exit code: 101 failed to run: /builddir/build/BUILD/rustc-1.22.1-src/build/bootstrap/debug/bootstrap doc Build completed unsuccessfully in 0:02:14 error: Bad exit status from /var/tmp/rpm-tmp.VBF63I (%build) RPM build errors: Bad exit status from /var/tmp/rpm-tmp.VBF63I (%build) Expected results: Successful build.
This only happens when rebuilding using the *same* rustc version for the bootstrap dependency. It's a problem with rustc's own build system, but should have no impact on users. These invocations of rustdoc has two conflicting libraries in LD_LIBRARY_PATH, stage1/lib and stage1/lib/rustlib/$target/lib. The first contains libraries built by the stage0 boostrap rustc, and the second contains those built by stage1 itself. Both locations have librustc_driver-HASH.so with the same HASH, but the symbols within are mangled/hashed differently. It's trying to use stage1 rustc which needs the first version, and stage2 rustdoc which needs the second but loads the first in the path order -- so it gets this symbol lookup error. If we changed the library path order, then rustc would fail instead. Normally the libraries would get a different HASH in the filenames, when stage0 rustc is the *previous* version, and then this conflict doesn't arise. However, when the HASH is the same, I haven't figured out why the symbols within aren't also matched. A workaround is to configure --enable-full-bootstrap, and then it doesn't try to mix stage1-rustc and stage2-rustdoc anymore.
This appears to be fixed upstream by: https://github.com/rust-lang/rust/pull/46592 That's only tangentially related, but its new RUSTDOC_LIBDIR also appears to solve the mixed-library problem here. This will be part of Rust 1.25. I've applied the --enable-full-bootstrap workaround to our builds already, but I'll make sure rebuilds work without that when we get up to 1.25 ourselves.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2018:1280