1

After running cargo build-bpf I get the following error:

cargo-build-bpf child: rustup toolchain list -v
cargo-build-bpf child: cargo +bpf build --target bpfel-unknown-unknown --release
error: package 'anchor-lang v0.27.0' cannot be built because it requires rustc 1.60 or newer, while the currently active rustc version is 1.59.0-dev

Sanity checking my rust version with rustup -V I get:

rustup 1.25.2 (2023-02-01)

info: This is the version for the rustup toolchain manager, not the rustc compiler. info: The currently active 'rustc' version is 'rustc 1.68.0 (2c8cc3432 2023-03-06)'

How can I update the rustc that Anchor sees?

2
  • I wondered about something similar a time ago where I overrode toolchain for particular directory and forgot about it. Do you run the rustup -V from the same directory where is your anchor project? If you are within the project try to run rustup show, that is similar to -V just list all toolchain and informs if directory override or if toolchain.toml is not defined.
    – chalda
    Commented Mar 22, 2023 at 15:13
  • 1
    Does this answer your question? Anchor build fails due to a current Rust version (1.59 or above is needed, 1.67 is installed)
    – Jon C
    Commented Mar 30, 2023 at 13:51

1 Answer 1

1
rustup install nightly
rustup default nightly

Try these? This should update the rust compiler to the latest nightly version and use them too. You can go back to using the stable versions by replacing nightly with stable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.