3

I used the official documentation. Install the latest Rust stable from https://rustup.rs/ . Install the latest Solana command-line tools.

But when i try cargo build-bpf in command line in windows 10 i get error:

D:\hello_world\>cargo build-bpf 
info: uninstalling toolchain 'solana'
info: toolchain 'solana' uninstalled
error: no such command: `+solana`

        Cargo does not handle `+toolchain` directives.
        Did you mean to invoke `cargo` through `rustup` instead?

Cargo.toml:

[package]
name = "hello_world"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
solana-sdk = "1.17.4"

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

How to solve a problem?

3 Answers 3

2

cargo build-bpf is deprecated in favour of cargo build-sbf.

Have you made sure that you have the Solana tool suite correctly installed? If not check out this guide https://solana.com/developers/guides/getstarted/setup-local-development

edit: Also try updating to the latest release solana-install update

2

The solana toolchain comes with the Solana tool suite, so be sure to run the installation steps at https://docs.solana.com/cli/install-solana-cli-tools#windows

You may need to wait some time the first time you run cargo build-bpf or cargo build-sbf in order to download the BPF SDK.

2

cargo build-bpf is not supported on windows. See: https://github.com/solana-labs/solana/pull/20276#issuecomment-969200122

Support did exist for almost three weeks in 2021, but not anymore.

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.