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
Problem
I am using anchor framework ,and running anchor build. I am having a problem between solana-program and rustc , I have confirme rustc --version 1.72.0 on my console, where I am getting the problem?
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
Proposed Solution
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Reactions: 2
- Comments: 18 (6 by maintainers)
to resolve this Error Simply Run 2 Commands 1-
cargo add solana-program@=1.17.0Then Run 2-cargo update -p solana-programAfter Simply Run :
anchor build. and you Good To GoYou have two options to resolve this without downgrading:
solana-install init 1.18.0cargo build-sbfthat comes bundled with 1.16, you can use the--tools-versionargument 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.39Getting same error here
and then if I follow the advice for
cargo add solana-program@=1.17.0then I end up with new errorsThis issue blind-sided me too if I’m being honest 😅 I wrote up this Stack Exchange question in the hopes that others find it: https://solana.stackexchange.com/questions/9798/error-building-program-with-solana-program-v1-18-and-cli-v1-17/9799#9799
If there are no more questions, I’ll close this issue
@joncinque Great info! This what I’m talking about. A few nuggets of info like this added to the docs and the tutorials would save a lot of people much grief when first arriving. Plus save a whole lot more people from hearing my bitching! 😂❤️❤️
People ask about this error all the time so I’m linking https://github.com/solana-labs/solana/issues/31428 once again.
#34991 Was where I finally had the aha moment and listened to everyone about making cli and solana-program line up but the comments in here are solving it as well! Sorry for the commotion yesterday but it appears many more of us a getting it installed properly 🤣
@jakerumbles if you are facing issue like
use of unstable library feature 'build_hasher_simple_hash_one'in your respective project. locate the folder.
programs/xyz_proj_name/cargo.tomlfile. it will work if you are usingsolana-program = { version = "=1.17.0"}Simply you have to add the dependency list.
[dependencies] ahash = "=0.8.6"i tried and it works in my case. So you can also Try.
@hamzagill906 thank you so much. I actually solved it a couple hours ago and I’ll pin it here when I figure out how to do that and wake up! 😂. Had 1.5 hours of sleep before getting my son to school after coding last night. I had to do one thing in addition to what you said and that was put the
=sign inside the quotes in myCargo.tomlto make the version stick:solana-program = "=1.17.17"Perfect response though and I greatly appreciate it! 👊🏻