This post is just an aside; As I mentioned in my last post, there is a compiler bug in LLVM that is resulting in incorrect code being generated for AVR with Rust. I made some vague assertions in a footnote about “just follow the directions and you’ll be fine” because I couldn’t remember how to do it, and then I ended up having to figure out how to rebuild my toolchain today. So I’m mostly posting these instructions for my own benefit, but maybe someone else will find them useful too.
- Download the patch file
- If this is your first time building
git clone https://github.com/rust-lang/rust; otherwise, go into your checked-out version of Rust and
git submodule update --init --recursive
git apply patch.diff, where
patch.diffis the file you downloaded in step 1.
mkdir build && cd build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ../llvm
cmake --build . -- -j24(or whatever number of build processes you want to run in parallel instead of 24)
./x.py build --stage 2 library/core library/proc_macro
rustup toolchain link stage2 build/x86_64-unknown-linux-gnu/stage2
And then you’re done! In your project directory, run
rustup override set stage2 to use the compiler you just built.