title: Compile a Rust program to an exe using an M1 mac?
body: <p>I have written a program in Rust on my M1 Mac, and compiled it to a Unix executable just fine. Now I want to compile it to a Windows executable as well. I first tried</p>
  <pre><code>$ cargo target add x86_64-pc-windows-gnu
  $ cargo build --release --target=x86_64-pc-windows-gnu
  </code></pre>
  <p>I got the error message:</p>
  <blockquote>
  <p>error: linker <code>x86_64-w64-mingw32-gcc</code> not found</p>
  </blockquote>
  <p>so I tried</p>
  <pre><code>$ brew install mingw-w64
  </code></pre>
  <p>according to <a href="https://users.rust-lang.org/t/cross-compile-macos-and-ms-windows/38323/2" rel="nofollow noreferrer">this</a>, and got the error:</p>
  <blockquote>
  <p>Error: mingw-w64: no bottle available!</p>
  </blockquote>
  <p>I looked on <a href="https://formulae.brew.sh/formula/mingw-w64" rel="nofollow noreferrer">formulae.brew.sh</a> and it seems that <code>mingw-w64</code> isn't supported for M1, only Intel.</p>
  <p>How can I compile an exe from rust using my M1 Mac?</p>