运行 Cargo build-bpf 时出现 Rust 版本问题

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

我正在尝试在基本的启动 Rust 程序上运行

cargo build-bpf

我使用curl命令安装了Rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

当我跑步时

cargo --version
我得到
cargo 1.75.0 (1d8b05cdd 2023-11-20)
。 当我跑步时
rustc --version
我得到
rustc 1.75.0 (82e1608df 2023-12-21)

但是在我的项目目录中,当我运行

cargo build-bpf
时,我收到一条错误消息:

error: package `package` cannot be built because it requires rustc 1.72.0 or newer, while the currently active rustc version is 1.68.0-dev

使用版本

1.68.0-dev
怎么样?我尝试运行
rustup update
但仍然收到
1.68.0-dev
错误?

rust rust-cargo rustup
1个回答
0
投票

我运行了

solana-install update
,它说“安装是最新的”。

再次运行

cargo build-bpf
并出现错误:

error: package `solana-program v1.18.1` cannot be built because it requires rustc 1.72.0 or newer, while the currently active rustc version is 1.68.0-dev
Either upgrade to rustc 1.72.0 or newer, or use
cargo update -p [email protected] --precise ver
where `ver` is the latest version of `solana-program` supporting rustc 1.68.0-dev

为了修复它,我运行了以下命令:

solana-install init 1.18.1
,然后当我再次运行
cargo build-bpf
时,它起作用了。

© www.soinside.com 2019 - 2024. All rights reserved.