当我构建具有依赖项的项目时,构建脚本因权限被拒绝而失败。每个板条箱都不会发生这种情况。这是尝试构建 WGPU 项目时的输出。
error: failed to run custom build command for `objc_exception v0.1.2`
Caused by:
process didn't exit successfully: `/Users/64001830/wgpu-test/target/debug/build/objc_exception-f7c40ee498546635/build-script-build` (exit status: 1)
--- stdout
TARGET = Some("x86_64-apple-darwin")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-apple-darwin")
cargo:rerun-if-env-changed=CC_x86_64-apple-darwin
CC_x86_64-apple-darwin = None
cargo:rerun-if-env-changed=CC_x86_64_apple_darwin
CC_x86_64_apple_darwin = None
cargo:rerun-if-env-changed=HOST_CC
HOST_CC = None
cargo:rerun-if-env-changed=CC
CC = Some("/usr/bin/")
cargo:rerun-if-env-changed=CFLAGS_x86_64-apple-darwin
CFLAGS_x86_64-apple-darwin = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_apple_darwin
CFLAGS_x86_64_apple_darwin = None
cargo:rerun-if-env-changed=HOST_CFLAGS
HOST_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("cmpxchg16b,fxsr,llvm14-builtins-abi,sse,sse2,sse3,ssse3")
running: "/usr/bin/" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-arch" "x86_64" "-Wall" "-Wextra" "-o" "/Users/64001830/wgpu-test/target/debug/build/objc_exception-59a44c9c89f7e2b5/out/extern/exception.o" "-c" "extern/exception.m"
--- stderr
error occurred: Command "/usr/bin/" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-arch" "x86_64" "-Wall" "-Wextra" "-o" "/Users/64001830/wgpu-test/target/debug/build/objc_exception-59a44c9c89f7e2b5/out/extern/exception.o" "-c" "extern/exception.m" with args "bin" failed to start: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
我尝试过重新启动、新项目、卸载并重新安装 Rust。
从错误(特别是这一行:
CC = Some("/usr/bin/")
)中,您可以看到 C 编译器环境变量 (CC
) 设置为 /usr/bin/
,这不是有效的 C 编译器。
您可以清除环境变量或将其设置为有用的内容,例如
/usr/bin/cc
、/usr/bin/gcc
或您选择的 C 编译器的路径。