Rust多个crate编译失败,因为权限被拒绝。

huangapple go评论68阅读模式
英文:

Rust multiple crates fail to compile due to permission denied

问题

当我构建一个带有依赖项的项目时,构建脚本会因权限被拒绝而失败。这不会发生在每个 crate 上。以下是尝试构建一个 WGPU 项目时的输出。

错误: 无法运行 `objc_exception v0.1.2` 的自定义构建命令

造成原因:
  进程没有成功退出: `/Users/64001830/wgpu-test/target/debug/build/objc_exception-f7c40ee498546635/build-script-build` (退出状态: 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

  发生错误: 命令 "/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,但仍然遇到相同的问题。

英文:

When I build a project with dependencies, the build script fails with permission denied. This dosent happen with every crate. Here is the output from when trying to build a WGPU project.

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" }

Ive tried restarting, new projects, uninstalling and reinstalling rust.

答案1

得分: 1

From the error (specifically this line: CC = Some("/usr/bin/")) you can see that the C compiler environment variable (CC) is set to /usr/bin/ which is not a valid C compiler.

You can either clear the environment variable or set it to something useful like /usr/bin/cc, /usr/bin/gcc or the path to your C compiler of choice.

英文:

From the error (specifically this line: CC = Some("/usr/bin/")) you can see that the C compiler environment variable (CC) is set to /usr/bin/ which is not a valid C compiler.

You can either clear the environment variable or set it to something useful like /usr/bin/cc, /usr/bin/gcc or the path to your C compiler of choice.

huangapple
  • 本文由 发表于 2023年2月14日 04:33:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/75440894.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定