Beaglebone black cross compile


#1

Hi there!

I’m new to rust but I’m planning to use it in an application of embedded linux, of which I’m also new too. :frowning:
My goal is to have a conrod interface for showing the data of a few sensors and adding a few controls for motors… anyways! :slight_smile:

I’m trying to get cross-compilation work, but I can’t build my applications with cargo, even with

[target.arm-unknown-linux-gnueabihf]
linker=“arm-linux-gnueabihf-gcc”

in my toml file. I do

cargo build --target arm-unknown-linux-gnueabihf

and it fails with a linker error.
When I compile it with

rustc -C linker=arm-linux-gnueabihf-gcc --target arm-unknown-linux-gnueabihf main.rs

it’s fine, i get the executable.

I’m not sure if rustc would still compile if I manually tell it which files to link, mostly because I don’t know how.

Thanks for your help!


#2

In which file did you add the [target.arm-unknown-linux-gnueabihf] section? That goes in .cargo/config, not Cargo.toml.

What’s the exact linker error?

You might also want to check out https://github.com/japaric/cross.


#3

Oooooh, thank you!

I don’t know how I missed that it should be in .cargo/config. I’ve been reading the configuration page for ages.
Now it works! :blush: