japaric / rust-cross

Everything you need to know about cross compiling Rust programs!
Apache License 2.0
2.5k stars 95 forks source link

Can't install on Ubuntu 15.10 #16

Open mfeif opened 8 years ago

mfeif commented 8 years ago

I'm on a rpi 1, so I am using the arm6... trying to otherwise follow along:

Following your "TL;DR Ubuntu example" in your README.md, when I get to

$ curl -sf https://raw.githubusercontent.com/brson/multirust/master/quick-install.sh | sh $ sudo aptitude install gcc-arm-linux-gnueabi $ multirust add-target nightly armv6-rpi-linux-gnueabi

leads to: multirust: toolchain 'nightly' is not installed; so I tried stable: multirust add-target stable armv6-rpi-linux-gnueabi rustup: no channel manifest at '/home/mjf/.multirust/toolchains/stable/lib/rustlib/channel-manifest.toml'

I tried a few other variations: arm-rpi-linux-gnueabi arm-generic-linux-gnueabi, no go.

Thanks

japaric commented 8 years ago

Hello Matt,

I want to clarify what you are trying to do:

(a) You want to cross compile a Rust program for the RPI. This is, you are running these commands on e.g. your laptop. Or, (b) You want install rustc and cargo on your RPI to compile Rust programs on the RPI. This is, you are running these commands on the RPI.

Because this guide is about the case (a). And from the output you pasted above it seems to me that you are trying to do (b) but I could be wrong.

If you tell which route you want to follow (a) or (b), I'd gladly help you with either :smile:.

I tried a few other variations: arm-rpi-linux-gnueabi arm-generic-linux-gnueabi, no go.

For the RPI, the "triple" you want is either arm-unknown-linux-gnueabi (soft float / no FPU ABI) or arm-unknown-linux-gnueabihf (hard float / with FPU ABI). Which one will actually work depends on your Linux distribution, but most distributions nowadays use the hard float ABI -- that would be the gnueabihf triple.

mfeif commented 8 years ago

Thanks for the quick response. Indeed, I am trying option 'a'.

I started reading the non tl;dr section, and installed the raspberry pi tools, and have been struggling to figure those out, but think I may have. I've setup my path to look for the arm-* versions of the toolchain, they're all there.

I install the std crate, and I'm able to compile some stuff, though it seems that it fails when it's time to link.

Anyway, I wanted to let you know that I followed your tl;dr to the letter, and it didn't work ;-) You were so clear about asking for help with typos and such.

If I can't get the linking to work, that's probably pilot error, and not a bug in your docs.

Thanks!

mfeif commented 8 years ago

Oh, I get tons of these after a long compile:

/usr/bin/ld: /home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/librespot.0.o: Relocations in generic ELF (EM: 40)
/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/librespot.0.o: error adding symbols: File in wrong format

I wonder why it's using /usr/bin/ld rather than the arm-linux-gnueabihf-ld

japaric commented 8 years ago

Anyway, I wanted to let you know that I followed your tl;dr to the letter, and it didn't work ;-)

You did use a different target triple though ;-). The problem is that the installation of the RPi cross compiler is more involved the installation of a ARMv7 cross compiler -- there is no (apt) packaged cross compiler for RPi in Ubuntu/Debian AFAIK.

I wonder why it's using /usr/bin/ld rather than the arm-linux-gnueabihf-ld

Did you set the linker in .cargo/config? Something like this but with the RPi target and the right gcc:

$ cat >.cargo/config <<EOF
> [target.arm-unknown-linux-gnueabihf]
> linker = "arm-linux-gnueabihf-gcc"
> EOF

You can confirm that you are using the right linker by calling cargo rustc -- -Z print-link-args. The output should say arm-$foo-$bar-gcc and not cc.

japaric commented 8 years ago

These step work for me:

# Install toolchain
$ git clone --depth 1 https://github.com/raspberrypi/tools
$ export PATH="$PATH:$(pwd)/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin"
$ arm-linux-gnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/home/japaric/Downloads/tools-master/tools-master/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/../libexec/gcc/arm-linux-gnueabihf/4.9.3/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: /home/dom/projects/crosstool-ng/install/bin/.build/src/gcc-4.9.3/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=arm-linux-gnueabihf --prefix=/home/dom/x-tools6h-new/arm-rpi-linux-gnueabihf --with-sysroot=/home/dom/x-tools6h-new/arm-rpi-linux-gnueabihf/arm-linux-gnueabihf/sysroot --enable-languages=c,c++ --with-arch=armv6 --with-fpu=vfp --with-float=hard --with-pkgversion='crosstool-NG crosstool-ng-1.22.0-88-g8460611' --disable-sjlj-exceptions --enable-__cxa_atexit --disable-libmudflap --enable-libgomp --disable-libssp --enable-libquadmath --enable-libquadmath-support --disable-libsanitizer --with-gmp=/home/dom/projects/crosstool-ng/install/bin/.build/arm-linux-gnueabihf/buildtools --with-mpfr=/home/dom/projects/crosstool-ng/install/bin/.build/arm-linux-gnueabihf/buildtools --with-mpc=/home/dom/projects/crosstool-ng/install/bin/.build/arm-linux-gnueabihf/buildtools --with-isl=/home/dom/projects/crosstool-ng/install/bin/.build/arm-linux-gnueabihf/buildtools --with-cloog=/home/dom/projects/crosstool-ng/install/bin/.build/arm-linux-gnueabihf/buildtools --enable-lto --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-threads=posix --enable-target-optspace --with-linker-hash-style=gnu --disable-nls --disable-multilib --with-local-prefix=/home/dom/x-tools6h-new/arm-rpi-linux-gnueabihf/arm-linux-gnueabihf/sysroot --enable-long-long --with-arch=armv6 --with-float=hard --with-fpu=vfp
Thread model: posix
gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)

$ cargo new --bin hello
$ cd hello

# Configure cargo
$ cat >.cargo/config <<EOF
[target.arm-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
EOF

# Install cross compiled standard crates
$ rustup target add arm-unknown-linux-gnueabihf

# Test
$ cargo build --target arm-unknown-linux-gnueabihf --verbose
     Compiling hello v0.1.0 (file:///home/japaric/tmp/hello)
     Running `rustc src/main.rs --crate-name hello --crate-type bin -g --out-dir /home/japaric/tmp/hello/target/arm-unknown-linux-gnueabihf/debug --emit=dep-info,link --target arm-unknown-linux-gnueabihf -C linker=arm-linux-gnueabihf-gcc -L dependency=/home/japaric/tmp/hello/target/arm-unknown-linux-gnueabihf/debug -L dependency=/home/japaric/tmp/hello/target/arm-unknown-linux-gnueabihf/debug/deps`

$ file target/arm-unknown-linux-gnueabihf/debug/hello
target/arm-unknown-linux-gnueabihf/debug/hello: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, not stripped

The rustup command is from here but you could use multirust instead.

mfeif commented 8 years ago

You're correct -- it wasn't to the letter ;-)

I didn't use that branch of the rpi tools; there is literally no documentation, so I was using the gcc-linaro-arm-linux-gnueabihf-raspbian-x64 tree in there.

I'll see if I can duplicate your good results...

mfeif commented 8 years ago

Thank you; I was able to use rustup (needed the beta channel, not the standard) and added the toolchain, did the custom config (not .config as above) and was able to compile the hello example.

I can't compile my lib; but that's not your problem at all ;-)

For anyone who sees this in the future, YES, the hello example DID run on the rpi1

Thanks!

japaric commented 8 years ago

Glad to hear it's working now!

re: stable vs beta. This target is not available in Rust 1.7, but should be available in Rust 1.8, which comes out this Thursday.

mfeif commented 8 years ago

Let me know if I'm out of line, but I followed precisely the same instructions for compiling my library as the hello example you gave me (which I was able to successfully compile and run)...

What results seems like a compiling problem, not a code problem, because the linker can't seem to recognize its output:

