10

When trying to run "anchor build" I get this error. I noticed I can run other programs but it seems as soon as i implement the anchor-spl crate i run into this problem. I've tried updating anchor, rustc, and solana cli as well as trying different versions of each. I've uninstalled all three and reinstalled them as well. I've tried rustup install nightly then rustup default nightly as well as someone on another similar post suggested.

when checking my versions this is what i get.

rustc 1.64.0 (a55dd71d5 2022-09-19)```

but then when running ```anchor build``` this is what's returned

```error: package `winnow v0.4.4` cannot be built because it requires rustc 1.64.0 or newer, while the currently active rustc version is 1.62.0-dev``` how do i update the rustc version that anchor is seeing?
2
  • I've personally found that a lot of solana releases are broken. You might find this helpful. Solana-cli 1.14.10 works for building anchor 0.27.0 with anchor-spl 0.27.0 in my setup
    – Ademola
    Commented May 1, 2023 at 13:15
  • I get this error too using seahorse-cli and seahorse-py when building spl programs in python.
    – witwiki
    Commented Jul 15, 2023 at 0:31

2 Answers 2

11

The error message is misleading because the error actually results from the version of rustc that ships with solana and not your system's rustc version. See https://github.com/solana-labs/solana/issues/31428

To fix this error, use the latest version of anchor-spl from git by adding it to your Cargo.toml:

anchor-spl = { git = "https://github.com/coral-xyz/anchor" }

If you are still getting the same error, you might have to run cargo clean and remove Cargo.lock.

Note

The winnow dependency comes from spl-token-2022 crate that anchor-spl depends on but neither of those crates are the actual problem. The main problem is that the latest release of solana(1.14.17) is using an outdated version of rustc. This means MSRV problems like this one will go away once a new Solana release is published.

Related: https://github.com/solana-labs/solana/pull/31418

1
  • 2
    Adding your temporary fix for anyone that might want to do something similar. I ran into this problem from other libraries, aside from anchor-spl. Acheron's temporary fix for anchor-spl was to fix the winnow version in your project's Cargo.toml, ie. winnow = "=0.4.1". This should only be temporary until MSRV issues are resolved by a later Solana release. github.com/coral-xyz/anchor/pull/2478/files
    – Joe C
    Commented May 1, 2023 at 17:39
3

I just added winnow="0.4.1" in dependency section of Cargo.toml file and it worked.

  • Initially I have added anchor-spl = { git = "https://github.com/coral-xyz/anchor" } in place of anchor-spl = "0.27.0".
  • Then i just remained anchor-spl = "0.27.0" and added winnow="0.4.1" and it's working.
  • You can also try this may be it works in your case.
2
  • Hi, could you post your whole Cargo.toml file? I tried to add the winnow as you suggested but it still doesn't work - the issue remains exactly the same, this winnow dependency seems to be ignored. My dependencies section looks like this: [dependencies] anchor-lang = "0.27.0" anchor-spl = "0.27.0" winnow = "0.4.1" (cannot insert new lines here, sorry) Commented May 4, 2023 at 12:32
  • 2
    Ok, looks like it needs to be winnow = "=0.4.1" instead as suggested above by Joe and it works correctly Commented May 4, 2023 at 12:51

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.