Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gridbugs opened this issue Jan 6, 2019 · 9 comments
Closed

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

gridbugs opened this issue Jan 6, 2019 · 9 comments

Comments

@gridbugs
Copy link
Contributor

gridbugs commented Jan 6, 2019

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.

@dhardy
Copy link
Member

dhardy commented Jan 6, 2019

I see; the __wbg_shims is in the wrong crate.

@dhardy
Copy link
Member

dhardy commented Jan 8, 2019

@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.

@dhardy dhardy closed this as completed in 3145af1 Jan 8, 2019
dhardy added a commit that referenced this issue Jan 8, 2019
@gridbugs
Copy link
Contributor Author

gridbugs commented Jan 8, 2019

Will do!

@rjgeek
Copy link

rjgeek commented Jan 4, 2020

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/git.luolix.top-1ecc6299db9ec823/rand_os-0.1.3/src/lib.rs:138:1 | 138 | extern crate wasm_bindgen; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate@stevebob, @dhardy

@dhardy
Copy link
Member

dhardy commented Jan 4, 2020

@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.

@rjgeek
Copy link

rjgeek commented Jan 5, 2020

@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 (*)

@dhardy
Copy link
Member

dhardy commented Jan 5, 2020

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.

@rjgeek
Copy link

rjgeek commented Jan 7, 2020

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.

@dhardy
Copy link
Member

dhardy commented Jan 7, 2020

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants