rust 锚构建错误:不支持获取的目标

0wi1tuuw  于 2023-06-23  发布在  其他
关注(0)|答案(2)|浏览(112)

当我尝试运行锚构建时,我得到以下错误:

error: target is not supported, for more information see: https://docs.rs/getrandom/#unsupported-targets
   --> /Users/mac/.cargo/registry/src/github.com-1ecc6299db9ec823/getrandom-0.1.16/src/lib.rs:267:9
    |
267 | /         compile_error!("\
268 | |             target is not supported, for more information see: \
269 | |             https://docs.rs/getrandom/#unsupported-targets\
270 | |         ");
    | |___________^

error[E0433]: failed to resolve: use of undeclared crate or module `imp`
   --> /Users/mac/.cargo/registry/src/github.com-1ecc6299db9ec823/getrandom-0.1.16/src/lib.rs:292:5
    |
292 |     imp::getrandom_inner(dest)
    |     ^^^ use of undeclared crate or module `imp`

For more information about this error, try `rustc --explain E0433`.
error: could not compile `getrandom` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: build failed

环境:
solana-cli 1.8.13(src:42c3fbc1; 1006352700)
rustup 1.24.3(ce5817a94 2021-05-31)
rustc 1.61.0(fe5b13d68 2022-05-18)
anchor-cli 0.24.2

qxgroojn

qxgroojn1#

看起来您在锚项目中包含了一个依赖项,该依赖项使用了bpf上不可用的rng。通常这是尝试在链上程序中包含加密包的结果。

5ssjco0h

5ssjco0h2#

我面临着同样的问题,这对我来说是基于这个X1 E0 F1 X。
从cargo.toml:
getrandom = { version =“0.2”,features = [“custom”] }

相关问题