Cargo 运行不工作 - 可执行文件中的 CPU 类型错误(操作系统错误 86)

问题描述 投票:0回答:1

cargo
昨天工作得很好。今天我开始了一个新项目并且
cargo build
工作了。但
cargo run
似乎不起作用。

cargo run

error: could not execute process `rustc -vV` (never executed)

Caused by:
  Bad CPU type in executable (os error 86)

知道发生了什么吗?我使用的是配备 intel 芯片和 Ventura OS 的 2018 Mac

我尝试过 - Mac Intel:zsh:可执行文件中的 CPU 类型错误:rustup 但它不起作用

rust rust-cargo
1个回答
0
投票

当尝试运行或编译不是为 ARM 架构构建的软件时,通常会在 Apple M1 Mac 上发生该错误。要解决此问题,您可能需要安装 Rosetta 2,它允许您运行为 Apple Silicon 上的英特尔处理器构建的应用程序:

softwareupdate --install-rosetta
# Or to skip the license:
softwareupdate --install-rosetta --agree-to-license
© www.soinside.com 2019 - 2024. All rights reserved.