Skip to content

Link error when cross-compiling to ARM with --crate-type dylib: Relocations in generic ELF (EM: 40) #28924

Closed
@mbrubeck

Description

@mbrubeck

rustc lib.rs -g --crate-type dylib --target arm-linux-androideabi fails with the following error, even if lib.rs is an empty file:

error: linking with `cc` failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-Wl,--allow-multiple-definition" "-L" "/home/mbrubeck/.servo/rust/168a23ebe1729386138fa71643382fdd64fac205/rustc-1.5.0-dev-x86_64-unknown-linux-gnu/rustc/lib/rustlib/arm-linux-androideabi/lib" "lib.0.o" "-o" "liblib.so" "lib.metadata.o" "-nodefaultlibs" "-L" "/home/mbrubeck/.servo/rust/168a23ebe1729386138fa71643382fdd64fac205/rustc-1.5.0-dev-x86_64-unknown-linux-gnu/rustc/lib/rustlib/arm-linux-androideabi/lib" "-L" "/home/mbrubeck/src/image-gif/.rust/lib/arm-linux-androideabi" "-L" "/home/mbrubeck/src/image-gif/lib/arm-linux-androideabi" "-Wl,-Bstatic" "-Wl,-Bdynamic" "-Wl,--whole-archive" "/tmp/rustc.EKTAUblKIJax/libstd-bb943c5a.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.EKTAUblKIJax/libcollections-bb943c5a.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.EKTAUblKIJax/librustc_unicode-bb943c5a.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.EKTAUblKIJax/librand-bb943c5a.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.EKTAUblKIJax/liballoc-bb943c5a.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.EKTAUblKIJax/liballoc_system-bb943c5a.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.EKTAUblKIJax/liblibc-bb943c5a.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustc.EKTAUblKIJax/libcore-bb943c5a.rlib" "-Wl,--no-whole-archive" "-l" "dl" "-l" "log" "-l" "gcc" "-l" "gcc" "-l" "c" "-l" "m" "-shared" "-l" "compiler-rt"
note: /usr/bin/ld: lib.0.o: Relocations in generic ELF (EM: 40)
lib.0.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status

error: aborting due to previous error

This happens with Servo's current Rust snapshot (rustc 1.5.0-dev (168a23e 2015-10-01)) and also with older versions at least as far back as 1.3.0-dev.

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