Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get a build error for the resolver feature when I have up to date rustc and cargo version?

When I run the build command

cargo build-bpf --manifest-path=Cargo.toml --bpf-out-dir=dist/program 

error: failed to download solana-frozen-abi v1.7.9

Caused by: unable to get packages from source

Caused by: failed to parse manifest at /home/USER/.cargo/registry/src/github.com-1ecc6299db9ec823/solana-frozen-abi-1.7.9/Cargo.toml

Caused by: feature resolver is required

There have been people with similar issues but the cause was old rustc version. Mine looks ok

rustc --version
rustc 1.55.0-nightly (7c3872e6b 2021-06-24)

cargo --version
cargo 1.55.0-nightly (9233aa06c 2021-06-22)

My Cargo.toml file looks like

[package]
name = "test"
version = "0.0.1"
edition = "2018"
exclude = ["tests/**"]

[features]
no-entrypoint = []
test-bpf = []

[dependencies]
borsh = "0.8.2"
num-derive = "0.3"
num-traits = "0.2"
solana-program = "1.6.10"
spl-token = { version="3.1.1", features = [ "no-entrypoint" ] }
thiserror = "1.0"

[dev-dependencies]
solana-program-test = "1.6.10"
solana-sdk = "1.6.10"

[lib]
crate-type = ["cdylib", "lib"]

I have downloaded the metaplex rust code (exact same dependencies) and the build bpf command compiles successfully.

I have also tried running cargo clean which doesnt change anything.

like image 949
wxecqz123 Avatar asked Aug 08 '21 08:08

wxecqz123


People also ask

Does updating dependencies using cargo guarantee that you use the latest version of the dependency?

This means that only the dependency specified by SPEC will be updated. Its transitive dependencies will be updated only if SPEC cannot be updated without updating dependencies. All other dependencies will remain locked at their currently recorded versions. If -p is not specified, all dependencies are updated.

What is cargo build?

Cargo is Rust's build system and package manager. Most Rustaceans use this tool to manage their Rust projects because Cargo handles a lot of tasks for you, such as building your code, downloading the libraries your code depends on, and building those libraries.

What is cargo fix?

This is intended to help automate tasks that rustc itself already knows how to tell you to fix! Executing cargo fix will under the hood execute cargo-check(1). Any warnings applicable to your crate will be automatically fixed (if possible) and all remaining warnings will be displayed when the check process is finished.

What does cargo lock do?

The purpose of a Cargo. lock is to describe the state of the world at the time of a successful build. It is then used to provide deterministic builds across whatever machine is building the package by ensuring that the exact same dependencies are being compiled.


1 Answers

I fixed it by updating to the latest version (1.7.9) of Solana (which is not the release version):

sh -c "$(curl -sSfL https://release.solana.com/v1.7.9/install)"
like image 68
Georges Avatar answered Oct 20 '22 11:10

Georges