Skip to content

Build fails for target wasm32-unknown-unknown #274

Open
@Spoonbender

Description

@Spoonbender

Compilation fails when building with --target wasm32-unknown-unknown.

The reason is due to an indirect dependency: quickcheck depends on rand with the getrandom and small_rng features. However, getrandom only supports wasm32-unknown-unknown if its js feature is specified (otherwise: the build throws an "unsupported target" error). The solution suggested by a rand core team member is to sepect getrandom with the js feature explicitly.

Build error for cargo build --target wasm32-unknown-unknown

   Compiling getrandom v0.2.2
error: target is not supported, for more information see: https://docs.rs/getrandom/#unsupported-targets
   --> C:\Users\MaayanAdmin\.cargo\registry\src\github.com-1ecc6299db9ec823\getrandom-0.2.2\src\lib.rs:213:9
    |
213 | /         compile_error!("target is not supported, for more information see: \
214 | |                         https://docs.rs/getrandom/#unsupported-targets");
    | |_________________________________________________________________________^

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

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0433`.
error: could not compile `getrandom`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions