Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand the guide for cross-compilation on Ubuntu/Debian #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down