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

Apple M1芯片MacOS编译iroha_client_cli报错:Cargo.lock不存在

解决M1 Mac编译iroha_client_cli时Cargo.lock不存在的报错

针对你在M1芯片MacOS上编译iroha_client_cli遇到的/$HOME/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/Cargo.lock不存在报错,可尝试以下方案:

  • 确保当前工具链的rust-src组件完整安装
    你之前安装的是nightly版本的rust-src,但当前默认工具链是stable-aarch64,需对应安装:

    rustup component add rust-src --toolchain stable-aarch64-apple-darwin
    

    若仍有问题,先移除再重新安装:

    rustup component remove rust-src --toolchain stable-aarch64-apple-darwin
    rustup component add rust-src --toolchain stable-aarch64-apple-darwin
    
  • 强制指定RUST_SRC_PATH环境变量
    有些情况下构建脚本无法自动识别rust源码路径,手动设置后再编译:

    export RUST_SRC_PATH=$(rustc --print sysroot)/lib/rustlib/src/rust
    cargo build --bin iroha_client_cli
    
  • 验证iroha仓库子模块完整性
    智能合约相关依赖可能存在于子模块中,确保克隆或更新时拉取完整:
    若未克隆仓库:

    git clone --recurse-submodules https://github.com/hyperledger/iroha.git
    

    若已克隆仓库:

    git submodule update --init --recursive
    

    完成后进入项目目录重新编译。

  • 重置当前Rust工具链
    若以上方法无效,尝试完全卸载并重装当前stable工具链:

    rustup uninstall stable-aarch64-apple-darwin
    rustup install stable-aarch64-apple-darwin
    rustup component add rust-src --toolchain stable-aarch64-apple-darwin
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.07 01:11:13