Open uncomputable opened 2 days ago
It looks like we broke WASM in c22f9de669f41c0f3c5738326e5235e5ad03af98.
cargo build --target wasm32-unknown-unknown stops working after this commit.
cargo build --target wasm32-unknown-unknown
It looks like secp256k1-zkp includes a problematic printf statement.
The following warnings were emitted during compilation: warning: secp256k1-zkp-sys@0.10.0: In file included from depend/secp256k1/src/secp256k1.c:23: warning: secp256k1-zkp-sys@0.10.0: In file included from depend/secp256k1/src/assumptions.h:12: warning: secp256k1-zkp-sys@0.10.0: 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: secp256k1-zkp-sys@0.10.0: printf("{"); warning: secp256k1-zkp-sys@0.10.0: ^ warning: secp256k1-zkp-sys@0.10.0: depend/secp256k1/src/util.h:30:5: note: include the header <stdio.h> or explicitly provide a declaration for 'printf' warning: secp256k1-zkp-sys@0.10.0: 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...
We can port https://github.com/rust-bitcoin/rust-secp256k1/pull/735 to rust-secp256k1-zkp.
But WASM is broken everywhere this morning.
See https://github.com/BlockstreamResearch/rust-secp256k1-zkp/pull/86
It looks like we broke WASM in c22f9de669f41c0f3c5738326e5235e5ad03af98.
cargo build --target wasm32-unknown-unknown
stops working after this commit.It looks like secp256k1-zkp includes a problematic printf statement.