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

WASM is broken #254

Closed
uncomputable opened this issue Oct 18, 2024 · 3 comments
Closed

WASM is broken #254

uncomputable opened this issue Oct 18, 2024 · 3 comments

Comments

@uncomputable
Copy link
Collaborator

It looks like we broke WASM in c22f9de.

cargo build --target wasm32-unknown-unknown stops working after this commit.

It looks like secp256k1-zkp includes a problematic printf statement.

The following warnings were emitted during compilation:

warning: [email protected]: In file included from depend/secp256k1/src/secp256k1.c:23:
warning: [email protected]: In file included from depend/secp256k1/src/assumptions.h:12:
warning: [email protected]: depend/secp256k1/src/util.h:30:5: error: call to undeclared library function 'printf' with type 'int (const char *, ...)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
warning: [email protected]:     printf("{");
warning: [email protected]:     ^
warning: [email protected]: depend/secp256k1/src/util.h:30:5: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
warning: [email protected]: 1 error generated.

error: failed to run custom build command for `secp256k1-zkp-sys v0.10.0`

Caused by:
  process didn't exit successfully: `/home/user/Documents/blockstream/simplicity/rust/target/debug/build/secp256k1-zkp-sys-0b7c6fc4cb93b432/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("wasm32-unknown-unknown")
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_wasm32-unknown-unknown
  CC_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CC_wasm32_unknown_unknown
  CC_wasm32_unknown_unknown = Some("/nix/store/a5hh7zbxh9d6xchvqv9agr29yghgr7mj-clang-16.0.6/bin/clang-16")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  cargo:rerun-if-env-changed=CFLAGS_wasm32-unknown-unknown
  CFLAGS_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32_unknown_unknown
  CFLAGS_wasm32_unknown_unknown = Some("-I /nix/store/adsq99a3vsbw3kifg7y0qh1ph0jcabv4-clang-16.0.6-lib/lib/clang/16/include/")
  cargo:rerun-if-env-changed=CC_wasm32-unknown-unknown
  CC_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CC_wasm32_unknown_unknown
  CC_wasm32_unknown_unknown = Some("/nix/store/a5hh7zbxh9d6xchvqv9agr29yghgr7mj-clang-16.0.6/bin/clang-16")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32-unknown-unknown
  CFLAGS_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32_unknown_unknown
  CFLAGS_wasm32_unknown_unknown = Some("-I /nix/store/adsq99a3vsbw3kifg7y0qh1ph0jcabv4-clang-16.0.6-lib/lib/clang/16/include/")
  running: "/nix/store/a5hh7zbxh9d6xchvqv9agr29yghgr7mj-clang-16.0.6/bin/clang-16" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=wasm32-unknown-unknown" "-I" "/nix/store/adsq99a3vsbw3kifg7y0qh1ph0jcabv4-clang-16.0.6-lib/lib/clang/16/include/" "-I" "depend/secp256k1/" "-I" "depend/secp256k1/include" "-I" "depend/secp256k1/src" "-I" "wasm-sysroot" "-DSECP256K1_BUILD=" "-DENABLE_MODULE_SURJECTIONPROOF=1" "-DENABLE_MODULE_GENERATOR=1" "-DENABLE_MODULE_RANGEPROOF=1" "-DENABLE_MODULE_ECDSA_ADAPTOR=1" "-DENABLE_MODULE_WHITELIST=1" "-DECMULT_GEN_PREC_BITS=4" "-DUSE_NUM_NONE=1" "-DUSE_FIELD_INV_BUILTIN=1" "-DUSE_SCALAR_INV_BUILTIN=1" "-DECMULT_WINDOW_SIZE=15" "-DUSE_EXTERNAL_DEFAULT_CALLBACKS=1" "-o" "/home/user/Documents/blockstream/simplicity/rust/target/wasm32-unknown-unknown/debug/build/secp256k1-zkp-sys-b3c85c87fe7a5c8f/out/depend/secp256k1/contrib/lax_der_parsing.o" "-c" "depend/secp256k1/contrib/lax_der_parsing.c"
  exit status: 0
  running: "/nix/store/a5hh7zbxh9d6xchvqv9agr29yghgr7mj-clang-16.0.6/bin/clang-16" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=wasm32-unknown-unknown" "-I" "/nix/store/adsq99a3vsbw3kifg7y0qh1ph0jcabv4-clang-16.0.6-lib/lib/clang/16/include/" "-I" "depend/secp256k1/" "-I" "depend/secp256k1/include" "-I" "depend/secp256k1/src" "-I" "wasm-sysroot" "-DSECP256K1_BUILD=" "-DENABLE_MODULE_SURJECTIONPROOF=1" "-DENABLE_MODULE_GENERATOR=1" "-DENABLE_MODULE_RANGEPROOF=1" "-DENABLE_MODULE_ECDSA_ADAPTOR=1" "-DENABLE_MODULE_WHITELIST=1" "-DECMULT_GEN_PREC_BITS=4" "-DUSE_NUM_NONE=1" "-DUSE_FIELD_INV_BUILTIN=1" "-DUSE_SCALAR_INV_BUILTIN=1" "-DECMULT_WINDOW_SIZE=15" "-DUSE_EXTERNAL_DEFAULT_CALLBACKS=1" "-o" "/home/user/Documents/blockstream/simplicity/rust/target/wasm32-unknown-unknown/debug/build/secp256k1-zkp-sys-b3c85c87fe7a5c8f/out/depend/secp256k1/src/secp256k1.o" "-c" "depend/secp256k1/src/secp256k1.c"
  cargo:warning=In file included from depend/secp256k1/src/secp256k1.c:23:

  cargo:warning=In file included from depend/secp256k1/src/assumptions.h:12:

  cargo:warning=depend/secp256k1/src/util.h:30:5: error: call to undeclared library function 'printf' with type 'int (const char *, ...)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

  cargo:warning=    printf("{");

  cargo:warning=    ^

  cargo:warning=depend/secp256k1/src/util.h:30:5: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'

  cargo:warning=1 error generated.

  exit status: 1

  --- stderr


  error occurred: Command "/nix/store/a5hh7zbxh9d6xchvqv9agr29yghgr7mj-clang-16.0.6/bin/clang-16" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=wasm32-unknown-unknown" "-I" "/nix/store/adsq99a3vsbw3kifg7y0qh1ph0jcabv4-clang-16.0.6-lib/lib/clang/16/include/" "-I" "depend/secp256k1/" "-I" "depend/secp256k1/include" "-I" "depend/secp256k1/src" "-I" "wasm-sysroot" "-DSECP256K1_BUILD=" "-DENABLE_MODULE_SURJECTIONPROOF=1" "-DENABLE_MODULE_GENERATOR=1" "-DENABLE_MODULE_RANGEPROOF=1" "-DENABLE_MODULE_ECDSA_ADAPTOR=1" "-DENABLE_MODULE_WHITELIST=1" "-DECMULT_GEN_PREC_BITS=4" "-DUSE_NUM_NONE=1" "-DUSE_FIELD_INV_BUILTIN=1" "-DUSE_SCALAR_INV_BUILTIN=1" "-DECMULT_WINDOW_SIZE=15" "-DUSE_EXTERNAL_DEFAULT_CALLBACKS=1" "-o" "/home/user/Documents/blockstream/simplicity/rust/target/wasm32-unknown-unknown/debug/build/secp256k1-zkp-sys-b3c85c87fe7a5c8f/out/depend/secp256k1/src/secp256k1.o" "-c" "depend/secp256k1/src/secp256k1.c" with args "clang-16" did not execute successfully (status code exit status: 1).


warning: build failed, waiting for other jobs to finish...
@apoelstra
Copy link
Collaborator

We can port rust-bitcoin/rust-secp256k1#735 to rust-secp256k1-zkp.

But WASM is broken everywhere this morning.

@uncomputable
Copy link
Collaborator Author

@uncomputable
Copy link
Collaborator Author

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