4

Both anchor build and cargo-build-sbf throw:

Warning: cargo-build-bpf is deprecated. Please, use cargo-build-sbf
cargo-build-bpf child: /Users/usr1/solana/bin/cargo-build-sbf --arch bpf
error: package `solana-program v1.16.4` cannot be built because it requires rustc 1.68.0 or newer, while the currently active rustc version is 1.62.0-dev

cargo build actually works, but it does not produce deploy directory.

But apparently I do have the rust version:

rustc -V
rustc 1.69.0 (84c898d65 2023-04-16)
cargo-build-sbf
error: package `solana-program v1.16.4` cannot be built because it requires rustc 1.68.0 or newer, while the currently active rustc version is 1.62.0-dev

Other versions:

cargo build-sbf -V
solana-cargo-build-sbf 1.12.0
sbf-tools v1.29

cargo --version
cargo 1.69.0 (6e9a83356 2023-04-12)

Same results for setting with rustup default 1.69.0.

I've updated solana, rustc and pretty much everything else. It always breaks on this.

My anchor.toml:

[package]
name = "proj"
version = "0.1.0"
description = "Created with Anchor"
edition = "2021"

[lib]
crate-type = ["cdylib", "lib"]
name = "proj"
ls

[features]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
default = []

[dependencies]
anchor-lang = "0.28.0"
anchor-spl = "0.28.0"
solana-program = "=1.16.4"
switchboard-v2 = "0.4.0"
bytemuck = "1.13.1"

This issue suggests following constraint to Anchor.toml solana-program = "=1.14.20", this won't work with switchboard-v2 = "^0.4.0".

3 Answers 3

3

Can you try updating to the latest solana-cli suite using

solana-install init 1.16.4

Also, the error has nothing with your rustc version, but the crates' MSRV.

2

Hey the error that you are using and old rust version comes from you having cli 14.x installed probably. Can you try updating it to 16.4? https://docs.solana.com/de/cli/install-solana-cli-tools

4
  • Sadly, that doesn't fix it. Commented Jul 21, 2023 at 8:33
  • I just tried building with your dependencies and its seems to work just. What does solana --version say and whats the error your are getting?
    – Jonas H.
    Commented Jul 21, 2023 at 16:48
  • solana-cli 1.16.4 (src:4ce8fe76; feat:2891131721, client:SolanaLabs) Commented Jul 21, 2023 at 16:54
  • And what error are you getting? For me its building fine. Maybe try deleting the cargo.lock file and build again with anchor build
    – Jonas H.
    Commented Jul 21, 2023 at 17:01
0

After running anchor build I got this:

Warning: cargo-build-bpf is deprecated. Please, use cargo-build-sbf
cargo-build-bpf child: /Users/usr1/solana/bin/cargo-build-sbf --arch bpf
error: package `solana-program v1.16.5` cannot be built because it requires rustc 1.68.0 or newer, while the currently active rustc version is 1.62.0-dev

I followed to /Users/usr1/solana nuked the /bin directory, run anchor build again and this time it rebuild everything and I guess from now would use global rustc rather than the one that was under /Users/usr1/solana.

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.