Wonderland
Search…
BPF SDK path does not exist
When I was in step 9 of the tutorial named "Solana 101", I was trying to build my first smart contract. But when I use the command as the book says, I got an unexpected error:
1
$ yarn run solana:build:program
2
yarn run v1.22.17
3
$ cargo build-bpf --manifest-path=contracts/solana/program/Cargo.toml --bpf-out-dir=dist/solana/program
4
BPF SDK: /Users/alice/.local/share/solana/install/releases/stable-a812f4410ee6195a3b78642f49e07dea69759240/solana-release/bin/sdk/bpf
5
cargo-build-bpf child: rustup toolchain list -v
6
cargo-build-bpf child: cargo +bpf build --target bpfel-unknown-unknown --release
7
Finished release [optimized] target(s) in 0.28s
8
cargo-build-bpf child: /Users/alice/.local/share/solana/install/releases/stable-a812f4410ee6195a3b78642f49e07dea69759240/solana-release/bin/sdk/bpf/scripts/strip.sh /Users/alice/Codes/Private/learn-web3-dapp/contracts/solana/program/target/bpfel-unknown-unknown/release/helloworld.so /Users/alice/Codes/Private/learn-web3-dapp/dist/solana/program/helloworld.so
9
Failed to execute /Users/alice/.local/share/solana/install/releases/stable-a812f4410ee6195a3b78642f49e07dea69759240/solana-release/bin/sdk/bpf/scripts/strip.sh: No such file or directory (os error 2)
10
error Command failed with exit code 1.
11
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Copied!
We all know this is not about yarn itself, so I google and google and google...
Most of the solutions are similar, the first solution is cargo build-bpf fails, after I tried the answer which has the most thumbs-ups, I got another error which means not work:
1
$ yarn run solana:build:program
2
yarn run v1.22.17
3
$ cargo build-bpf --manifest-path=contracts/solana/program/Cargo.toml --bpf-out-dir=dist/solana/program
4
BPF SDK path does not exist: /Users/alice/.local/share/solana/install/active_release/bin/sdk/bpf: No such file or directory (os error 2)
5
error Command failed with exit code 1.
6
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.l
Copied!
After careful comparison, I found my situation may differ from the above question. So I keep searching and I found another question on StackOverflow with the same keyword "BPF SDK path does not exist". In the solution, it told me to up the version of Rust to date and check the version of Solana CLI, so I tried the following:
1
$ rustup update stable
2
info: syncing channel updates for 'stable-aarch64-apple-darwin'
3
-- snip --
4
stable-aarch64-apple-darwin updated - rustc 1.60.0 (7737e0b5c 2022-04-04) (from rustc 1.59.0 (9d1b2106e 2022-02-23))
5
6
info: checking for self-updates
7
8
$ sh -c "$(curl -sSfL https://release.solana.com/v1.10.6/install)"
9
downloading v1.10.6 installer
10
✨ 1.10.6 initialized
Copied!
I updated the Rust and reinstall the Solana CLI with an exact version, and after that, I tried the build command again:
1
$ yarn run solana:build:program
2
yarn run v1.22.17
3
$ cargo build-bpf --manifest-path=contracts/solana/program/Cargo.toml --bpf-out-dir=dist/solana/program
4
BPF SDK: /Users/alice/.local/share/solana/install/releases/1.10.6/solana-release/bin/sdk/bpf
5
cargo-build-bpf child: rustup toolchain list -v
6
cargo-build-bpf child: rustup toolchain uninstall bpf
7
info: uninstalling toolchain 'bpf'
8
info: toolchain 'bpf' uninstalled
9
cargo-build-bpf child: rustup toolchain link bpf /Users/alice/.local/share/solana/install/releases/1.10.6/solana-release/bin/sdk/bpf/dependencies/bpf-tools/rust
10
cargo-build-bpf child: cargo +bpf build --target bpfel-unknown-unknown --release
11
-- snip compile log --
12
+ rustup toolchain uninstall bpf
13
info: uninstalling toolchain 'bpf'
14
info: toolchain 'bpf' uninstalled
15
+ set -e
16
+ rustup toolchain link bpf bpf-tools/rust
17
+ exit 0
18
cargo-build-bpf child: /Users/alice/.local/share/solana/install/releases/1.10.6/solana-release/bin/sdk/bpf/dependencies/bpf-tools/llvm/bin/llvm-readelf --dyn-symbols /Users/alice/Codes/Private/learn-web3-dapp/dist/solana/program/helloworld.so
19
20
To deploy this program:
21
$ solana program deploy /Users/alice/Codes/Private/learn-web3-dapp/dist/solana/program/helloworld.so
22
The program address will default to this keypair (override with --program-id):
23
/Users/alice/Codes/Private/learn-web3-dapp/dist/solana/program/helloworld-keypair.json
24
✨ Done in 23.40s.
Copied!
Wow! It works! I think maybe the previous version of Solana CLI I installed is somehow broken or not suitable for the Rust version. I'm relieved to finally be able to compile the program.
Copy link