简体   繁体   中英

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:

  • sudo apt update && sudo apt upgrade
  • Install NodeJS v14.x and build-essential
  • Install Rust: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • Install Solana CLI: sh -c "$(curl -sSfL https://release.solana.com/v1.8.6/install)"
  • git clone https://github.com/solana-labs/example-helloworld.git

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 <maintainers@solana.com>"]
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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM