Cross-compiling Rust from Windows to ARM Linux
<p>I'm using Windows 10. I would like to cross-compile a Rust program to run on <code>armv7-unknown-linux-gnueabihf</code>. (<code>armv7-unknown-linux-muscl</code> would also be acceptable but it doesn't seem to be available.)</p>

<p>Here are my steps:</p>

<ol>
<li>Install <code>rustup</code></li>
<li><code>rustup toolchain install stable-x86_64-pc-windows-gnu</code></li>
<li><code>rustup toolchain default stable-x86_64-pc-windows-gnu</code></li>
<li><code>rustup target add armv7-unknown-linux-gnueabihf</code></li>
<li><p>Edit my <code>./cargo/config</code> file to contain:</p>

<pre><code>[build]
target = "armv7-unknown-linux-gnueabihf"
</code></pre></li>
<li><p><code>cargo build</code></p></li>
</ol>

<p>This compiles everything fine, but when it comes to linking it gives this error:</p>

<pre class="lang-none prettyprint-override"><code>error: could not exec the linker `cc`: The system cannot find the file specified. (os error 2)
</code></pre>

<p>As far as I have been able to determine, this is because Rust doesn't have its own linker and uses GCC instead. Apparently I need to provide this myself and add this to the <code>./cargo/config</code> file:</p>

<pre><code>[target.armv7-unknown-linux-gnueabihf]
linker = "c:/path/to/my/gcc/cross/compiler"
</code></pre>

<p>Is that right? If so where on Earth can I download such a cross-compiler for Windows and why doesn't <code>rustup</code> install it? Having to compile a cross-compiling version of GCC yourself is the biggest pain of cross-compiling C/C++ programs. Does Rustup really not make this any easier?</p>