Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to update the rustc version of anchor project #2809

Closed
cryptostar7 opened this issue Feb 5, 2024 · 3 comments
Closed

How to update the rustc version of anchor project #2809

cryptostar7 opened this issue Feb 5, 2024 · 3 comments
Labels
compile error Issues related to compile errors question Further information is requested

Comments

@cryptostar7
Copy link

cryptostar7 commented Feb 5, 2024

Hi, Everyone. I have one issue while using anchor project.
I am a fresher of Solana project and now I am using the documentations.

Recently, I create the new anchor project using anchor init nftminting and run the anchor build command.

But this error is occured:
error: package solana-program v1.18.1cannot 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.1 --precise ver whereveris the latest version ofsolana-program supporting rustc 1.68.0-dev

So I checked the my rustc version.
When I run the command rustc --version, the result is rustc 1.75.0 (82e1608df 2023-12-21).
Now I am using anchor-cli 0.29.0.

So this means now I am using rustc 1.75.0.
What is the reason and How to fix it? Hope your kind answers. Thanks for your kind time

@acheroncrypto acheroncrypto added compile error Issues related to compile errors question Further information is requested labels Feb 5, 2024
@acheroncrypto
Copy link
Collaborator

Please see solana-labs/solana#31428 to understand why the error occurs.

You can update it by running:

solana-install init 1.18.0

Also, please use Solana StackExchange for questions.

@cryptostar7
Copy link
Author

Hi, Thanks for your kind effort. I have a similar issue now, I dont know how to fix that. I cannot get answer from google.
Here is the error message.

error: package toml_edit v0.21.1cannot be built because it requires rustc 1.69 or newer, while the currently active rustc version is 1.68.0-dev Either upgrade to rustc 1.69 or newer, or use cargo update -p toml_edit@0.21.1 --precise ver whereveris the latest version oftoml_editsupporting rustc 1.68.0-dev

In the last case, I fixed the issue by solana-install init 1.18.1. But in this case, I cannot fix it.
What is the reason and how to fix it? Hope your kind answers.

@19-xiaogao
Copy link

19-xiaogao commented Mar 20, 2024

I solved the problem.
Use this command.
cargo update -p solana-program --precise 1.17.17
My rustc version rustc 1.76.0
My solana version solana-cli 1.17.27
my anchor version 0.29.0
Good luck to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compile error Issues related to compile errors question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants