-
Notifications
You must be signed in to change notification settings - Fork 275
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
Improve WASM build #661
Improve WASM build #661
Conversation
In `lib.rs` unit tests we are getting build warnings because of how we are importing things, just import with `super::*` unconditionally and be done with it.
We currently use the `cc::Build::flag_if_supported` function to pass in `-Wno-unused-function` however when building for wasm the flag is ignored. Using plain old `flag` seems to work, found by trial and error, I did no further investigation as to why it works and the other does not. Resolves: rust-bitcoin#434
`libc v0.2.149` for the `wasm-unknown-unknown` target does not include the struct `max_align_t`. Feature gate the test that uses it so it doesn't get built in for WASM builds.
@@ -19,7 +19,7 @@ fn main() { | |||
base_config.include("depend/secp256k1/") | |||
.include("depend/secp256k1/include") | |||
.include("depend/secp256k1/src") | |||
.flag_if_supported("-Wno-unused-function") // some ecmult stuff is defined but not used upstream | |||
.flag("-Wno-unused-function") // some ecmult stuff is defined but not used upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this needs bug report against cc
(but we should check with the newest version first).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. This change seems pretty sketchy.
use std::mem; | ||
use std::os::raw; | ||
use crate::{types, AlignedType}; | ||
#[cfg(not(target_arch = "wasm32"))] | ||
use crate::AlignedType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we redefine the type to be something else on wasm?
dd6bf7c Fix unit test import statements (Tobin C. Harding) Pull request description: In `lib.rs` unit tests we are getting build warnings because of how we are importing things, just import with `super::*` unconditionally and be done with it. This patch is the only good one out of #661. ACKs for top commit: apoelstra: ACK dd6bf7c Kixunil: ACK dd6bf7c Tree-SHA512: 3970f4c1374ec6de4798bfb52b561e9ac4611ec3a3885edc79639566f777e1fbb502cb36fa7abd015f3fd4a9ca4b6a4931b4ecb2e629e967b4e49391db97a97f
Currently we are getting a bunch of warnings when building for WASM, this fixes a few of them leaving just the ones described in #660.
I can't figure out #660 so far.
Fix: #434