I experienced problems when building Solana CLI 1.18.7 with Rust
When I run cargo build-sbf an error appears:
error: package bumpalo v3.15.4 cannot be built because it requires rustc 1.73.0 or newer, while the currently active rustc version is 1.72.0-dev
Either upgrade to rustc 1.73.0 or newer, or use
cargo update -p [email protected] --precise ver
where ver is the latest version of bumpalo supporting rustc 1.72.0-dev
It assumes currently active rustc version 1.72.0-dev, when I run rustup -V
rustup 1.27.0 (bbb9276d2 2024-03-08)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active rustc version is rustc 1.76.0 (07dca489a 2024-02-04)
This is the same when I run rustc -V currently active rustc version is 1.76.0.
When I downgrade Solana CLI, error package bumpalo detect rustc active version is 1.68.0.
How could this happen? Then how can I continue building Solana
The repository probably has a
rust-toolchain.tomlfile which pins a compiler version, thus whyrustup/rustc/cargo --versionreports different active toolchain versions in different directories.If you have installed rust via rustup (which appears to be the case), you can specify a toolchain override on CLI like so:
cargo +<TOOLCHAIN> <COMMAND>, in your case, trycargo +stable build-sbf. Alternatively, there is theRUSTUP_TOOLCHAINenvironment variable you can set, which might be more convenient if you are writing a CI script for example.All this is well documented in rust's official documentation.