【问题标题】:anchor build error: got target is not supported锚构建错误:不支持获取目标
【发布时间】:2022-06-17 23:00:27
【问题描述】:

问题 当我尝试运行锚构建时,出现以下错误:

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;feat:1006352700)

rustup 1.24.3 (ce5817a94 2021-05-31)

rustc 1.61.0 (fe5b13d68 2022-05-18)

锚-cli 0.24.2

【问题讨论】:

  • 运行 cargo build-bpf 时,我遇到了同样的问题。只是用 cargo build 运行它是没有错误的。

标签: rust anchor solana


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-29
    • 2017-05-06
    • 2018-08-18
    • 2019-12-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多