[much stuff snipped off of the log]

   Compiling librespot v0.1.0 (file:///home/mjf/librespot)
     Running `rustc build.rs --crate-name build_script_build --crate-type bin -g --cfg feature=\"syntex\" --cfg feature=\"discovery\" --cfg feature=\"pulseaudio-backend\" --cfg feature=\"dns-sd\" --cfg feature=\"libpulse-sys\" --out-dir /home/mjf/librespot/target/release/build/librespot-195f5c1c75ac4f79 --emit=dep-info,link -L dependency=/home/mjf/librespot/target/release -L dependency=/home/mjf/librespot/target/release/deps --extern syntex=/home/mjf/librespot/target/release/deps/libsyntex-199779e388d821ad.rlib --extern vergen=/home/mjf/librespot/target/release/deps/libvergen-86b79d9bc72b5f17.rlib --extern json_macros=/home/mjf/librespot/target/release/deps/libjson_macros-f42f6262907f7f72.so --extern json_macros=/home/mjf/librespot/target/release/deps/libjson_macros-f42f6262907f7f72.rlib --extern protobuf_macros=/home/mjf/librespot/target/release/deps/libprotobuf_macros-306e7c3289d9032d.so --extern protobuf_macros=/home/mjf/librespot/target/release/deps/libprotobuf_macros-306e7c3289d9032d.rlib`
     Running `/home/mjf/librespot/target/release/build/librespot-195f5c1c75ac4f79/build-script-build`
     Running `rustc src/lib.rs --crate-name librespot --crate-type lib -C opt-level=3 --cfg feature=\"syntex\" --cfg feature=\"discovery\" --cfg feature=\"pulseaudio-backend\" --cfg feature=\"dns-sd\" --cfg feature=\"libpulse-sys\" --out-dir /home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release --emit=dep-info,link --target arm-unknown-linux-gnueabihf -C linker=arm-linux-gnueabihf-gcc -L dependency=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release -L dependency=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps --extern url=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liburl-b19bdaef8ee79315.rlib --extern rand=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/librand-c724acb3942597d1.rlib --extern rustc_serialize=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/librustc_serialize-e1b49f9d5f55eb83.rlib --extern bit_set=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libbit_set-a823ac30a24665f6.rlib --extern json_macros=/home/mjf/librespot/target/release/deps/libjson_macros-f42f6262907f7f72.so --extern json_macros=/home/mjf/librespot/target/release/deps/libjson_macros-f42f6262907f7f72.rlib --extern log=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblog-0ec442df0ecb416b.rlib --extern libpulse_sys=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblibpulse_sys-57dae0ccc209957c.rlib --extern dns_sd=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libdns_sd-5fbf42147d134a59.rlib --extern byteorder=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libbyteorder-79579e11a5fc0173.rlib --extern shannon=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libshannon-77d59ac4b340cab9.rlib --extern rpassword=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/librpassword-a08ecebfabb402b5.rlib --extern libc=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblibc-036fbedefddee9e8.rlib --extern vorbis=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libvorbis-c68896280ab08303.rlib --extern librespot_protocol=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblibrespot_protocol-5c97aa522e0340cc.rlib --extern crypto=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libcrypto-f6a50638f37ed575.rlib --extern eventual=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libeventual-c4dbd620c3b99400.rlib --extern tempfile=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libtempfile-f39fcff7028e2b63.rlib --extern protobuf=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libprotobuf-28b5a8c52fd9fd28.rlib --extern hyper=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libhyper-0138d6aa106ddfd5.rlib --extern lazy_static=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblazy_static-553d4fa9dca2851d.rlib --extern lmdb_rs=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblmdb_rs-6131231dedf6f887.rlib --extern env_logger=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libenv_logger-927e8cf4058b3b7c.rlib --extern protobuf_macros=/home/mjf/librespot/target/release/deps/libprotobuf_macros-306e7c3289d9032d.so --extern protobuf_macros=/home/mjf/librespot/target/release/deps/libprotobuf_macros-306e7c3289d9032d.rlib --extern getopts=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libgetopts-1cab3df9d55a869b.rlib --extern time=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libtime-1b6cffb716aa17de.rlib --extern num=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libnum-a2e6e61627ca7fe5.rlib -L native=/usr/lib/x86_64-linux-gnu -L native=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/shannon-sys-a7cfa3b8da240905/out -L native=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/vorbisfile-sys-274b40ec73b005a6/out -L native=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/vorbis-sys-d1f574d079a60890/out -L native=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/ogg-sys-ae5b224f8d433148/out -L native=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/rust-crypto-97872ea539a059cd/out -L /home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/liblmdb-sys-a2c241e21e41db6b/out`
src/audio_key.rs:11:16: 11:20 warning: unused variable: `arg_0`, #[warn(unused_variables)] on by default
src/audio_key.rs:11 #[derive(Debug,Hash,PartialEq,Eq,Copy,Clone)]
                                   ^~~~
src/audio_key.rs:11:16: 11:20 note: in this expansion of #[derive_Hash] (defined in src/audio_key.rs)
src/lib.rs:69:1: 69:23 note: in this expansion of include!
src/stream.rs:17:16: 17:20 warning: unused variable: `arg_0`, #[warn(unused_variables)] on by default
src/stream.rs:17 #[derive(Debug,Hash,PartialEq,Eq,Copy,Clone)]
                                ^~~~
src/stream.rs:17:16: 17:20 note: in this expansion of #[derive_Hash] (defined in src/stream.rs)
src/lib.rs:69:1: 69:23 note: in this expansion of include!
     Running `rustc src/main.rs --crate-name librespot --crate-type bin -C opt-level=3 --cfg feature=\"syntex\" --cfg feature=\"discovery\" --cfg feature=\"pulseaudio-backend\" --cfg feature=\"dns-sd\" --cfg feature=\"libpulse-sys\" --out-dir /home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release --emit=dep-info,link --target arm-unknown-linux-gnueabihf -C linker=arm-linux-gnueabihf-gcc -L dependency=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release -L dependency=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps --extern url=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liburl-b19bdaef8ee79315.rlib --extern rand=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/librand-c724acb3942597d1.rlib --extern rustc_serialize=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/librustc_serialize-e1b49f9d5f55eb83.rlib --extern bit_set=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libbit_set-a823ac30a24665f6.rlib --extern json_macros=/home/mjf/librespot/target/release/deps/libjson_macros-f42f6262907f7f72.so --extern json_macros=/home/mjf/librespot/target/release/deps/libjson_macros-f42f6262907f7f72.rlib --extern log=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblog-0ec442df0ecb416b.rlib --extern libpulse_sys=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblibpulse_sys-57dae0ccc209957c.rlib --extern dns_sd=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libdns_sd-5fbf42147d134a59.rlib --extern byteorder=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libbyteorder-79579e11a5fc0173.rlib --extern shannon=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libshannon-77d59ac4b340cab9.rlib --extern rpassword=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/librpassword-a08ecebfabb402b5.rlib --extern libc=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblibc-036fbedefddee9e8.rlib --extern vorbis=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libvorbis-c68896280ab08303.rlib --extern librespot_protocol=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblibrespot_protocol-5c97aa522e0340cc.rlib --extern crypto=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libcrypto-f6a50638f37ed575.rlib --extern eventual=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libeventual-c4dbd620c3b99400.rlib --extern tempfile=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libtempfile-f39fcff7028e2b63.rlib --extern protobuf=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libprotobuf-28b5a8c52fd9fd28.rlib --extern hyper=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libhyper-0138d6aa106ddfd5.rlib --extern lazy_static=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblazy_static-553d4fa9dca2851d.rlib --extern lmdb_rs=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblmdb_rs-6131231dedf6f887.rlib --extern env_logger=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libenv_logger-927e8cf4058b3b7c.rlib --extern protobuf_macros=/home/mjf/librespot/target/release/deps/libprotobuf_macros-306e7c3289d9032d.so --extern protobuf_macros=/home/mjf/librespot/target/release/deps/libprotobuf_macros-306e7c3289d9032d.rlib --extern getopts=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libgetopts-1cab3df9d55a869b.rlib --extern time=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libtime-1b6cffb716aa17de.rlib --extern num=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libnum-a2e6e61627ca7fe5.rlib --extern librespot=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/liblibrespot.rlib -L native=/usr/lib/x86_64-linux-gnu -L native=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/shannon-sys-a7cfa3b8da240905/out -L native=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/vorbisfile-sys-274b40ec73b005a6/out -L native=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/vorbis-sys-d1f574d079a60890/out -L native=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/ogg-sys-ae5b224f8d433148/out -L native=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/rust-crypto-97872ea539a059cd/out -L /home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/liblmdb-sys-a2c241e21e41db6b/out`
error: linking with `arm-linux-gnueabihf-gcc` failed: exit code: 1
note: "arm-linux-gnueabihf-gcc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/home/mjf/.multirust/toolchains/nightly-2016-03-17-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/librespot.0.o" "-o" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/librespot" "-Wl,--gc-sections" "-pie" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release" "-L" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps" "-L" "/usr/lib/x86_64-linux-gnu" "-L" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/shannon-sys-a7cfa3b8da240905/out" "-L" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/vorbisfile-sys-274b40ec73b005a6/out" "-L" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/vorbis-sys-d1f574d079a60890/out" "-L" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/ogg-sys-ae5b224f8d433148/out" "-L" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/rust-crypto-97872ea539a059cd/out" "-L" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/liblmdb-sys-a2c241e21e41db6b/out" "-L" "/home/mjf/.multirust/toolchains/nightly-2016-03-17-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libenv_logger-927e8cf4058b3b7c.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/librpassword-a08ecebfabb402b5.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/liblibrespot.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libbit_set-a823ac30a24665f6.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libtempfile-f39fcff7028e2b63.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libbit_vec-12b013c81239352c.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libdns_sd-5fbf42147d134a59.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblmdb_rs-6131231dedf6f887.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libshannon-77d59ac4b340cab9.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libbyteorder-e0bce91f3252088b.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libbitflags-e87d150db0333415.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libcrypto-f6a50638f37ed575.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblibrespot_protocol-5c97aa522e0340cc.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libeventual-c4dbd620c3b99400.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libsyncbox-1a3bc21d736a2b94.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblibpulse_sys-57dae0ccc209957c.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblibc-5eb0f3d71076a4bc.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libshannon_sys-7d354cf9677a2b91.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libregex-08fd4c31cabb9147.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libregex_syntax-99f5da5a82737304.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libutf8_ranges-a6119bc781af556b.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblazy_static-553d4fa9dca2851d.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libliblmdb_sys-1bd3eb46d33ffe48.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libaho_corasick-13668caf93db7fdf.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libmemchr-6b607a0dde114fba.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libtermios-8c6931595ba4595a.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libgetopts-1cab3df9d55a869b.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libhyper-0138d6aa106ddfd5.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libhttparse-6ffdb64b794751a1.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libsolicit-8f0dfee0deffeb96.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libhpack-320332c60c4dfc72.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblanguage_tags-1cb52046c41cf66a.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libmime-b67d6d6511d55d94.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libserde-db1be5227e810a92.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libtraitobject-3d4dcec5d1662e96.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libnum-a2e6e61627ca7fe5.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libcookie-276cf5002a04c35b.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libtime-1b6cffb716aa17de.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liburl-b19bdaef8ee79315.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libunicode_normalization-f33127ef3e902b05.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libunicode_bidi-7a56a7dec369a022.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libmatches-030a774745cc4f96.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblog-0ec442df0ecb416b.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libunicase-2e75ae83bf996d47.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libtypeable-1604229584d39a42.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libuuid-5650c0ca096e22f0.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/librand-c724acb3942597d1.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/librustc_serialize-e1b49f9d5f55eb83.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libprotobuf-28b5a8c52fd9fd28.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libvorbis-c68896280ab08303.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libvorbisfile_sys-ac023697e261ef7c.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libvorbis_sys-7f8afb6e09fae080.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libogg_sys-983b532bfcfee2f0.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libbyteorder-79579e11a5fc0173.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libnum_cpus-a5254d7bdb51bb96.rlib" "/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblibc-036fbedefddee9e8.rlib" "/home/mjf/.multirust/toolchains/nightly-2016-03-17-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libstd-18402db3.rlib" "/home/mjf/.multirust/toolchains/nightly-2016-03-17-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libcollections-18402db3.rlib" "/home/mjf/.multirust/toolchains/nightly-2016-03-17-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/librustc_unicode-18402db3.rlib" "/home/mjf/.multirust/toolchains/nightly-2016-03-17-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/librand-18402db3.rlib" "/home/mjf/.multirust/toolchains/nightly-2016-03-17-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/liballoc-18402db3.rlib" "/home/mjf/.multirust/toolchains/nightly-2016-03-17-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/liballoc_jemalloc-18402db3.rlib" "/home/mjf/.multirust/toolchains/nightly-2016-03-17-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/liblibc-18402db3.rlib" "/home/mjf/.multirust/toolchains/nightly-2016-03-17-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libcore-18402db3.rlib" "-l" "dns_sd" "-l" "pulse" "-l" "pulse-simple" "-l" "c" "-l" "m" "-l" "c" "-l" "dl" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "compiler-rt"
note: /home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libliblmdb_sys-1bd3eb46d33ffe48.rlib: error adding symbols: File format not recognized
collect2: error: ld returned 1 exit status

error: aborting due to previous error
       error Could not compile `librespot`.

Caused by:
  Process didn't exit successfully: `rustc src/main.rs --crate-name librespot --crate-type bin -C opt-level=3 --cfg feature="syntex" --cfg feature="discovery" --cfg feature="pulseaudio-backend" --cfg feature="dns-sd" --cfg feature="libpulse-sys" --out-dir /home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release --emit=dep-info,link --target arm-unknown-linux-gnueabihf -C linker=arm-linux-gnueabihf-gcc -L dependency=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release -L dependency=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps --extern url=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liburl-b19bdaef8ee79315.rlib --extern rand=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/librand-c724acb3942597d1.rlib --extern rustc_serialize=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/librustc_serialize-e1b49f9d5f55eb83.rlib --extern bit_set=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libbit_set-a823ac30a24665f6.rlib --extern json_macros=/home/mjf/librespot/target/release/deps/libjson_macros-f42f6262907f7f72.so --extern json_macros=/home/mjf/librespot/target/release/deps/libjson_macros-f42f6262907f7f72.rlib --extern log=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblog-0ec442df0ecb416b.rlib --extern libpulse_sys=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblibpulse_sys-57dae0ccc209957c.rlib --extern dns_sd=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libdns_sd-5fbf42147d134a59.rlib --extern byteorder=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libbyteorder-79579e11a5fc0173.rlib --extern shannon=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libshannon-77d59ac4b340cab9.rlib --extern rpassword=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/librpassword-a08ecebfabb402b5.rlib --extern libc=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblibc-036fbedefddee9e8.rlib --extern vorbis=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libvorbis-c68896280ab08303.rlib --extern librespot_protocol=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblibrespot_protocol-5c97aa522e0340cc.rlib --extern crypto=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libcrypto-f6a50638f37ed575.rlib --extern eventual=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libeventual-c4dbd620c3b99400.rlib --extern tempfile=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libtempfile-f39fcff7028e2b63.rlib --extern protobuf=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libprotobuf-28b5a8c52fd9fd28.rlib --extern hyper=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libhyper-0138d6aa106ddfd5.rlib --extern lazy_static=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblazy_static-553d4fa9dca2851d.rlib --extern lmdb_rs=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/liblmdb_rs-6131231dedf6f887.rlib --extern env_logger=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libenv_logger-927e8cf4058b3b7c.rlib --extern protobuf_macros=/home/mjf/librespot/target/release/deps/libprotobuf_macros-306e7c3289d9032d.so --extern protobuf_macros=/home/mjf/librespot/target/release/deps/libprotobuf_macros-306e7c3289d9032d.rlib --extern getopts=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libgetopts-1cab3df9d55a869b.rlib --extern time=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libtime-1b6cffb716aa17de.rlib --extern num=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libnum-a2e6e61627ca7fe5.rlib --extern librespot=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/liblibrespot.rlib -L native=/usr/lib/x86_64-linux-gnu -L native=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/shannon-sys-a7cfa3b8da240905/out -L native=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/vorbisfile-sys-274b40ec73b005a6/out -L native=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/vorbis-sys-d1f574d079a60890/out -L native=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/ogg-sys-ae5b224f8d433148/out -L native=/home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/rust-crypto-97872ea539a059cd/out -L /home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/build/liblmdb-sys-a2c241e21e41db6b/out` (exit code: 101)
japaric commented 8 years ago

note: /home/mjf/librespot/target/arm-unknown-linux-gnueabihf/release/deps/libliblmdb_sys-1bd3eb46d33ffe48.rlib: error adding symbols: File format not recognized

Sounds like this crate contains or was linked to a C dependency and said dependency was compiled for the host instead of for the target. The cause could be that the crate is linking to the system (i.e. the ones in /usr/lib) libraries instead of to the target libraries (i.e. the ones in /usr/$target/lib or wherever your distribution installs foreign libraries). Or it could that the crate is compiling a C library, as part of build.rs, using the wrong toolchain (i.e. cc instead of $target-cc).

Does any of your app dependencies wrap a C library? Do you have the cross compiled version of that C library installed in your system?

herrernst commented 8 years ago

lmdb-rs has a bug not really supporting cross-compiling: https://github.com/vhbit/lmdb-rs/issues/33