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

bug: Wasm32 compilation issues on 1.0.0 #21

Closed
KirilMihaylov opened this issue Dec 2, 2022 · 5 comments
Closed

bug: Wasm32 compilation issues on 1.0.0 #21

KirilMihaylov opened this issue Dec 2, 2022 · 5 comments

Comments

@KirilMihaylov
Copy link

Description & observations

Issue has appeared when we switched from cw-storage-plus 0.16.0 to cw-storage-plus 1.0.0.
Main difference in dependencies that I have spotted is the addition of k256 which depends on rand_core, thus getrandom.

Building with cw-storage-plus 0.16.0 continues to work flawlessly, so in case anyone else encounters this, just revert back.

Reproduction

Prerequisites

  • Cargo.toml
[package]
name = "bug"
version = "0.1.0"
edition = "2021"

[dependencies]
cw-storage-plus = "1.0.0"
  • src/lib.rs
/* Empty */

Steps to reproduce

Build command: cargo build --target wasm32-unknown-unknown

Error

   Compiling getrandom v0.2.8
error: the wasm32-unknown-unknown target is not supported by default, you may need to enable the "js" feature. For more information see: https://docs.rs/getrandom/#webassembly-support
   --> /home/kiril/.cargo/registry/src/github.com-1ecc6299db9ec823/getrandom-0.2.8/src/lib.rs:263:9
    |
263 | /         compile_error!("the wasm32-unknown-unknown target is not supported by \
264 | |                         default, you may need to enable the \"js\" feature. \
265 | |                         For more information see: \
266 | |                         https://docs.rs/getrandom/#webassembly-support");
    | |________________________________________________________________________^

error[E0433]: failed to resolve: use of undeclared crate or module `imp`
   --> /home/kiril/.cargo/registry/src/github.com-1ecc6299db9ec823/getrandom-0.2.8/src/lib.rs:290:5
    |
290 |     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` due to 2 previous errors
@KirilMihaylov
Copy link
Author

Apologies.
Duplicate of #19.

@KirilMihaylov KirilMihaylov closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 2022
@KirilMihaylov
Copy link
Author

Reopening as solution from #19 to add "resolver = 2" doesn't solve problem.
I'd like to stress on the fact that, even with #20 removing it explicitly from this crate, it gets pulled by k256.

@KirilMihaylov KirilMihaylov reopened this Dec 2, 2022
@webmaster128
Copy link
Member

I'd like to stress on the fact that, even with #20 removing it explicitly from this crate, it gets pulled by k256.

What do you mean by "gets pulled"? having getrandom in the dependency tree and Cargo.lock is expected. However, it should not be compiled to Wasm.

@webmaster128
Copy link
Member

Oh, wait a second ... Adding k256 here https://github.com/CosmWasm/cw-storage-plus/blob/v1.0.0/Cargo.toml#L34 was not a good idea. Can be fixed with #18.

@webmaster128
Copy link
Member

Closing as duplicate of #19 (not yet fixed)

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

2 participants