我正在Ubuntu 20.04上部署Solana helloworld示例智能合约。当运行npm run build:program-rust
时,存储库根目录中的package.json
表示这与cargo build-bpf --manifest-path=./src/program-rust/Cargo.toml --bpf-out-dir=dist/program
相对应。但是,在运行此命令时,即使将verbose标记附加到cargo build命令后,编译也会在没有任何指示符的情况下卡住。
我有一个新安装的Ubuntu 20.04,只做了以下步骤:
sudo apt update && sudo apt upgrade
- 安装NodeJS v14build-essential 安装Rust:
- 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
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
当运行which cargo-build-bpf
时,Ubuntu指向目录~/.local/share/solana/install/releases/1.8.6/solana-release/bin/cargo-build-bpf
,表明PATH变量已经正确更新。
货物。Toml文件如下所示:
[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"]
昨天,我试图删除货物。锁文件并运行cargo update
。它在试图检索Borsh
板条箱时卡住了,这也是在货物中指定的。toml文件。我不太清楚这两者之间的关系,但似乎值得指出来。
第一次运行cargo build-bpf
时,该命令静默地获取构建程序所需的SDK,这可能需要一些时间。不幸的是,没有迹象表明这正在发生。
您可能需要重新安装Solana命令行,并等待足够长的时间。