Skip to content

Build fault when --target wasm32-unknown-unknown --release #769

@ipconfiger

Description

@ipconfiger

in Cargo.toml

[lib]
crate-type = ["cdylib"]

[dependencies]
secp256k1 = {version = "0.30.0", features = ["std", "rand", "serde", "hashes"]}

but when i run cargo build --target wasm32-unknown-unknown --release

error: the wasm*-unknown-unknown targets are not supported by default, you may need to enable the "js" feature. For more information see: https://docs.rs/getrandom/#webassembly-support
   --> /Users/alex/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/getrandom-0.2.15/src/lib.rs:342:9
    |
342 | /         compile_error!("the wasm*-unknown-unknown targets are not supported by \
343 | |                         default, you may need to enable the \"js\" feature. \
344 | |                         For more information see: \
345 | |                         https://docs.rs/getrandom/#webassembly-support");
    | |________________________________________________________________________^

error[E0433]: failed to resolve: use of undeclared crate or module `imp`
   --> /Users/alex/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/getrandom-0.2.15/src/lib.rs:398:9
    |
398 |         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` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions