1
votes

I am trying to cross compile a small rust application for the RPI. I am cross compiling because compiling directly on the PI takes way too long and it hits 75C.

I followed various instructions, but what I ended up doing is this:

  • Install "armv7-unknown-linux-gnueabihf" target with rustup
  • Download rpi tools from here: https://github.com/raspberrypi/tools
  • Add the "tools/arm-bcm2708/arm-linux-gnueabihf/bin/" folder to PATH
  • Add ".cargo/config" file with:
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
  • run "cargo build --target armv7-unknown-linux-gnueabihf --release"
  • scp the file to the RPI
  • chmod +x the_file
  • do "./the_file"

I get bash: ./the_file: No such file or directory

Yes, I am indeed in the right directory.

So this is the output from "file":

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, with debug_info, not stripped

I'm not experienced enough with this sort of stuff to determine if the binary that I produced is suitable to be run on an RPI3 B.

Did I produce the correct "type" of binary?

P.S. I am running DietPi distro on the PI. It is based on debian if that's of any relevance.

1

1 Answers

1
votes

So I solved this by cheating. I found https://github.com/rust-embedded/cross which took about 30 seconds to get going and now I can cross compile to pretty much anything. I highly recommend it!