cargo build-bpf 无法在 windows11 中的 WSL2 上运行 [Solana dev]
我正在 solana 上构建一个简单的 hello world 程序。 使用 : win11 上的 WSL2 Ubuntu LTS 22 solana-cli 1.13.8 生锈 1.69.0 货物1.69.0
注意:“cargo build”运行成功,但“cargo build-bpf”运行失败
首先我运行cargo build-bpf。它成功地将 bpf-tools 下载到“~/.cache/solana/v1.27”中 然后它给了我这个错误 错误:无法选择满足要求的版本
aho-corasick = "^1.0.0"
sriram@Sk:~/local-program$ cargo build-bpf
BPF SDK: /home/sriram/.local/share/solana/install/releases/stable-43daa37937907c10099e30af10a5a0b43e2dd2fe/solana-release/bin/sdk/bpf
cargo-build-bpf child: rustup toolchain list -v
cargo-build-bpf child: cargo +bpf build --target bpfel-unknown-unknown --release
Updating crates.io index
error: failed to select a version for the requirement `aho-corasick = "^1.0.0"`
candidate versions found which didn't match: 0.7.20, 0.7.19, 0.7.18, ...
location searched: crates.io index
required by package `regex v1.8.3`
... which satisfies dependency `regex = "^1.0.3"` (locked to 1.8.3) of package `env_logger v0.8.4`
... which satisfies dependency `env_logger = "^0.8.3"` (locked to 0.8.4) of package `solana-logger v1.8.16`
... which satisfies dependency `solana-logger = "=1.8.16"` (locked to 1.8.16) of package `solana-frozen-abi v1.8.16`
... which satisfies dependency `solana-frozen-abi = "=1.8.16"` (locked to 1.8.16) of package `solana-program v1.8.16`
... which satisfies dependency `solana-program = "^1.8.14"` (locked to 1.8.16) of package `local-program v0.1.0 (/home/sriram/local-program)`
我的 Cargo 和 solana-cli 版本最新稳定
我的 Cargo.toml 文件最初看起来像这样:
[package]
name = "local-program>"
version = "0.1.0"
edition = "2021"
[features]
no-entrypoint = []
[dependencies]
solana-program = "~1.8.14"
[lib]
crate-type = ["cdylib", "lib"]
我将 solana-program 的依赖版本更改为“1.14.11”。这解决了我的问题。现在已成功构建并部署。
Solana-program="1.8.14" 似乎确实是最新版本的 solana-cli 和 rust 的兼容版本。因此,将 solana 程序更改为旧版本解决了我的问题。
我使用 solana-program 2.1.0 到 .4 遇到同样的错误,稳定的 solana 版本获取 v1.42 平台工具,但不存在,下载的是 404...必须更改版本,以便它们都适合 2.1.2可以获取 v1.43 但给出构建错误
warning: [email protected]: include/ring-core/target.h:64:2: error: "Unknown target CPU"
warning: [email protected]: 64 | #error "Unknown target CPU"
warning: [email protected]: | ^
warning: [email protected]: In file included from crypto/mem.c:58:
warning: [email protected]: In file included from crypto/internal.h:115:
warning: [email protected]: include/ring-core/check.h:27:11: and build fails
mine asks for solana-pubkey feature that is a dependency therfore cannot be used as a feature!!!
myenvjustinlanouette@iMac-de-Justin sns-integration % cargo update
Updating crates.io index
error: failed to select a version for `solana-pubkey`.
... required by package `solana-program v2.1.4`
... which satisfies dependency `solana-program = "^2.1.4"` of package `sns-integration v0.1.0 (/Users/justinlanouette/Metaverse-Developement/anarcrypt.sol/programs/sns-integration)`
versions that meet the requirements `=2.1.4` are: 2.1.4
the package `solana-program` depends on `solana-pubkey`, with features: `solana-sha256-hasher` but `solana-pubkey` does not have these features.
It has an optional dependency with that name, but that dependency uses the "dep:" syntax in the features table, so it does not have an implicit feature with that name.
无法为
solana-pubkey
选择可以解决此冲突的版本
我的环境