Closed jwilm closed 8 years ago
I'll post something more substantial in the morning. However this sounds like an issue with the arm-linux-gnueabihf-gcc linker your distribution ships. My guess is it's a newer Ubuntu and the linker was built with a relatively recent glibc. Unfortunately the default Rasbian is quite old and the glibc is rather outdated. Additionally the ARM cross linker for Ubuntu targets armv7 by default, so you'd likely end up with segmentation faults even if the glibc version wasn't an issue.
There are two solutions to this problem. The first is to run a container with Debian Wheezy (the same version that Rasbian is built on) with the Raspberry Pi cross linker installed. https://github.com/raspberrypi/tools. Running a Rust cross compiler with that linker in that container will give you glibc 2.13 compatible compilations for armv6. If you're comfortable with Docker, I currently have a test image that I put together for issue #5. https://hub.docker.com/r/sothr/rustbuild/
The other option is to update the OS on your Raspberry Pi to one that has glibc 2.18+. I believe that the Rasbian distribution based on Debian Jessie uses glibc 2.19.
Im working on some cross compiling guides to help clarify and resolve these issues in the future.
The linker was my primary suspect as well. I'll check out the Rasbian release you mentioned and report back.
Thanks!
As you imagined, the program seg faults on the device. ldd
is happy with it now, though. I'm going to build a cross toolchain to target armv6 and see if that fixes the remaining issue.
Success! I built an arm-unknown-linux-gnueabihf
toolchain using crosstool-ng. I pointed the cargo linker config for that triplet to the newly built gcc. After that, the executables I produce run on the pi.
Cross compiling for armv6 raspbian in summary
Thanks for the help.
Glad you got it working!
The guide at https://github.com/japaric/ruststrap/blob/master/1-how-to-cross-compile.md had me producing cross compiled executables using the armv6hf rust binaries found in this repo. However, the executable doesn't run on my raspberry pi B with raspbian. Raspbian has glibc
2.13-38+rpi2+deb7u8
, but the runtime linker complains about not having GLIBC_2.18. Building executables on the pi works as expected. It sounds like the armv6 binaries you produce are built with glibc 2.13. I guess the main problem is that somehow there's a different glibc involved (maybe due to host rustc?).My host machine is x86_64 linux with
rustc 1.3.0 (9a92aaf19 2015-09-15)
installed with multirust. glibc version for armhf is2.19-0ubuntu2cross1.104
. The arm libraries are installed at~/.multirust/toolchains/stable/lib/rustlib/arm-unknown-linux-gnueabihf
. I'm linking with ubuntu'sarm-linux-gnueabihf-gcc
. The target (rpi B with raspbian) has the armv6 binaries installed using multirust at~/.multirust/toolchains/stable/lib/rustlib/arm-unknown-linux-gnueabihf/
.Kinda lost here and hoping you have some ideas.
Thanks!