-
Notifications
You must be signed in to change notification settings - Fork 12
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
Post compilation error when adding additional substrate crate #71
Comments
I've fixed the issue in the following PR: https://github.com/ChainSafe/integrations/pull/1/files FixThe steps to fix this can be found in the build steps listed within the
RUN cargo install -f wasm-bindgen-cli
ENV WASM_INTERFACE_TYPES=1
RUN wasm-bindgen ./module/target/wasm32-unknown-unknown/release/module.wasm --out-dir ./build --out-name bg_module.wasm
Debugging InformationAfter looking at the (import "__wbindgen_placeholder__" "__wbindgen_describe" (func $__wbindgen_placeholder__.__wbindgen_describe (type $t4)))
(import "__wbindgen_externref_xform__" "__wbindgen_externref_table_grow" (func $__wbindgen_externref_xform__.__wbindgen_externref_table_grow (type $t6)))
(import "__wbindgen_externref_xform__" "__wbindgen_externref_table_set_null" (func $__wbindgen_externref_xform__.__wbindgen_externref_table_set_null (type $t4)))
(import "__wbindgen_placeholder__" "__wbindgen_throw" (func $__wbindgen_placeholder__.__wbindgen_throw (type $t2))) I tried to find ways to remove these imports, and realized that a I then deduced that these strange imports are probably "placeholder" imports that are later processed by the (import "./bg_module.wasm_bg.js" "__wbindgen_throw" (func $./bg_module.wasm_bg.js.__wbindgen_throw (type $t1))) Why only a single "throw" import? This is probably because none of the types that are being used with wasm-bindgen ever cross the wasm-boundary, so their serialization methods do not needs to be added. Now we just need to find a way to remove this single import, as it isn't necessary. I opened up the A simple Perfect! Now we just need to figure out how to get this routine to run. Looks like the After enabling this flag, and running |
Using
sp-core
works without problem, but then adding the additional substrate crate:sp-runtime
,sp-version
,sp-std
,sp-keyring
will make a compilation issue.our fork in branch substrate-integration.
Primary investigation suggest that this is cause by usage of
wasm-bindgem
which is coming fromgetrandom
crate.Take note that the
getrandom
crate was included beforehand in the crates'Cargo.toml
together withsp-core
and it works without problems. It's when the other 4 crates:sp-runtime
,sp-version
,sp-std
,sp-keyring
where it makes the compilation issue occur.The text was updated successfully, but these errors were encountered: