我在我的 M1 Mac 上用 Rust 编写了一个程序,并将其编译为 Unix 可执行文件。现在我也想将它编译为 Windows 可执行文件。我第一次尝试
$ cargo target add x86_64-pc-windows-gnu
$ cargo build --release --target=x86_64-pc-windows-gnu
Run Code Online (Sandbox Code Playgroud)
我收到错误消息:
错误:
x86_64-w64-mingw32-gcc找不到链接器
所以我尝试了
$ brew install mingw-w64
Run Code Online (Sandbox Code Playgroud)
根据这个,并得到错误:
错误:mingw-w64:没有可用的瓶子!
我查看了Formulae.brew.sh,似乎mingw-w64不支持 M1,仅支持 Intel。
如何使用我的 M1 Mac 从 Rust 编译 exe?