Skip to content

Commit 942a0e5

Browse files
committed
build.rs: patch out any calls to printf
1 parent 51dab7a commit 942a0e5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

secp256k1-sys/build.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@ fn main() {
2020
.include("depend/secp256k1/include")
2121
.include("depend/secp256k1/src")
2222
.flag_if_supported("-Wno-unused-function") // some ecmult stuff is defined but not used upstream
23+
.flag_if_supported("-Wno-unused-parameter") // patching out printf causes this warning
2324
.define("SECP256K1_API", Some(""))
2425
.define("ENABLE_MODULE_ECDH", Some("1"))
2526
.define("ENABLE_MODULE_SCHNORRSIG", Some("1"))
2627
.define("ENABLE_MODULE_EXTRAKEYS", Some("1"))
27-
.define("ENABLE_MODULE_ELLSWIFT", Some("1"));
28+
.define("ENABLE_MODULE_ELLSWIFT", Some("1"))
29+
// upstream sometimes introduces calls to printf, which we cannot compile
30+
// with WASM due to its lack of libc. printf is never necessary and we can
31+
// just #define it away.
32+
.define("printf(...)", Some(""));
2833

2934
if cfg!(feature = "lowmemory") {
3035
base_config.define("ECMULT_WINDOW_SIZE", Some("4")); // A low-enough value to consume negligible memory

0 commit comments

Comments
 (0)