4

When building an on-chain program with cargo build-sbf using solana-program v1.18, I get the following error:

error: package solana-program v1.18.0 cannot be built because it requires rustc 1.72.0 or newer, while the currently active rustc version is 1.68.0-dev

I'm using v1.17.17 of the CLI:

$ cargo build-sbf -V
solana-cargo-build-sbf 1.17.17
platform-tools v1.37
rustc 1.68.0
$ solana -V
solana-cli 1.17.17 (src:27a43800; feat:1337574167, client:SolanaLabs)

How can I resolve this?

(inspired by https://github.com/solana-labs/solana/issues/34987)

1 Answer 1

4

You have a few options to fix the build:

  • As of cargo build-sbf that comes bundled with Solana v1.16, you can use the --tools-version argument to use a different version of the build tools. Version 1.39 of the build tools contains a Rust compiler at 1.72, so you can run:
cargo build-sbf --tools-version v1.39
  • Upgrade to the Solana 1.18 tools, which defaults to v1.39 of the build tools:
solana-install init 1.18.0
  • Force your build to use v1.17 of solana-program by specifying the version in your Cargo.toml:
solana-program = "=1.17"

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.