Skip to content

rand 0.6.2 is broken on wasm32-unknown-unknown #674

Closed

Description

@tomaka

The following line is triggered when one compiles rand on wasm32-unknown-unknown:

compile_error!("enable either wasm_bindgen or stdweb feature");

rand doesn't enable neither stdweb or wasm-bindgen in its rand_os dependency, and doesn't have any way of enabling them.

Activity

  1. netgusto commented on Jan 4, 2019

    @netgusto

    I experience this problem too.

    When I add the "wasm-bindgen" feature in my dependencies, like so:

    [dependencies]
    wasm-bindgen = "0.2"
    rand = { version = "0.6", features = ["wasm-bindgen"] }

    I get this error upon compilation:

    the package depends on `rand`, with features: `wasm_bindgen` but `rand` does not have these features.

  2. dhardy commented on Jan 4, 2019

    @dhardy
    Member

    Hmm, that's what we get for moving optional dependencies... forgetting that they are also features.

    You can directly depend on rand_os to enable the feature, but I guess we should fix by adding those features back to rand itself.

  3. ernieturner commented on Jan 7, 2019

    @ernieturner

    I seem to be running into this issue even on rand 0.6.3, but with a different error message. My dependencies are

    [dependencies]
    wasm-bindgen = {version = "~0.2.30", features = ["serde-serialize"]}
    rand = { version = "0.6", features = ["wasm-bindgen"] }
    

    Which works on rand 0.6.1, but on 0.6.3 when I try to compile it via cargo build --release --target wasm32-unknown-unknown I get the following

    error[E0463]: can't find crate for `wasm_bindgen`
       --> /Users/ernie/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.3/src/lib.rs:729:9
        |
    729 |         extern crate wasm_bindgen;
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
    

    I tried adding the rand_os line to my features array, based on some of the discussion here and in #675 but it didn't seem to change anything from what I could tell.

  4. dhardy commented on Jan 8, 2019

    @dhardy
    Member

    Yes, this is #682 which has an easy fix but I didn't get to it yet...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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