[SOLVED] Can't find crate for `std`


#1

I’m trying to build a package for ARM, and I’m getting a curious error that prevents it from compiling. The complete error is the following:

   Compiling winapi-build v0.1.1
   Compiling libc v0.1.12
   Compiling wiringpi v0.1.2
   Compiling libc v0.2.4
/home/razican/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/libc-0.1.12/rust/src/liblibc/lib.rs:1:1: 1:1 error: can't find crate for `std` [E0463]
/home/razican/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/libc-0.1.12/rust/src/liblibc/lib.rs:1 // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
                                                                                                                                ^
error: aborting due to previous error
Build failed, waiting for other jobs to finish...
/home/razican/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/libc-0.2.4/src/lib.rs:1:1: 1:1 error: can't find crate for `std` [E0463]
/home/razican/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/libc-0.2.4/src/lib.rs:1 // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
                                                                                                                  ^
error: aborting due to previous error
Could not compile `libc`.

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

I cannot really understand how it does not find std :confused:


#2

The std library is a separate component now. Observe rustc installation progress.

install: installing component 'rustc'
install: installing component 'rust-std-x86_64-unknown-linux-gnu'
install: installing component 'rust-docs'
install: installing component 'cargo'

Note the absence of rust-std-arm-unknown-linux-gnueabi. I don’t know how to make multirust install that :frowning: but you can download it manually from http://static.rust-lang.org/dist/


#3

Where should I download it? I have put arm-unknown-linux-gnueabihf in ~/.multirust/toolchains/stable/lib/rustlib but it seems it does not find it :confused: It is compiled where the pi-rust is as per the tutorial here: https://github.com/Ogeon/rust-on-raspberry-pi.


#4

Did you use one of the cross scripts from the guide, to compile your project?


#5

Sure, btw, don’t see the difference between 64 bit tools and 32 bit tools :confused: could this be an issue?

I updated wiringpi to the latest git version and now it gives this big error:

error: linking with `cc` failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-L" "/home/razican/workspace/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o" "-o" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug" "-L" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/deps" "-L" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/build/wiringpi-7f5ce02fa814e66f/out" "-L" "/home/razican/workspace/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib" "-L" "/home/razican/workspace/openstratos/openstratos-rs/.rust/lib/arm-unknown-linux-gnueabihf" "-L" "/home/razican/workspace/openstratos/openstratos-rs/lib/arm-unknown-linux-gnueabihf" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/deps/libfern-688fe53c5a404014.rlib" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/deps/libtime-b8d9c9e7ca5bced7.rlib" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/deps/libserial-6da77df4a46e5e40.rlib" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/deps/libtermios-92aeb60d2e76d4c0.rlib" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/deps/libioctl_rs-ce17e55dd868f3a4.rlib" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/deps/libwiringpi-7f5ce02fa814e66f.rlib" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/deps/liblog-db195e915b7f1b50.rlib" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/deps/liblibc-53b3109cf33a6ace.rlib" "/home/razican/workspace/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libstd-bb943c5a.rlib" "/home/razican/workspace/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libcollections-bb943c5a.rlib" "/home/razican/workspace/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib/liballoc-bb943c5a.rlib" "/home/razican/workspace/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib/liballoc_jemalloc-bb943c5a.rlib" "/home/razican/workspace/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib/liblibc-bb943c5a.rlib" "/home/razican/workspace/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib/librand-bb943c5a.rlib" "/home/razican/workspace/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib/librustc_unicode-bb943c5a.rlib" "/home/razican/workspace/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libcore-bb943c5a.rlib" "-l" "c" "-l" "dl" "-l" "pthread" "-l" "gcc_s" "-l" "rt" "-l" "pthread" "-l" "c" "-l" "m" "-l" "compiler-rt"
note: /usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: Relocations in generic ELF (EM: 40)
/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/debug/openstratos.0.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status

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

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

