You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

M1芯片Mac运行anchor build报错:已装要求rustc版本仍提示过时

M1 Mac下anchor build rustc版本不匹配问题解决

问题现象

搭载M1芯片的Mac运行anchor build时提示rustc版本过时,但本地全局rustc版本已满足要求:

solana % rustc --version
rustc 1.68.0....
solana % anchor build
BPF SDK: .../.local/share/solana/install/releases/1.9.29/solana-release/bin/sdk/bpf
cargo-build-bpf child: rustup toolchain list -v
cargo-build-bpf child: cargo +bpf build --target bpfel-unknown-unknown --release
error: package `anchor-attribute-constant v0.27.0` cannot be built because it requires rustc 1.60 or newer, while the currently active rustc version is 1.59.0-dev

尝试过以下命令未解决:

solana-install update

sh -c "$(curl -sSfL https://release.solana.com/v1.9.13/install)"

solana-install init 1.9.13

解决步骤

  1. 卸载旧版Solana
    旧版Solana(1.9.x)的BPF SDK绑定的rustc版本过低,无法兼容Anchor 0.27.0,先执行卸载:
solana-install uninstall
  1. 安装兼容版本的Solana
    Anchor 0.27.0要求Solana版本至少为1.14.16,执行对应安装命令:
sh -c "$(curl -sSfL https://release.solana.com/v1.14.16/install)"
  1. 更新rust工具链
    确保bpf工具链版本符合要求:
rustup update
rustup toolchain install bpf
  1. 重新运行anchor build
    回到项目目录执行:
anchor build

内容的提问来源于stack exchange,提问作者bernardo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 18:17:16