Description
I have tried to bootstrap rustc for sparc64-unknown-linux-gnu with:
$ ./configure --host=sparc64-unknown-linux-gnu && make
which fails with:
Building stage1 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Finished release [optimized] target(s) in 0.0 secs
Copying stage1 test from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage1 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Finished release [optimized] target(s) in 0.0 secs
Copying stage1 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Assembling stage2 compiler (x86_64-unknown-linux-gnu)
Uplifting stage1 std (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Copying stage2 std from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage1 std artifacts (x86_64-unknown-linux-gnu -> sparc64-unknown-linux-gnu)
Compiling std v0.0.0 (file:///home/glaubitz/rust/rust/src/libstd)
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/sparc64-unknown-linux-gnu/lib" "/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/de\
ps/std-5e8ebc384e5dfd82.std0.rust-cgu.o" "-o" "/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/libstd-5e8ebc384e5dfd82.so" "/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux\
-gnu/release/deps/std-5e8ebc384e5dfd82.crate.metadata.rust-cgu.o" "/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/std-5e8ebc384e5dfd82.crate.allocator.rust-cgu.o" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs"\
"-L" "/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps" "-L" "/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/release/deps" "-L" "/home/glaubitz/rust/rust/build/sparc64-unknown-linux-gnu/native\
/libbacktrace/.libs" "-L" "/home/glaubitz/rust/rust/build/sparc64-unknown-linux-gnu/native/jemalloc/lib" "-L" "/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/build/compiler_builtins-a1f49ad8dde16ae2/out" "-L" "/home/\
glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/sparc64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "-l" "backtrace" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "-l" "dl" "-l" "rt" "-l" "pthread" "-Wl,-Bstatic" "-Wl,--whole-archive" "/t\
mp/rustc.4vz7yahAsBSv/libpanic_unwind-368647e9b9ca3b39.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.4vz7yahAsBSv/libunwind-eda6aedbad712bc0.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.4vz7yahAsBSv/librand-efc56d5e4c2b1ee8.rlib" "\
-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.4vz7yahAsBSv/liballoc_system-67992b04c9027e70.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.4vz7yahAsBSv/liblibc-bdd38e4620ffab1c.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rust\
c.4vz7yahAsBSv/liballoc-c15d9e20191e711b.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.4vz7yahAsBSv/libstd_unicode-b3230a4723442795.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.4vz7yahAsBSv/libcore-3181dd9e46400ebd.rlib" "-Wl,--no-\
whole-archive" "/tmp/rustc.4vz7yahAsBSv/libcompiler_builtins-fa8533728d55e42b.rlib" "-Wl,-Bdynamic" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util" "-l" "util" "-shared" "-Wl,-rpath,$ORIGIN/../lib"
= note: /usr/bin/ld: /home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/std-5e8ebc384e5dfd82.std0.rust-cgu.o: Relocations in generic ELF (EM: 43)
(...)
/usr/bin/ld: /home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/std-5e8ebc384e5dfd82.std0.rust-cgu.o: Relocations in generic ELF (EM: 43)
/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/std-5e8ebc384e5dfd82.std0.rust-cgu.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
error: aborting due to previous error
error: Could not compile `std`.
Caused by:
process didn't exit successfully: `/home/glaubitz/rust/rust/build/bootstrap/debug/rustc --crate-name std src/libstd/lib.rs --error-format json --crate-type dylib --crate-type rlib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 --cfg feature="alloc_jemalloc" --c\
fg feature="backtrace" --cfg feature="jemalloc" --cfg feature="panic-unwind" --cfg feature="panic_unwind" -C metadata=5e8ebc384e5dfd82 -C extra-filename=-5e8ebc384e5dfd82 --out-dir /home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-\
gnu/release/deps --target sparc64-unknown-linux-gnu -L dependency=/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps -L dependency=/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --ex\
tern alloc_system=/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/liballoc_system-67992b04c9027e70.rlib --extern compiler_builtins=/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknow\
n-linux-gnu/release/deps/libcompiler_builtins-fa8533728d55e42b.rlib --extern unwind=/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/libunwind-eda6aedbad712bc0.rlib --extern std_unicode=/home/glaubitz/rust/rust/bu\
ild/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/libstd_unicode-b3230a4723442795.rlib --extern alloc=/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/liballoc-c15d9e20191e711b.rlib --\
extern panic_unwind=/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/libpanic_unwind-368647e9b9ca3b39.rlib --extern core=/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu\
/release/deps/libcore-3181dd9e46400ebd.rlib --extern libc=/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/liblibc-bdd38e4620ffab1c.rlib --extern collections=/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu\
/stage1-std/sparc64-unknown-linux-gnu/release/deps/libcollections-17d6af9abb88abd5.rlib --extern rand=/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/librand-efc56d5e4c2b1ee8.rlib --extern panic_abort=/home/glaub\
itz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/libpanic_abort-3500a7ebf8df4faa.rlib --extern alloc_jemalloc=/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/liballoc\
_jemalloc-5c483b777c53a191.rlib -L native=/home/glaubitz/rust/rust/build/sparc64-unknown-linux-gnu/native/libbacktrace/.libs -l static=backtrace -l dl -l rt -l pthread -L native=/home/glaubitz/rust/rust/build/sparc64-unknown-linux-gnu/native/jemalloc/lib -L native=/home\
/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/build/compiler_builtins-a1f49ad8dde16ae2/out` (exit code: 101)
thread 'main' panicked at 'command did not execute successfully: "/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "sparc64-unknown-linux-gnu" "--release" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/home\
/glaubitz/rust/rust/src/libstd/Cargo.toml" "--message-format" "json"
expected success, got: exit code: 101', src/bootstrap/compile.rs:873:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.
failed to run: /home/glaubitz/rust/rust/build/bootstrap/debug/bootstrap build
Build completed unsuccessfully in 0:00:20
Makefile:22: recipe for target 'all' failed
make: *** [all] Error 1
The message /usr/bin/ld: /home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/std-5e8ebc384e5dfd82.std0.rust-cgu.o: Relocations in generic ELF (EM: 43)
is repeated several hundred times which is why I cut the all but two instances of that message out.
From the error messages above, it seems that the build process is invoking the wrong linker binary:
/usr/bin/ld: /home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/std-5e8ebc384e5dfd82.std0.rust-cgu.o: Relocations in generic ELF (EM: 43)
/home/glaubitz/rust/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc64-unknown-linux-gnu/release/deps/std-5e8ebc384e5dfd82.std0.rust-cgu.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
It's invoking /usr/bin/ld
, but it should actually invoke /usr/bin/sparc64-linux-gnu-ld
.
I haven't looked at the code yet, but I would suggest that the build process should always call external compilers and binutils using the GNU triplet prefix.
PS: I am one of Debian's sparc64 porters and I will be happy to provide to a fast SPARC-T5 porterbox to anyone who is interested in working on Rust on Linux/SPARC.