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
相关产品推荐
相关产品推荐

