Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- * Step 0: Our target is an ARMv7 device, the triple for this target is `armv7-unknown-linux-gnueabihf`
- * Step 1: Install the C cross toolchain
- ```
- $ sudo apt-get install -qq gcc-arm-linux-gnueabihf
- ```
- * Step 2: Install the cross compiled standard crates
- ```
- $ rustup target add armv7-unknown-linux-gnueabihf
- ```
- * Step 3: Configure cargo for cross compilation
- ```
- $ mkdir -p ~/.cargo
- $ cat >>~/.cargo/config <<EOF
- > [target.armv7-unknown-linux-gnueabihf]
- > linker = "arm-linux-gnueabihf-gcc"
- > EOF
- ```
- * Test cross compiling a Cargo project
- ```
- $ cargo new --bin hello
- $ cd hello
- $ cargo build --target=armv7-unknown-linux-gnueabihf
- Compiling hello v0.1.0 (file:///home/ubuntu/hello)
- $ file target/armv7-unknown-linux-gnueabihf/debug/hello
- ```
Add Comment
Please, Sign In to add comment