Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Crosscompiling Rust to Arm

I want to write Rust code on my computer (x86_64, Ubuntu 14.04) and produce arm executables. I found hints on the internet, but not a concise set of instructions on what to do. So I wrote them down exactly:

apt-get install g++-arm-linux-gnueabihf
git clone https://github.com/mozilla/rust.git
mkdir rust/build-cross
cd rust/build-cross
../configure --target=arm-unknown-linux-gnueabihf --prefix=$HOME/local/rust-cross
make -j8 && make install

Invoke it like this:

PATH=$HOME/local/rust-cross:$PATH rustc -C linker=/usr/bin/arm-linux-gnueabihf-gcc -C target=arm-unknown-linux-gnueabihf test.rs
@MrAndMrsK

This comment has been minimized.

Copy link

commented Oct 25, 2015

Thanks! I built successfully using this but I get this when testing out the rust-cross:

rustbuild@rustbuild-VirtualBox:~/local/rust-cross/bin$ ./rustc helloworld.rs
./rustc: error while loading shared libraries: librustc_driver-bb943c5a.so: cannot open shared object file: No such file or directory

whereas rustc helloworld.rs (not ./rustc) builds it correctly, but for the current intel architecture.

Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.