Which seems to be due to Rust trying to add debugging symbols. If I do it in --release mode, I get the error shown above:

   Compiling libc v0.2.4
   Compiling winapi v0.2.5
   Compiling winapi-build v0.1.1
   Compiling wiringpi v0.1.2 (https://github.com/Ogeon/rust-wiringpi.git#9517adcd)
   Compiling kernel32-sys v0.2.1
/home/razican/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/libc-0.2.4/src/lib.rs:1:1: 1:1 error: can't find crate for `std` [E0463]
/home/razican/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/libc-0.2.4/src/lib.rs:1 // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
                                                                                                                  ^
error: aborting due to previous error
Build failed, waiting for other jobs to finish...
/home/razican/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/winapi-0.2.5/src/lib.rs:1:1: 1:1 error: can't find crate for `std` [E0463]
/home/razican/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/winapi-0.2.5/src/lib.rs:1 // Copyright © 2015, Peter Atashian
                                                                                                                    ^
error: aborting due to previous error
Could not compile `libc`.

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

#6

The 32 bit version uses a 32 bit version of gcc and it’s there for those who has a 32 bit host machine. That’s all. Those scripts should include the cross compiled libstd in your linking path. Are you 100% sure they are in the ~/pi-rust directory?


#7

I have manually done what it’s written in those files so that pi-rust/bin is in PATH and pi-rust/lib is in LD_LIBRARY_PATH. Now I only get the ld issue, but I still get it even if I’m compiling it in --release mode :confused:

In any case, it’s a bit troublesome if I have to manually export the paths.


#8

That’s really strange, and I haven’t been able to trigger those errors, myself. Try to only cross compile the WiringPi crate, to begin with. I know that it should work, so that should tell if it’s independent of what you are compiling.


#9

The wiringpi crate builds correctly, I’ve published my changes here: https://github.com/OpenStratos/OpenStratos-rs


#10

Your cross64 script uses $HOME/workspace/pi-rust. I changed it to $HOME/pi-rust and it built without errors.


#11

I had the pi-rust and pi-tools in $HOME/workspace. In any case, I did all the tutorial again, compiling Rust and everything, and put it in $HOME just as the tutorial showed, step by step, and changed the cross64 and cross32 executables for the ones in the repo but I still get the LD issue, even in --release mode :confused:

The error is this one:

error: linking with `cc` failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-L" "/home/razican/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/release/openstratos.0.o" "-o" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/release/openstratos" "-Wl,--gc-sections" "-pie" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/release" "-L" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/release/deps" "-L" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/release/build/wiringpi-7f5ce02fa814e66f/out" "-L" "/home/razican/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/release/deps/libfern-bd0b1a3d99fff234.rlib" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/release/deps/libtime-22c21fe32894ddad.rlib" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/release/deps/libserial-6da77df4a46e5e40.rlib" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/release/deps/libtermios-6d636028f8f9eac8.rlib" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/release/deps/libioctl_rs-9de67ae46ebae878.rlib" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/release/deps/libwiringpi-7f5ce02fa814e66f.rlib" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/release/deps/liblog-0b1f2bad29d31333.rlib" "/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/release/deps/liblibc-adb8b8e7aaa2f93f.rlib" "/home/razican/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libstd-71b07a99.rlib" "/home/razican/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libcollections-71b07a99.rlib" "/home/razican/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib/liballoc-71b07a99.rlib" "/home/razican/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib/liballoc_jemalloc-71b07a99.rlib" "/home/razican/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib/liblibc-71b07a99.rlib" "/home/razican/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib/librand-71b07a99.rlib" "/home/razican/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib/librustc_unicode-71b07a99.rlib" "/home/razican/pi-rust/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libcore-71b07a99.rlib" "-l" "c" "-l" "dl" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "compiler-rt"

Then I get a bunch of these:

/usr/bin/ld: /home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/release/openstratos.0.o: Relocations in generic ELF (EM: 40)

And finally this:

/home/razican/workspace/openstratos/openstratos-rs/target/arm-unknown-linux-gnueabihf/release/openstratos.0.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status

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

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

So it seems that I have some problem with the linker.


#12

So it seems. The fact that it uses /usr/bin/ld makes me wonder if you are really setting it up correctly, though.


#13

I set up the build in travis just to be sure, and here it is:
https://travis-ci.org/OpenStratos/OpenStratos-rs/jobs/104077026

It gives the same error.


#14

That’s a quite different setup, and I don’t think it should be linking with /usr/bin/ld.


#15

I got that setup from the libc compiler script, and in my computer I use the one provided by the tutorial, so it seems it doesn’t have anything to do with the setup.


#16

Are you sure this part of Cargo.toml is in effect?

[target.arm-unknown-linux-gnueabihf]
ar = "arm-linux-gnueabihf-gcc-ar"
linker = "arm-linux-gnueabihf-gcc"

I mean, since it links with cc instead.


#17

How can I check it?


#18

You could remove it and see if anything changes. The way I understand it is that it belongs in a .cargo file.


#19

OK, that was it! fixed!! Thanks!!!