From 988dbac7ceb93507fe8c490fc934a4dadaefaf12 Mon Sep 17 00:00:00 2001 From: spekulatiusmensch <44848451+spekulatiusmensch@users.noreply.github.com> Date: Sat, 5 Feb 2022 01:52:35 +0100 Subject: [PATCH] Expand the guide for cross-compilation on Ubuntu/Debian --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 2a2ab66..8956a57 100644 --- a/README.md +++ b/README.md @@ -31,11 +31,25 @@ get too messy either. - Install Rust from https://rustup.rs/ - Run `rustup target add arm-unknown-linux-gnueabihf` - Install `sudo apt install libclang-dev` +- Build with `cargo build` ## Cross-compiling on Ubuntu/Debian - Install Rust from https://rustup.rs/ - Run `rustup target add arm-unknown-linux-gnueabihf` - Install `sudo apt install libclang-dev gcc-arm-linux-gnueabihf` +- Create the directory `.cargo` in the root of your Rust project and create a local cargo configuration file `config.toml` in it. +- Paste the following lines into `config.toml` to always build for the `arm-unknown-linux-gnueabihf` target, to use the GCC linker for this architecture and to set the sysroot so that the linker can find the necessary header files: +``` +[build] +target = "arm-unknown-linux-gnueabihf" + +[target.arm-unknown-linux-gnueabihf] +linker = "arm-linux-gnueabihf-gcc" + +[env] +RPI_WS281X_SYSROOT = "/usr/arm-linux-gnueabihf" +``` +- Build with `cargo build` ### AArch64 Builds - Run `rustup target add aarch64-unknown-linux-gnu`