Skip to content

Instantly share code, notes, and snippets.

@stonehippo
Created July 26, 2025 14:18
Show Gist options
  • Save stonehippo/b44123d281c59f73855d31de0da1b146 to your computer and use it in GitHub Desktop.
Save stonehippo/b44123d281c59f73855d31de0da1b146 to your computer and use it in GitHub Desktop.
Notes on cross-compiling Rust on Raspberry Pi

Some Rust cross-compiling resources for Raspberry Pi

As I work on setting up a Pi Zero W as a little portable system for some lightweight dev, I'm running the challenge of compiling certain binaries on-system. To say that the Pi Zero W's resources are limited is an understatement; it can take days to compile something that might take minutes on a more robust system.

What I wanted was to cross-compile Microsoft Edit. I got it working by installing rust on my Raspberry Pi 400 with the 64-bit OS, then adding the appropriate target:

rustup target add arm-unknown-linux-gnueabihf

I also installed the right version of the GCC cross compiler toolchain. At first, I did this with apt, but that wasn't right: if I'm using 64-bit for the host, it's going to link a 64-bit version for the target.

Instead, I installed a GCC toolchain manually (see the link to ttpapa below), then set up armv6-rpi-linux-gnueabihf-gcc as the linker for the arm-unknown-linux-gnueabihf target in ~/.cargo/config.toml. This set up worked and I was able to compile and run Microsoft edit on the Pi Zero W!

Some resources on Rust packaging and cross compiling

From the Rust Book

Other tutorials and docs

Compilers and tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment