Skip to content

How to compile rust for mipsel-unknown-linux-uclibc ? #38172

@nicolattuso

Description

@nicolattuso

Hi !
I tried to cross-compile rust for mipsel-unknown-linux-uclibc on my computer (x86_64-unknown-linux-gnu) following the instructions in commit 1cf9caf (@japaric) and failed. Here is what I did :
git checkout 2c6933acc (1.13.0)
I added the path to my mipsel toolchain (gcc, g++, ar, ...) to my PATH
./configure --enable-rustbuild --target=mipsel-unknown-linux-uclibc
make

Meta

➜  rust git:(2c6933a) rustc --version --verbose
rustc 1.13.0 (2c6933acc 2016-11-07)
binary: rustc
commit-hash: 2c6933acc05c61e041be764cb1331f6281993f3f
commit-date: 2016-11-07
host: x86_64-unknown-linux-gnu
release: 1.13.0

backtrace:

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/mipsel-unknown-linux-uclibc/lib" "/mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2-std/mipsel-unknown-linux-uclibc/release/deps/std-c59cddcd0af2e166.0.o" "-o" "/mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2-std/mipsel-unknown-linux-uclibc/release/deps/libstd-c59cddcd0af2e166.so" "/mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2-std/mipsel-unknown-linux-uclibc/release/deps/std-c59cddcd0af2e166.metadata.o" "-Wl,-O1" "-nodefaultlibs" "-L" "/mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2-std/mipsel-unknown-linux-uclibc/release/deps" "-L" "/mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2-std/mipsel-unknown-linux-uclibc/release/build/std-a809d8d8110a0c2c/out/.libs" "-L" "/mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2-std/mipsel-unknown-linux-uclibc/release/build/alloc_jemalloc-3fdf800200d00d2b/out/lib" "-L" "/mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2-std/mipsel-unknown-linux-uclibc/release/build/compiler_builtins-6f98225e9c197338/out" "-L" "/mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/mipsel-unknown-linux-uclibc/lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "-l" "backtrace" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "-l" "dl" "-l" "rt" "-l" "pthread" "-Wl,--whole-archive" "/tmp/rustc.bAZRRUAtC6j3/libpanic_unwind-7bbc0f7aeca8d97e.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.bAZRRUAtC6j3/libcollections-2384fa75982df921.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.bAZRRUAtC6j3/liballoc-97c94bbcbb6ce588.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.bAZRRUAtC6j3/liballoc_jemalloc-d3ea7757ad00d487.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.bAZRRUAtC6j3/librustc_unicode-0f8a4e3472bf9986.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.bAZRRUAtC6j3/libunwind-a2900b506cabe0f1.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.bAZRRUAtC6j3/liblibc-5e16cc1287996e06.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.bAZRRUAtC6j3/librand-9e79fbad0cb1c989.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.bAZRRUAtC6j3/libcore-2bfca94c87453f15.rlib" "-Wl,--no-whole-archive" "/tmp/rustc.bAZRRUAtC6j3/libcompiler_builtins-66ce650a45b25434.rlib" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "util" "-shared" "-Wl,-rpath,$ORIGIN/../lib"
  = note: /usr/bin/ld: /mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2-std/mipsel-unknown-linux-uclibc/release/deps/std-c59cddcd0af2e166.0.o: Relocations in generic ELF (EM: 8)
/usr/bin/ld: /mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2-std/mipsel-unknown-linux-uclibc/release/deps/std-c59cddcd0af2e166.0.o: Relocations in generic ELF (EM: 8)
/usr/bin/ld: /mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2-std/mipsel-unknown-linux-uclibc/release/deps/std-c59cddcd0af2e166.0.o: Relocations in generic ELF (EM: 8)
/usr/bin/ld: /mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2-std/mipsel-unknown-linux-uclibc/release/deps/std-c59cddcd0af2e166.0.o: Relocations in generic ELF (EM: 8)
/usr/bin/ld: /mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2-std/mipsel-unknown-linux-uclibc/release/deps/std-c59cddcd0af2e166.0.o: Relocations in generic ELF (EM: 8)
/usr/bin/ld: /mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2-std/mipsel-unknown-linux-uclibc/release/deps/std-c59cddcd0af2e166.0.o: Relocations in generic ELF (EM: 8)

... <many more similar messages>

/mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2-std/mipsel-unknown-linux-uclibc/release/deps/std-c59cddcd0af2e166.0.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`.

To learn more, run the command again with --verbose.


command did not execute successfully: "/mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "-j" "8" "--target" "mipsel-unknown-linux-uclibc" "--release" "--features" " jemalloc backtrace" "--manifest-path" "/mnt/ssd/rust/rust/src/rustc/std_shim/Cargo.toml"
expected success, got: exit code: 101


Makefile:23: recipe for target 'all' failed
make: *** [all] Error 1

➜  rust git:(2c6933a) file /mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2-std/mipsel-unknown-linux-uclibc/release/deps/std-c59cddcd0af2e166.0.o
/mnt/ssd/rust/rust/build/x86_64-unknown-linux-gnu/stage2-std/mipsel-unknown-linux-uclibc/release/deps/std-c59cddcd0af2e166.0.o: ELF 32-bit LSB relocatable, MIPS, MIPS32 version 1 (SYSV), not stripped

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions