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

搭建Anchor首个项目时遭遇rustc版本不兼容错误求助

解决Solana环境中rustc版本与bytemuck_derive不兼容问题

错误信息

error: rustc 1.79.0-dev is not supported by the following package:

Note that this is the rustc version that ships with Solana tools and not your system's rustc version. Use `solana-install update` or head over to https://docs.solanalabs.com/cli/install to install a newer version.

bytemuck_derive@1.9.2 requires rustc 1.84
Either upgrade rustc or select compatible dependency versions with
cargo update <name>@<current-ver> --precise <compatible-ver>
where <compatible-ver> is the latest version supporting rustc 1.79.0-dev

解决方案

方案1:升级Solana附带的rustc版本

  • 执行命令更新Solana工具链:
    solana-install update
    
    该命令会同步更新Solana CLI及其内置的rustc版本,使其满足bytemuck_derive@1.9.2对rustc 1.84的要求。
  • 若更新后问题仍存在,可尝试重新安装Solana CLI,确保获取完整的最新环境。

方案2:降级bytemuck_derive到兼容版本

  • 先确认支持rustc 1.79.0-dev的bytemuck_derive最新版本(例如1.5.x系列版本通常兼容旧版rustc)。
  • 执行命令锁定兼容版本:
    cargo update bytemuck_derive@1.9.2 --precise 1.5.0
    
  • 或直接在Cargo.toml中手动指定版本:
    bytemuck_derive = "=1.5.0"
    
    之后执行cargo build重新编译项目。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.13 17:32:36