问题描述
我正在尝试在 Windows 上使用生锈的 bevy 游戏引擎。我的机器上安装了 x86_64-mingw
。
我已将 Rust 工具链默认设置为 x86_64-pc-windows-gnu
。我将 bevy = "0.4.0"
放在 Cargo.toml
中的依赖项下。
我尝试了 cargo build
,但出现以下错误
error: Failed to run custom build command for `syn v1.0.63`
Caused by:
Could not execute process `C:\Users\USERNAME\Projects\rust-game\target\debug\build\syn-a158346a8e8b6be7\build-script-build` (never executed)
Caused by:
Access is denied. (os error 5)
warning: build Failed,waiting for other jobs to finish...
error: build Failed
Compiling proc-macro2 v1.0.24
Compiling syn v1.0.63
Compiling serde_derive v1.0.124
Compiling serde v1.0.124
error: Failed to run custom build command for `proc-macro2 v1.0.24`
Caused by:
Could not execute process `C:\Users\USERNAME\Projects\rust-game\target\debug\build\proc-macro2-a1d2a8cf734884f9\build-script-build` (never exe
cuted)
Caused by:
Access is denied. (os error 5)
warning: build Failed,waiting for other jobs to finish...
error: build Failed
解决方法
我尝试编译一个使用 bevy = "0.4.0"
的项目,并且能够使用 stable-x86_64-pc-windows-msvc
工具链进行构建,但无法使用 stable-x86_64-pc-windows-gnu
。
就我而言,bevy-glsl-to-spirv
是未能构建的板条箱。在 bevy book 上指定您必须安装 VS 构建工具 2019。他们没有明确说您必须使用 msvc
工具链,但由于他们要求您安装 VS 构建工具 2019,我猜您必须使用 stable-x86_64-pc-windows-msvc
编译代码。
您可以下载 VS 构建工具 2019 here。
还要确保您安装了 stable-x86_64-pc-windows-msvc
工具链:
rustup toolchain install stable-x86_64-pc-windows-msvc
将此工具链设置为默认工具链。
rustup default stable-x86_64-pc-windows-msvc
最后,确保已安装工具链并将其设置为默认工具链:
rustup toolchain list
你应该看到:
stable-x86_64-pc-windows-gnu
stable-x86_64-pc-windows-msvc (default)
尝试cargo build
,它应该像魅力一样发挥作用。