Guest User

Untitled

a guest
Dec 17th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. * Step 0: Our target is an ARMv7 device, the triple for this target is `armv7-unknown-linux-gnueabihf`
  2.  
  3. * Step 1: Install the C cross toolchain
  4. ```
  5. $ sudo apt-get install -qq gcc-arm-linux-gnueabihf
  6. ```
  7.  
  8. * Step 2: Install the cross compiled standard crates
  9. ```
  10. $ rustup target add armv7-unknown-linux-gnueabihf
  11. ```
  12.  
  13. * Step 3: Configure cargo for cross compilation
  14. ```
  15. $ mkdir -p ~/.cargo
  16. $ cat >>~/.cargo/config <<EOF
  17. > [target.armv7-unknown-linux-gnueabihf]
  18. > linker = "arm-linux-gnueabihf-gcc"
  19. > EOF
  20. ```
  21.  
  22. * Test cross compiling a Cargo project
  23. ```
  24. $ cargo new --bin hello
  25. $ cd hello
  26. $ cargo build --target=armv7-unknown-linux-gnueabihf
  27. Compiling hello v0.1.0 (file:///home/ubuntu/hello)
  28. $ file target/armv7-unknown-linux-gnueabihf/debug/hello
  29. ```
Add Comment
Please, Sign In to add comment