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

Compile error with wasm-pack build #145

Open
mmulli opened this issue Jan 10, 2022 · 2 comments
Open

Compile error with wasm-pack build #145

mmulli opened this issue Jan 10, 2022 · 2 comments

Comments

@mmulli
Copy link

mmulli commented Jan 10, 2022

Hi,

It seems that there is an issue with wasm / wasm-pack when using the latest crates.io glyph_brush 0.7.3 The following rust wasm compile errors are generated after calling wasm-pack build:

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
   --> <blanked out path>/getrandom-0.2.3/src/lib.rs:219:9
    |
219 | /         compile_error!("the wasm32-unknown-unknown target is not supported by \
220 | |                         default, you may need to enable the \"js\" feature. \
221 | |                         For more information see: \
222 | |                         https://docs.rs/getrandom/#webassembly-support");
    | |________________________________________________________________________^

error[E0433]: failed to resolve: use of undeclared crate or module `imp`
   --> /<blanked out path>/getrandom-0.2.3/src/lib.rs:246:5
    |
246 |     imp::getrandom_inner(dest)
    |     ^^^ use of undeclared crate or module `imp`

To get the error I just added a dependency to that version of glyph brush to an existing wasm-pack based project of mine.

My guess is that the following section in toml is getting built on WASM that for some reason my configuration is always returning false and then building it. I wonder if this is something to do with wasm pack or perhaps the new target family options need to be used?

# enable twox-hash rand/std everywhere except wasm
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.twox-hash]
version = "1.6.1"
features = ["std"]

Built with

wasm-pack 0.10.1
rust: rustc 1.59.0-nightly
glyph_brush = 0.7.3

@alexheretic
Copy link
Owner

The manifest allows cargo check --target wasm32-unknown-unknown to work. I'm not sure why a wasm-pack project wouldn't work.

@mmulli
Copy link
Author

mmulli commented Jan 11, 2022

Okay thats good to know. If i still can't work out why wasm-pack is having issues i'll raise it over in that project.

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