为 M1 上的所有平台构建 Tauri

Build Tauri for all platforms on M1

有没有办法在我的 macbook pro m1 上构建 Windows 和 Linux 版本的 Tauri?我已经尝试过 --target 我只是在构建时遇到错误。

yarn run v1.22.15
$ tauri build -t x86_64-pc-windows-msvc
   Compiling proc-macro2 v1.0.36
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.86
   Compiling libc v0.2.119
   Compiling cfg-if v1.0.0
   Compiling serde_derive v1.0.136
   Compiling serde v1.0.136
   Compiling ppv-lite86 v0.2.16
   Compiling siphasher v0.3.9
   Compiling getrandom v0.1.16
   Compiling winapi v0.3.9
error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-pc-windows-msvc` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-pc-windows-msvc`

error[E0463]: can't find crate for `compiler_builtins`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: build failed
Error running CLI: failed to build app: Result of `cargo build` operation was unsuccessful: exit status: 101
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

截至撰写本文时,Tarui 仍在 v1-rc 中,因此情况可能会发生变化。

根据文档,不支持在一台机器上编译所有三个 os,但可以通过 VM 或 Github 操作来完成。

来自docs

Cross-platform compilation is not supported at this moment. If you want to produce binaries for all three operating systems, you can use Virtual Machines or a CI service like GitHub Actions.