How to use cross compile
-
Add target aarch64-unknown-linux-musl
rustup target add aarch64-unknown-linux-musl
-
Download a musl cross-compiler
wget https://musl.cc/aarch64-linux-musl-cross.tgz
-
Extract it
tar xvzf aarch64-linux-musl-cross.tgz
-
Add it to your path -- this must be done every time you start a new shell
export PATH=$(pwd)/aarch64-linux-musl-cross/bin:$PATH
-
Build the project
CFLAGS_aarch64_unknown_linux_musl=-mno-outline-atomics \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-musl-gcc \
cargo build \
--target aarch64-unknown-linux-musl