0

I'm trying to follow a simple tutorial for getting started in Solana.

When I run anchor build, I get an error that is based on my rust version. However, this is not the version that my terminal says I am using. How do I get consistency between these two?

% rustc --version 
rustc 1.69.0-nightly (f77bfb733 2023-03-01)  
% anchor build   
BPF SDK: .../1.9.4/solana-release/bin/sdk/bpf
cargo-build-bpf child: rustup toolchain list -v
cargo-build-bpf child: cargo +bpf build --target bpfel-unknown-unknown --release
error: package `anchor-attribute-constant v0.26.0` cannot be built because it requires rustc 1.59 or newer, while the currently active rustc version is 1.56.0-dev

As you can see it says I'm using 1.56 even though my terminal says I'm using 1.69.

bernardo
  • 173
  • 8
  • 2
    Does this answer your question? [Why is "anchor build" and "Cargo build-bpf" showing wrong rustc version?](https://stackoverflow.com/questions/71598808/why-is-anchor-build-and-cargo-build-bpf-showing-wrong-rustc-version) – cafce25 Mar 02 '23 at 08:57

1 Answers1

-2

Taken from searching around Stackoverflow, kudos to Jon C

anchor build and cargo build-bpf use a different compiler than the normal rustc compiler included in the system, so it's normal that they report a different version. The BPF compiler comes with the Solana tool suite. If you already have the Solana tools installed on your computer, you can simply run: solana-install init 1.9.13

Full thread link

  • 1
    If you find an answer on StackOverflow, you should flag the question as duplicate, not copy the answer over. – cafce25 Mar 02 '23 at 08:58