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 "wasm32-unknown-unknown target is not supported by default" #215

Closed
danforbes opened this issue Aug 6, 2021 · 4 comments

Comments

@danforbes
Copy link

My Substrate build is failing with the following error:

  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
     --> ~/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/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`
     --> ~/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/getrandom-0.2.3/src/lib.rs:246:5
      |
  246 |     imp::getrandom_inner(dest)
      |     ^^^ use of undeclared crate or module `imp`
@nuke-web3
Copy link
Contributor

This the base template? I will look where getrandom-0.2.3 in the lock file and dig for what uses it... I suspect this is leaking std in your runtime?

@danforbes
Copy link
Author

danforbes commented Aug 7, 2021

Second Edit: the standard Node Template builds, so I must have some misconfiguration in my private repo. Let me see if I can try to create a minimal reproducible example.


Edit: the below was a red herring. I just needed to change the SUBSTRATE_GIT_URL in this file https://github.com/paritytech/substrate/blob/master/.maintain/node-template-release/src/main.rs I'm building a fresh Node Template now to double-check if I get the same error (unsupported wasm32-unknown-unknown target) as I do in my private repo.


I am working off this branch of Substrate https://github.com/danforbes/substrate/tree/danforbes/nonfungibles-create, which includes some changes I need (i.e. paritytech/substrate#9206). I tried to build a clean Node Template and actually got this error:

error: failed to get `frame-benchmarking` as a dependency of package `node-template v3.0.0 (/tmp/.tmpaG9kpM/node-template/node)`

Caused by:
  failed to load source for dependency `frame-benchmarking`

Caused by:
  Unable to update https://github.com/paritytech/substrate.git?rev=4e7c2d8032d1d2d44eef92d36335a5910027c89c

Caused by:
  revspec '4e7c2d8032d1d2d44eef92d36335a5910027c89c' not found; class=Reference (4); code=NotFound (-3)
thread 'main' panicked at 'assertion failed: Command::new(\"cargo\").args(&[\"build\",\n                             \"--all\"]).current_dir(path).status().expect(\"Compiles node\").success()', src/main.rs:183:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Interestingly, the error that motivated me to open this Issue did not appear until I started benchmarking a custom pallet in a private fork of the Node Template.

@danforbes
Copy link
Author

This was caused by user error. I was leaking std through sp-runtime, which I didn't configure properly in my pallet's Cargo.toml file. Thanks for the comment/hint, @nukemandan 💪🏻

@ltfschoen
Copy link

i removed sp-keyring from Cargo.toml and that resolved it

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