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

no_std doesn't work for wasm_unkown_unknown target #176

Closed
brenzi opened this issue Jan 20, 2021 · 5 comments
Closed

no_std doesn't work for wasm_unkown_unknown target #176

brenzi opened this issue Jan 20, 2021 · 5 comments

Comments

@brenzi
Copy link

brenzi commented Jan 20, 2021

We get

error: failed to run custom build command for `integritee-parachain-runtime v0.1.0 (/home/abrenzikofer/integritee-parachain/rococo-parachains/runtime)`                             
                                                                                                                                                                                    
Caused by:                                                                                                                                                                          
  process didn't exit successfully: `/home/abrenzikofer/integritee-parachain/target/release/build/integritee-parachain-runtime-40f60bc84f76a22c/build-script-build` (exit code: 1)  
  --- stdout                                                                                                                                                                        
  Information that should be included in a bug report.                                                                                                                              
  Executing build command: "/home/abrenzikofer/.rustup/toolchains/nightly-2020-10-25-x86_64-unknown-linux-gnu/bin/cargo" "-Zfeatures=build_dep" "rustc" "--target=wasm32-unknown-unk
nown" "--manifest-path=/home/abrenzikofer/integritee-parachain/target/release/wbuild/integritee-parachain-runtime/Cargo.toml" "--color=always" "--release"                          
  Using rustc version: rustc 1.49.0-nightly (ffa2e7ae8 2020-10-24)                                                                                                                  
    Compiling pallet-substratee-registry v0.7.1 (/home/abrenzikofer/pallet-substratee-registry)
  error: duplicate lang item in crate `std` (which `web_sys` depends on): `panic_impl`.
    |
    = note: the lang item is first defined in crate `sp_io` (which `frame_support` depends on)
    = note: first definition in `sp_io` loaded from /home/abrenzikofer/integritee-parachain/target/release/wbuild/integritee-parachain-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-e5cd4d276385c920.rmeta
    = note: second definition in `std` loaded from /home/abrenzikofer/.rustup/toolchains/nightly-2020-10-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libstd-b1a48c309b5fbc76.rlib

  error: duplicate lang item in crate `std` (which `web_sys` depends on): `oom`.
    |
    = note: the lang item is first defined in crate `sp_io` (which `frame_support` depends on)
    = note: first definition in `sp_io` loaded from /home/abrenzikofer/integritee-parachain/target/release/wbuild/integritee-parachain-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-e5cd4d276385c920.rmeta
    = note: second definition in `std` loaded from /home/abrenzikofer/.rustup/toolchains/nightly-2020-10-25-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libstd-b1a48c309b5fbc76.rlib

  error: aborting due to 2 previous errors

  error: could not compile `pallet-substratee-registry`

  To learn more, run the command again with --verbose.

reproduce:

git clone https://github.com/scs/integritee-parachain.git
git checkout webpki-upstream
# or, precisely the commit: 9a2e4cbde
cargo build --release
# build should work

now, include webpki in our pallet crate by switching to the webpki-debug branch here
https://github.com/scs/integritee-parachain/blob/7a9bfdb5f862c99e7b22426f0d6e004bf7ad56b2/rococo-parachains/runtime/Cargo.toml#L11

cargo build --release 

will fail with the above error.

so, the changes causing the error are:
integritee-network/pallet-teerex@69a96ad

In the end, we'll need alloc too, but I tried to isolate the issue as much as possible

@briansmith
Copy link
Owner

Please try the latest main branch version of webpki, with the alloc feature enabled, and report back.

@brenzi
Copy link
Author

brenzi commented Jan 20, 2021

I already picked the latest commit on main branch for the above

@brenzi
Copy link
Author

brenzi commented Jan 20, 2021

and if I enable alloc its the same err

@briansmith
Copy link
Owner

Currently WebAssembly isn't supported by webpki yet See issue #141. I expanded the explanation in that issue of what needs to happen based on your report here.

My guess is that you aren't targeting a web browser environment and so the web-sys crate shouldn't be used for your target environment. Since ring currently unconditionally requires web-sys for wasm32-unknown-unknown, we'd need to resolve that in ring by fixing briansmith/ring#1172. I suspect this will is the thing most likely to resolve the "duplicate lang item" problem you reported above.

However, in order to successfully use webpki in WebAssembly, after that initial hurdle is crossed, all of the stuff mentioned in #141 needs to be fixed.

If you agree, let's close this as a dupe of issue #141.

@brenzi
Copy link
Author

brenzi commented Jan 21, 2021

Correct, we're not targeting a web broweser env. The substrate framework has its own replacement of std (sp-std on crates.io). This may conflict with web-sys.
so this is likely a dupe

@brenzi brenzi closed this as completed Jan 21, 2021
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