Ryan Wennekes
Ryan Wennekes

Reputation: 89

Cargo build (BPF) stuck

I'm in the process of deploying the Solana helloworld example smart contract on Ubuntu 20.04. When running npm run build:program-rust, the package.json in the root of the repository states that this corresponds with cargo build-bpf --manifest-path=./src/program-rust/Cargo.toml --bpf-out-dir=dist/program. However, when running this command compilation is stuck without any indicators, even when appending the verbosity tag to the cargo build command.

I have a fresh installation of Ubuntu 20.04 and only took the following steps:

When running which cargo-build-bpf, Ubuntu points towards the directory ~/.local/share/solana/install/releases/1.8.6/solana-release/bin/cargo-build-bpf, indicating that the PATH variable has been updated correctly.

The Cargo.toml file looks as follows:

[package]
name = "solana-bpf-helloworld"
version = "0.0.1"
description = "Example template program written in Rust"
authors = ["Solana Maintainers <[email protected]>"]
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
edition = "2018"

[features]
no-entrypoint = []

[dependencies]
borsh = "0.9.3"
borsh-derive = "0.9.1"
solana-program = "~1.10.35"

[dev-dependencies]
solana-program-test = "~1.10.35"
solana-sdk = "~1.10.35"

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

Yesterday, I tried deleting the Cargo.lock file and running cargo update. It got stuck on trying to retrieve the Borsh crate which is also specified in the Cargo.toml file. I don't exactly know the relevance of this, but it seems worth pointing out.

Upvotes: 0

Views: 1116

Answers (1)

Jon C
Jon C

Reputation: 8472

The first time you run cargo build-bpf, the command silently fetches the SDK required to build the program, which can take some time. There's no indication while that's happening, unfortunately.

You may need to reinstall the Solana CLI, try again, and be sure to wait long enough.

Upvotes: 1

Related Questions