website/templates/computers/rust-compilation.html

19 lines
933 B
HTML

<article>
<h2>Cross-Compiling Rust for Debian Buster on Raspberry Pi 3B+</h2>
<i>18 May, 2020</i>
<p>Install target platform:</p>
<code>rustup target add aarch64-unknown-linux-gnu</code>
<p>Install toolchain:</p>
<code>rustup toolchain install nightly-aarch64-unknown-linux-gnu</code>
<p>Install aarch64-linux-gnu-gcc:</p>
<code>sudo apt-get install gcc-aarch64-linux-gnu</code>
<p>Configure the linker*:</p>
<code>export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc</code>
<p>Compile release build:</p>
<code>cargo build --release --target=aarch64-unknown-linux-gnu</code>
<p>* Another approach is to create `cargo-config` in the root directory of the repo and add the following:</p>
<code>[target.aarch64-unknown-linux-gnu]</code><br>
<code>linker = "aarch64-linux-gnu-gcc"</code>
</article>
<hr>