Partial migration of cross-compilation from cross to Cargo.
This commit is contained in:
@@ -6,21 +6,28 @@
|
||||
|
||||
## Install ARM toolchains:
|
||||
|
||||
```
|
||||
cargo install cross
|
||||
rustup target add aarch64-unknown-linux-gnu # 64-bit Pi OS
|
||||
rustup target add armv7-unknown-linux-gnueabihf # 32-bit Pi 2/3/4 OS
|
||||
rustup target add arm-unknown-linux-gnueabihf # ARMv6 (Pi Zero/1)
|
||||
```bash
|
||||
$ rustup target add aarch64-unknown-linux-gnu
|
||||
$ rustup target add arm-unknown-linux-gnueabihf
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf
|
||||
|
||||
$ sudo dpkg --add-architecture arm64
|
||||
$ sudo dpkg --add-architecture armhf
|
||||
|
||||
$ sudo apt update
|
||||
$ sudo apt-get install gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf \
|
||||
libc6-arm64-cross libc6-dev-arm64-cross gcc-aarch64-linux-gnu \
|
||||
libc6-armhf-cross libc6-dev-armhf-cross gcc-arm-linux-gnueabihf \
|
||||
libssl-dev libssl-dev:arm64 libsdl3-dev:arm64 libssl-dev:armhf libsdl3-dev:armhf
|
||||
```
|
||||
|
||||
## Cross-compile
|
||||
|
||||
```
|
||||
# 2) Build
|
||||
~/.cargo/bin/cross build --target aarch64-unknown-linux-gnu --release
|
||||
~/.cargo/bin/cross build --target armv7-unknown-linux-gnueabihf --release
|
||||
~/.cargo/bin/cross build --target arm-unknown-linux-gnueabihf --release
|
||||
ARM64
|
||||
```bash
|
||||
$ export PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu/
|
||||
$ cargo build --target aarch64-unknown-linux-gnu --release
|
||||
|
||||
$ export PKG_CONFIG_SYSROOT_DIR=/usr/arm-linux-gnueabihf/
|
||||
$ cargo build --target arm-unknown-linux-gnueabihf --release
|
||||
```
|
||||
Reference in New Issue
Block a user