Agenda
現象
anchorの最新バージョンを入れようとすると以下のエラーが発生。
% avm install 0.29.0
Updating git repository `https://github.com/coral-xyz/anchor`
warning: skipping duplicate package `shared` found at `/user/.cargo/git/checkouts/anchor-50c4b9c8b5e0501f/fc9fd6d/tests/zero-copy/programs/shared`
warning: skipping duplicate package `shared` found at `/user/.cargo/git/checkouts/anchor-50c4b9c8b5e0501f/fc9fd6d/tests/typescript/programs/shared`
warning: skipping duplicate package `swap` found at `/user/.cargo/git/checkouts/anchor-50c4b9c8b5e0501f/fc9fd6d/tests/cfo/deps/swap/programs/swap`
warning: skipping duplicate package `docs` found at `/user/.cargo/git/checkouts/anchor-50c4b9c8b5e0501f/fc9fd6d/tests/docs/programs/docs`
warning: skipping duplicate package `relations-derivation` found at `/user/.cargo/git/checkouts/anchor-50c4b9c8b5e0501f/fc9fd6d/tests/relations-derivation/programs/relations-derivation`
Installing anchor-cli v0.29.0 (https://github.com/coral-xyz/anchor?tag=v0.29.0#fc9fd6d2)
Updating crates.io index
warning: package `ahash v0.7.6` in Cargo.lock is yanked in registry `crates-io`, consider running without --locked
warning: package `ahash v0.8.3` in Cargo.lock is yanked in registry `crates-io`, consider running without --locked
error: failed to compile `anchor-cli v0.29.0 (https://github.com/coral-xyz/anchor?tag=v0.29.0#fc9fd6d2)`, intermediate artifacts can be found at `/var/folders/3k/d71m0mk56gj4wgfnr5wzsr2r0000gp/T/cargo-installrysvF3`
Caused by:
package `anstyle-parse v0.2.2` cannot be built because it requires rustc 1.70.0 or newer, while the currently active rustc version is 1.68.1
Either upgrade to rustc 1.70.0 or newer, or use
cargo update -p anstyle-parse@0.2.2 --precise ver
where `ver` is the latest version of `anstyle-parse` supporting rustc 1.68.1
Error: Failed to install 0.29.0, is it a valid version?
原因
Either upgrade to rustc 1.70.0 or newer
とあるとおり、rustcのバージョンが古かった。
対応
rustupを最新にする。
% rustup update
備考
anchor最新にする場合は、念のためSolanaも最新にしておくことをおすすめ。