Open pcellix opened 1 year ago
error: package solana-program v1.16.2 cannot be built because it requires rustc 1.68.0 or newer, while the currently active rustc version is 1.62.0-dev
This error message sounds like your rustc/cargo version is older than v16.2 is requiring
cargo --version
Looks like the same issue as https://github.com/solana-labs/solana/issues/32397
@pcellix I could not reproduce your problem locally.
I followed https://docs.solana.com/getstarted/rust and cargo-build-bpf
worked for me. So questions are:
solana-cli
version? My version is 1.16.2, please post here output of solana --version
RUST_LOG=debug cargo build-bpf --version
solana-program = "1.16.5"
Same issue. Can not even run the hello world example.
User@macOS:~/git/rust/hello_world $ rustup --version
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.72.0 (5680fa18f 2023-08-23)`
User@macOS:~/git/rust/hello_world $ rustc --version
rustc 1.72.0 (5680fa18f 2023-08-23)
User@macOS:~/git/rust/hello_world $ cargo --version
cargo 1.72.0 (103a7ff2e 2023-08-15)
User@macOS:~/git/rust/hello_world $ solana --version
solana-cli 1.14.29 (src:695192cf ; feat:139196142)
User@macOS:~/git/rust/hello_world $ RUST_LOG=debug cargo build-bpf --version
Warning: cargo-build-bpf is deprecated. Please, use cargo-build-sbf
cargo-build-bpf child: /Users/User/.local/share/solana/install/active_release/bin/cargo-build-sbf --version --arch bpf
solana-cargo-build-sbf 1.14.29
sbf-tools v1.29
User@macOS:~/git/rust/hello_world $ RUST_LOG=debug cargo build-sbf --version
solana-cargo-build-sbf 1.14.29
sbf-tools v1.29
User@macOS:~/git/rust/hello_world $ cat Cargo.toml
[package]
name = "hello_world"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
solana-program = "1.16.14"
[lib]
name = "hello_world"
crate-type = ["cdylib", "lib"]
The setup is strictly following https://docs.solana.com/getstarted/local .
I think I got a more generic solution to the issue.
@KirillLykov's comment was very helpful. Specifically the RUST_LOG=debug cargo build-bpf --version
command.
I had the exact same error on the hello-world tutorial, i.e. error: package solana-program v1.16.14 cannot be built because it requires rustc 1.68.0 or newer, while the currently active rustc version is 1.62.0-dev
. The error seems odd, since rustc -V
reported: rustc 1.72.1 (d5c2e9c34 2023-09-13).
The command RUST_LOG=debug cargo build-bpf --version
reported that i was using solana-cargo-build-sbf 1.14.29,
while in the Cargo.toml solana-program v1.16.14 crate was defined (after executing cargo add solana-program
following the official docs).
This is a minor version difference 1.14 to 1.16, which shouldn't create any issues, since it's supposed to be only backward compatible API extension.
I pinned the minor version to match the version of solana-cargo-build-sbf in Cargo.toml
# Cargo.toml
# ... other configs
[dependencies]
solana-program = "=1.14" # pin the minor version to allow update to the latest patch ([as per cargo docs](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-dependencies-from-cratesio))
# ... other configs
Run cargo build-bpf
and it should work now.
Based on the official docs (quoting)
cargo build-bpf installs the toolchain from the currently installed solana CLI tools. You may need to upgrade those tools if you encounter any version incompatibilities.
Solana-CLI stable release points to 1.14.x (instead of the 1.16.x because it is a testnet relase) while the cargo add solana-program
install the latest 1.16.x version.
This could be flagged as a Developer UX bug with straightforward mitigation actions by the solana team:
Either:
@Gr3at thanks for reproducing this and providing instructions.
This is a minor version difference 1.14 to 1.16, which shouldn't create any issues, since it's supposed to be only backward compatible API extension.
Although this is a valid assumption, there are some known problems when migrating from 14 to 16. See https://github.com/solana-labs/solana/issues/31960
@KirillLykov thanks for pointing me to the issue. The conversation there was very informative.
So, based on this comment, in my understanding it is better to work on 1.14 (crates and cli) till all core crates are properly updated to work on 1.16.
@KirillLykov thanks for pointing me to the issue. The conversation there was very informative.
So, based on this comment, in
Based on the testing I did, my understanding is different. Since this question might be interesting for others, I've wrote there: https://github.com/solana-labs/solana/issues/31960#issuecomment-1735763968
So does anyone have any insight for completely new person to run the very first tutorial or will Solana just leave it that way forever? So frustrating as a new user wanting to learn.
So does anyone have any insight for completely new person to run the very first tutorial or will Solana just leave it that way forever? So frustrating as a new user wanting to learn.
Is this still an issue? I think if you use the latest version of solana, it should just work. If you experienced some problems, please specify your version of solana cli and cargo-sbf. Also when building you onchain program specify to print debug info like RUST_LOG=debug cargo build-spf
,
I apologize. I was just terribly frustrated and was not finding anything that worked. I had to downgrade my solana install to the latest stable version 1.17.17. Why is the dev version printed on the main docs for newcomers to use instead of a stable release with no warning? That seems very odd.
[package]
name = "hello_world"
version = "0.1.0"
edition = "2021"
[dependencies]
solana-program = "1.17.17"
solana-sdk = "1.17.17"
ahash = "0.8.5"
[lib]
name = "hello_world"
crate-type = ["cdylib", "lib"]
After downgrading solana program and sdk and also downgrading ahash as another posted in an earlier thread on the issue, I ran.
rm Cargo.lock cargo update (deleting my Cargo.lock file and creating a new version, in case someone very new is reading)
then... cargo update -p solana-sdk --precise 1.17.17 cargo update -p solana-program --precise 1.17.17
to downgrade to the stable versions.
Complied and now receiving errors for multiple versions of crates being installed. I will update ASAP.
RUST_LOG=debug cargo build-sbf
[2024-01-27T16:51:25.091062541Z INFO cargo_build_sbf] spawn: --version
[2024-01-27T16:51:25.274730242Z INFO cargo_build_sbf] Solana SDK: /home/frackinfamous/.local/share/solana/install/releases/1.17.17/solana-release/bin/sdk/sbf
[2024-01-27T16:51:25.274854942Z INFO cargo_build_sbf] spawn: toolchain list -v
[2024-01-27T16:51:25.280291142Z INFO cargo_build_sbf] spawn: +solana build --release --target sbf-solana-solana
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
Either upgrade to rustc 1.72.0 or newer, or use
cargo update -p solana-program@1.18.0 --precise ver
where ver
is the latest version of solana-program
supporting rustc 1.68.0-dev
I ended up restarting from scratch. Same issue.
RUST_LOG=debug cargo build-sbf
[2024-01-27T17:16:02.584833161Z INFO cargo_build_sbf] spawn: --version
[2024-01-27T17:16:02.738686760Z INFO cargo_build_sbf] Solana SDK: /home/frackinfamous/.local/share/solana/install/releases/1.17.17/solana-release/bin/sdk/sbf
[2024-01-27T17:16:02.738777760Z INFO cargo_build_sbf] spawn: toolchain list -v
[2024-01-27T17:16:02.743675360Z INFO cargo_build_sbf] spawn: +solana build --release --target sbf-solana-solana
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
Either upgrade to rustc 1.72.0 or newer, or use
cargo update -p solana-program@1.18.0 --precise ver
where ver
is the latest version of solana-program
supporting rustc 1.68.0-dev
error: package solana-program v1.16.2 cannot be built because it requires rustc 1.68.0 or newer, while the currently active rustc version is 1.62.0-dev
This error message sounds like your rustc/cargo version is older than v16.2 is requiring
Did you install rustup as described in the tutorial?
What is your ouptut from
cargo --version
It does the same thing now no matter how many times you wipe and reinstall. Switch computers. Buy new HDD or stand on your head. It now says you are running 1.68dev and need 1.72. I've never installed version 1.68dev ever. Obviously you could read the error and tell him he has the wrong version. 20 hours later and I can still read it the error on mine but it doesn't help. How is this still the standard instructional tutorial for new people and every update it just sucks the same with new numbers?
Related: #34987
Hope this helps: #34987 (comment), #34987 (comment)
Starting to wrap my head around the issue but still not getting it. It 100% does not work from the tutorial if you have never had rust installed on a bare linux build and start the tutorial from scratch it does not work. I have been through it 10 times following all of what 5 steps, to a T. Still in the same spot. UGH. So I can 100% confirm this is still screwing new people post tagging whatever install they are supposed to tag.
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
Either upgrade to rustc 1.72.0 or newer, or use
cargo update -p solana-program@1.18.0 --precise ver
where ver
is the latest version of solana-program
supporting rustc 1.68.0-dev
frackinfamous@localhost:~/dev/hello_world$ cargo-build-sbf --version
solana-cargo-build-sbf 1.17.19
platform-tools v1.37
rustc 1.68.0
active_release already points to stable release
active_release -> /home/frackinfamous/.local/share/solana/install/releases/stable-b8ac42552b7b084e60221905c239124b8135bc36/solana-release
Finally got it working here #34991 but great comments in this thread and #34987 lead me there too! Looks like more folks are figuring it out. Thanks everyone.
Problem
Hi,
After observing solana community from outside I've decided to join this community from developer side. I wanted to start using tutorial https://docs.solana.com/getstarted/rust Unfortunately it does not working currently out of the box using ubuntu 20.04 The message I receive is:
Warning: cargo-build-bpf is deprecated. Please, use cargo-build-sbf cargo-build-bpf child: /home/ubuntu/.local/share/solana/install/active_release/bin/cargo-build-sbf --arch bpf error: package
solana-program v1.16.2
cannot be built because it requires rustc 1.68.0 or newer, while the currently active rustc version is 1.62.0-devProposed Solution
I think this should be fixed because when someone is joining the community is enthusiastic and wants to have their code running
Best regards, Wojtek