Previous: USB Serial Mod

Building Rust

I’ve compiled the Rust compiler a lot of times now. That’s necessary because the AVR fork of Rust is not officially supported, and the fork does not distribute a release.

It’s been a huge pain, and very often I find myself unable to compile it for one reason or another (wrong branch, mismatching compiler versions, etc.). To relieve myself (and hopefully others), I’ve created a Docker image designed with the ability to reliably compile Rust. It’s on Docker Hub.


It’s super easy, and requires no setup besides cloning the Rust repository of your choice. If you’re in the clone, simply run:

$ docker run --mount "type=bind,src=$PWD,dst=/rust" --rm jonahbron/rust-builder

This will download the container image from Docker Hub and run your source’s x.py script. Once it’s completed, you’ll have a nice shiny build of the Rust compiler.

However, I’ve taken it one additional step further. To make it especially easy to build AVR Rust (which is what I specifically want), I’ve created a slightly more specialized derivitive container image.


This image is even easier to use. You don’t even need to clone the code repository, the image has already done it for you. Simply run:

$ mkdir -p build && docker run --mount "type=bind,src=$PWD/build,dst=/rust/build" jonahbron/avr-rust-builder

This will create a build directory and send the build output there. If you find yourself needing to build Rust from source, I hope you find these tools as helpful as I do. You can always double-check the Dockerfiles in the images' respective (public) Github repos to make sure everything’s above board.

Next: This does not end well

Creative Commons License