1

When I execute the command cargo build-bpf, I encounter an error. How can I resolve this issue?

error: target is not supported, for more information see: https://docs.rs/getrandom/#unsupported-targets
   --> 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`
   --> src/lib.rs:291:5
    |
291 |     imp::getrandom_inner(dest)
    |     ^^^ use of undeclared crate or module `imp

Cargo.toml

...

[dependencies]
solana-program = "=1.16.24"
thiserror = "1.0.48"
spl-token = {version = "4.0.0", features = ["no-entrypoint"]}
spl-associated-token-account = {version = "2.2.0", features = ["no-entrypoint"]}
borsh = "0.10.3"
solana-sdk = "1.16.24"

solana-cli 1.16.24
rustup 1.26.0
rustc 1.68.0

1 Answer 1

4

I have identified the issue. The solana-sdk is designed for off-chain use only, so it should be removed from the dependencies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.