-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fresh project anchor build
fails with "lock file version 4 requires -Znext-lockfile-bump
"
#3392
Comments
I get the same exact problem! Seems like they outsourced QA to the users 🤣 |
You can fix this simply by changing the - version = 4
+ version = 3 The reason why it happens is because Anchor v0.30 uses Solana v1.18, and Solana v1.18 depends on Solana build tools have recently been updated to use Anchor v0.31 (#3259) will support Solana v2, meaning this issue will be resolved automatically. In the meantime, you can just use the fix mentioned at the beginning of this comment. |
this does not work as re-running anchor build sets it back to 4... |
I have the same problem, has anyone found a solution? Thanks |
Why this issue is closed? The problem still exists.. :( |
@nabeel-uncx thank you for sharing - this fix worked for me! |
Using the tutorial on the Solanas website and changing the version of the |
#3392 (comment) - tried it, but it didn't work for me either, thank you for sharing. However, this worked: solana-install init 1.18.26
cargo build-sbf I had a project that required 1.18.26 of solana tools. Then compiled it and stuff just worked. Maybe, it'll help someone. |
Changing version of lockfile from 4 to 3 helped me. So if anything try that first and see if that fixes |
I get the same problem after set version = 3 |
I know,look this page solana-labs/solana#34987 |
This answer works. Edit: And then it create more problems with the types in typescript if we change the version to 3. |
@waqasraza123 |
anchor is simply broken now. such issue shouldn't exists at all. |
yep. for someone like me who is trying to build a sol program for the first time, the status "closed" doesn't feel right. even if manually editing the lock file works for some, i think it should be pointed out that while this workaround can temporarily unblock you, it’s advisable to find a proper fix |
this: lock file version 4 requires `-Znext-lockfile-bump. I uninstalled everything, anchor, mocha, node, even linux because I use wsl ubuntu on windows... and in the end I got the same error... I'm losing my hair, I try everything (of course, helped by gemini and chatgpt and nothing) it only gets worse. |
manually editing the lock file to version 3 "works" (anchor build don't fail) if you follow the getting started guide on solana.com using a fresh vps with ubuntu server 24.04 on clodzy.com. there's a $5 minimum top-up but it can be paid with SOL |
I have never done Solana development before but the toolchain seems to be a complete mess - first impressions! First I followed instructions from ChatGPT - nothing worked. Fair enough, I should have just used the official instructions, right? They're right here https://solana.com/docs/intro/installation So I uninstalled everything, followed the official instructions, and after a ton of downloading, installing, and compiling, I got this error message on a brand new project ... an hour of downloading things Not exactly confidence-inspiring. Update: It seems like rust, solana, and anchor all have flexible version management... so therefore it seems one could simply write a bash script that contains the compatible versions of these tools in a table, and switches them all to compatible versions on a single command. |
Same error here, changing 4 to 3 solved the problem but really hope you can release |
Yes, and yes. Same too me |
How did you change 4 to 3? Yea its frustrating to struggle with installs instead of working on actual issues. (base) $ anchor build Caused by: |
I changed my rustc version from 1.83 to 1.75, problem solved. |
Hey there @Sandalo100, @notnullonline, @CarlTornberg, @HiPipilu, @waqasraza123, @kuchaguangjie, @6758f6, @n13 and @xcaptain - I hope you don't mind the ping. First of all, sorry to hear you're having issues getting this to work. I'd like to make sure you can get started so feel free to reply with more context if the below doesn't work for you. Yesterday I spun up a new project and got the same issue. Here's how I managed to get to a (consistently) working setup on my system. 1. Make sure to have rust 1.79.0 as the active versionI was on a higher version of Rust but this seemed to be the main problem. I tried a few versions and ended up using I used You should end up with these versions: $ rustup default 1.79.0-aarch64-apple-darwin
# This will install the toolchain
$ rustc --version
rustc 1.79.0 (129f3b996 2024-06-10)
$ cargo --version
cargo 1.79.0 (ffa9cf99a 2024-06-03)
$ rustup --version
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.79.0 (129f3b996 2024-06-10)` 2. Be sure to be on version 2.0.21 of Solana (Agave client)I installed the agave version of Solana as per the official docs. You should get the following version:
If you have the agave tools installed but are on a different version, you can switch like so:
3. Be sure to be on version 0.30.1 of Anchor
4. Create a new project to check if the above works
If that last command doesn't fail, you should be good to go. 5. Bonus: use
|
For anyone new coming across this issue, this solution worked for me (apple silicon user) |
It worked for me, but I also had to change the version in the Cargo.lock . $ rustc --version
rustc 1.79.0 (129f3b996 2024-06-10)
$ cargo --version
cargo 1.79.0 (ffa9cf99a 2024-06-03)
$ rustup --version
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.79.0 (129f3b996 2024-06-10)`
$ solana --version
solana-cli 2.0.21 (src:99ac0105; feat:607245837, client:Agave)
$ avm use latest
Now using anchor version 0.30.1. # Cargo.lock
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3 |
Issue
Running
anchor build
oranchor test
in a fresh project initialized with anchor-cli fails with the following:Environment Details
Apple silicon (m1)
I ended up in this state after running
cargo build-sbf --force-tools-install
to resolve theerror: not a directory: '.../solana-release/bin/sdk/sbf/dependencies/platform-tools/rust/lib'
error as recommended hereThe text was updated successfully, but these errors were encountered: