Skip to content

Build fails with wasm-bindgen feature in rand crate #682

Closed

Description

@gridbugs

To reproduce:

cargo build --target=wasm32-unknown-unknown --features=wasm-bindgen

Error:

error[E0463]: can't find crate for `wasm_bindgen`                                                                                                                                                                                                                                
   --> src/lib.rs:729:9                                                                                                                                                                                                                                                          
    |                                                                                                                                                                                                                                                                            
729 |         extern crate wasm_bindgen;                                                                                                                                                                                                                                         
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                 
error: aborting due to previous error                  

Looks like the rand crate depends on wasm-bindgen (when the appropriate flag/target is set), but this dependency isn't in the manifest.

Activity

  1. dhardy commented on Jan 6, 2019

    @dhardy
    Member

    I see; the __wbg_shims is in the wrong crate.

  2. added a commit that references this issue on Jan 8, 2019
    3145af1
  3. dhardy commented on Jan 8, 2019

    @dhardy
    Member

    @stevebob would you be able to put together a minimal test crate for rand + wasm-bindgen? Currently we can only test builds. It would be good to add full integration testing, e.g. as a crate under the tests dir.

  4. added a commit that references this issue on Jan 8, 2019
    4336232
  5. gridbugs commented on Jan 8, 2019

    @gridbugs
    ContributorAuthor

    Will do!

  6. rjgeek commented on Jan 4, 2020

    @rjgeek

    so far, are there any good solution, I am facing the same issues
    Compiling rand_os v0.1.3 error[E0463]: can't find crate for wasm_bindgen --> /home/xxx/cargo/registry/src/github.com-1ecc6299db9ec823/rand_os-0.1.3/src/lib.rs:138:1 | 138 | extern crate wasm_bindgen; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate@stevebob, @dhardy

  7. dhardy commented on Jan 4, 2020

    @dhardy
    Member

    @rjgeek I think a new issue would be appropriate; this one's quite old. When you do, post the output of cargo tree install from here.

  8. rjgeek commented on Jan 5, 2020

    @rjgeek

    @dhardy thank you for your kindly response. The output of cargo tree is shown as follows.
    It would be nicer if you can give me more guide

    ➜  service git:(master) ✗ cargo tree
    test  v0.1.0 (/home/xxx /service)
    ├── byteorder v1.3.2
    ├── failure v0.1.6
    │   ├── backtrace v0.3.40
    │   │   ├── backtrace-sys v0.1.32
    │   │   │   └── libc v0.2.66
    │   │   │   [build-dependencies]
    │   │   │   └── cc v1.0.48
    │   │   ├── cfg-if v0.1.10
    │   │   ├── libc v0.2.66 (*)
    │   │   └── rustc-demangle v0.1.16
    │   └── failure_derive v0.1.6
    │       ├── proc-macro2 v1.0.7
    │       │   └── unicode-xid v0.2.0
    │       ├── quote v1.0.2
    │       │   └── proc-macro2 v1.0.7 (*)
    │       ├── syn v1.0.13
    │       │   ├── proc-macro2 v1.0.7 (*)
    │       │   ├── quote v1.0.2 (*)
    │       │   └── unicode-xid v0.2.0 (*)
    │       └── synstructure v0.12.3
    │           ├── proc-macro2 v1.0.7 (*)
    │           ├── quote v1.0.2 (*)
    │           ├── syn v1.0.13 (*)
    │           └── unicode-xid v0.2.0 (*)
    ├── hex_fmt v0.3.0
    ├── lazy_static v1.4.0
    ├── log v0.4.8
    │   └── cfg-if v0.1.10 (*)
    ├── map_vec v0.2.6
    │   └── serde v1.0.104
    │       └── serde_derive v1.0.104
    │           ├── proc-macro2 v1.0.7 (*)
    │           ├── quote v1.0.2 (*)
    │           └── syn v1.0.13 (*)
    │       [dev-dependencies]
    │       └── serde_derive v1.0.104 (*)
    ├── oasis-std v0.2.8
    │   ├── blockchain-traits v0.2.3
    │   │   └── oasis-types v0.3.1
    │   │       ├── anyhow v1.0.26
    │   │       ├── derive_more v0.15.0
    │   │       │   ├── lazy_static v1.4.0 (*)
    │   │       │   ├── proc-macro2 v0.4.30
    │   │       │   │   └── unicode-xid v0.1.0
    │   │       │   ├── quote v0.6.13
    │   │       │   │   └── proc-macro2 v0.4.30 (*)
    │   │       │   ├── regex v1.3.1
    │   │       │   │   ├── aho-corasick v0.7.6
    │   │       │   │   │   └── memchr v2.2.1
    │   │       │   │   ├── memchr v2.2.1 (*)
    │   │       │   │   ├── regex-syntax v0.6.12
    │   │       │   │   └── thread_local v0.3.6
    │   │       │   │       └── lazy_static v1.4.0 (*)
    │   │       │   └── syn v0.15.44
    │   │       │       ├── proc-macro2 v0.4.30 (*)
    │   │       │       ├── quote v0.6.13 (*)
    │   │       │       └── unicode-xid v0.1.0 (*)
    │   │       │   [build-dependencies]
    │   │       │   └── rustc_version v0.2.3
    │   │       │       └── semver v0.9.0
    │   │       │           └── semver-parser v0.7.0
    │   │       ├── hex v0.4.0
    │   │       └── thiserror v1.0.9
    │   │           └── thiserror-impl v1.0.9
    │   │               ├── proc-macro2 v1.0.7 (*)
    │   │               ├── quote v1.0.2 (*)
    │   │               └── syn v1.0.13 (*)
    │   ├── cfg-if v0.1.10 (*)
    │   ├── failure v0.1.6 (*)
    │   ├── oasis-macros v0.2.2
    │   │   ├── proc-macro2 v1.0.7 (*)
    │   │   ├── quote v1.0.2 (*)
    │   │   ├── syn v1.0.13 (*)
    │   │   └── tiny-keccak v1.5.0
    │   │       └── crunchy v0.2.2
    │   ├── oasis-types v0.3.1 (*)
    │   ├── serde v1.0.104 (*)
    │   ├── serde_cbor v0.10.2
    │   │   ├── byteorder v1.3.2 (*)
    │   │   ├── half v1.4.0
    │   │   └── serde v1.0.104 (*)
    │   └── tiny-keccak v1.5.0 (*)
    ├── pairing v0.14.2
    │   ├── byteorder v1.3.2 (*)
    │   └── rand v0.4.6
    │       └── libc v0.2.66 (*)
    ├── rand v0.6.5
    │   ├── libc v0.2.66 (*)
    │   ├── rand_chacha v0.1.1
    │   │   └── rand_core v0.3.1
    │   │       └── rand_core v0.4.2
    │   │   [build-dependencies]
    │   │   └── autocfg v0.1.7
    │   ├── rand_core v0.4.2 (*)
    │   ├── rand_hc v0.1.0
    │   │   └── rand_core v0.3.1 (*)
    │   ├── rand_isaac v0.1.1
    │   │   └── rand_core v0.3.1 (*)
    │   ├── rand_jitter v0.1.4
    │   │   └── rand_core v0.4.2 (*)
    │   ├── rand_os v0.1.3
    │   │   ├── libc v0.2.66 (*)
    │   │   └── rand_core v0.4.2 (*)
    │   ├── rand_pcg v0.1.2
    │   │   └── rand_core v0.4.2 (*)
    │   │   [build-dependencies]
    │   │   └── autocfg v0.1.7 (*)
    │   └── rand_xorshift v0.1.1
    │       └── rand_core v0.3.1 (*)
    │   [build-dependencies]
    │   └── autocfg v0.1.7 (*)
    ├── rand04_compat v0.1.1
    │   ├── rand v0.6.5 (*)
    │   └── rand04 v0.1.1
    │       └── rand v0.4.6 (*)
    ├── rand_chacha v0.1.1 (*)
    ├── serde v1.0.104 (*)
    ├── tiny-keccak v1.5.0 (*)
    ├── wasm-bindgen v0.2.56
    │   ├── cfg-if v0.1.10 (*)
    │   └── wasm-bindgen-macro v0.2.56
    │       ├── quote v1.0.2 (*)
    │       └── wasm-bindgen-macro-support v0.2.56
    │           ├── proc-macro2 v1.0.7 (*)
    │           ├── quote v1.0.2 (*)
    │           ├── syn v1.0.13 (*)
    │           ├── wasm-bindgen-backend v0.2.56
    │           │   ├── bumpalo v2.6.0
    │           │   ├── lazy_static v1.4.0 (*)
    │           │   ├── log v0.4.8 (*)
    │           │   ├── proc-macro2 v1.0.7 (*)
    │           │   ├── quote v1.0.2 (*)
    │           │   ├── syn v1.0.13 (*)
    │           │   └── wasm-bindgen-shared v0.2.56
    │           └── wasm-bindgen-shared v0.2.56 (*)
    └── zeroize v1.1.0
    [dev-dependencies]
    └── oasis-test v0.2.2
        ├── blockchain-traits v0.2.3 (*)
        ├── memchain v0.2.4
        │   ├── blockchain-traits v0.2.3 (*)
        │   └── oasis-types v0.3.1 (*)
        ├── oasis-macros v0.2.2 (*)
        └── oasis-types v0.3.1 (*)
    
    
  9. dhardy commented on Jan 5, 2020

    @dhardy
    Member

    As I said, a new issue please. It's not the same cause.

    Upgrading to Rand 0.7 may fix it; that said we should try to support version 0.6 too.

  10. rjgeek commented on Jan 7, 2020

    @rjgeek

    The problem is that I want to use "rand04_compat" package. But "rand04_compat" package does not support Rand 0.7, and I have to back to back to rand 0.6, but rand 0.6 has the above issues. It made me in a dilemma.

  11. dhardy commented on Jan 7, 2020

    @dhardy
    Member

    Create a new issue please.

    If you can reproduce with a small test crate that would be best.

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