BPF SDK path does not exist

I’m following the Anchor docs here, but I keep getting this error…

BPF SDK path does not exist: /Users/herbie/.cargo/bin/sdk/bpf: No such file or directory (os error 2)

I ran ls -al /Users/herbie/.cargo/bin and got this output:

total 239152
drwxr-xr-x  17 herbie  staff       544 31 Jan 16:55 .
drwxr-xr-x   9 herbie  staff       288 13 Dec 11:58 ..
-rwxr-xr-x   1 herbie  staff  12574724 31 Jan 16:49 anchor
-rwxr-xr-x  12 herbie  staff   8521112 31 Jan 16:55 cargo
-rwxr-xr-x   1 herbie  staff   7578989 14 Dec 14:05 cargo-build-bpf
-rwxr-xr-x  12 herbie  staff   8521112 31 Jan 16:55 cargo-clippy
-rwxr-xr-x  12 herbie  staff   8521112 31 Jan 16:55 cargo-fmt
-rwxr-xr-x  12 herbie  staff   8521112 31 Jan 16:55 cargo-miri
-rwxr-xr-x  12 herbie  staff   8521112 31 Jan 16:55 clippy-driver
-rwxr-xr-x  12 herbie  staff   8521112 31 Jan 16:55 rls
-rwxr-xr-x  12 herbie  staff   8521112 31 Jan 16:55 rust-gdb
-rwxr-xr-x  12 herbie  staff   8521112 31 Jan 16:55 rust-lldb
-rwxr-xr-x  12 herbie  staff   8521112 31 Jan 16:55 rustc
-rwxr-xr-x  12 herbie  staff   8521112 31 Jan 16:55 rustdoc
-rwxr-xr-x  12 herbie  staff   8521112 31 Jan 16:55 rustfmt
-rwxr-xr-x  12 herbie  staff   8521112 31 Jan 16:55 rustup

Haven’t found much online, and have never heard of BPF before…

Hi @herbievine and welcome to the forum! :wave:

BPF is the format that Solana uses for it’s compiled smart contracts.

I see that you already have cargo-build-bpf installed, so it seems like you’ve got at least a part of the SDK.

At what step are you getting that error?

I get it when I run anchor build

also when I run anchor test. It seems like the rust program just can’t run when it’s not installed…

any luck figuring this out?

I just finished following the instructions and when I first ran anchor build it downloaded the BPF SDK:

BPF SDK: /home/zicklag/.local/share/solana/install/releases/1.9.4/solana-release/bin/sdk/bpf
cargo-build-bpf child: rustup toolchain list -v
cargo-build-bpf child: rustup toolchain uninstall bpf
info: uninstalling toolchain 'bpf'
info: toolchain 'bpf' uninstalled
cargo-build-bpf child: rustup toolchain link bpf /home/zicklag/.local/share/solana/install/releases/1.9.4/solana-release/bin/sdk/bpf/dependencies/bpf-tools/rust
cargo-build-bpf child: cargo +bpf build --target bpfel-unknown-unknown --release

I’m not sure why it didn’t do that for you.

Maybe you need to upgrade the Anchor CLI? What version do you have? I have anchor-cli 0.20.1.

how about this question?
it happened to me right now.

npm run build:program-rust

are you sure this command works?