rust - 跨平台编译
cargo build --target=x86_64-pc-windows-msvc
cargo build --target=x86_64-apple-darwin
cargo build --target=x86_64-unknown-linux-gnuhttps://juejin.cn/post/7325645956254351360
针对 Windows 平台,我们需要借助 cargo-xwin 工具及 LLVM 组件
error: no such command: `xwin`
help: a command with a similar name exists: `fix`
help: view all installed commands with `cargo --list`
help: find a package to install `xwin` with `cargo search cargo-xwin`解决
cargo install cargo-xwin没有配置目标平台
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`
For more information about this error, try `rustc --explain E0463`解决
bash
#安装目标平台 x86_64-pc-windows-msvc
$ rustup target add x86_64-pc-windows-msvc
#验证目标是否已安装
$ rustup target list --installed --- stderr
error occurred in cc-rs: failed to find tool "llvm-lib": No such file or directory (os error 2)brew install llvm