Skip to content

Commit

Permalink
Merge #488: Support non-WASM platforms that are missing string.h
Browse files Browse the repository at this point in the history
92b7333 Support non-WASM platforms that are missing `string.h` (Matt Corallo)

Pull request description:

  Dunno why we haven't seen this elsewhere, but when trying to build locally for an ARM embedded target `secp256k1-sys` failed to compile as it was missing `string.h`, just like WASM.

  This patch adds a trivial fallback - if we fail to compile initially we unconditionally retry with the wasm-sysroot, giving us a valid `string.h`.

ACKs for top commit:
  tcharding:
    ACK 92b7333
  apoelstra:
    ACK 92b7333

Tree-SHA512: 81cbc5023f349681a3bef138506d9314be948b8b7b78bb2b2ffacf43b0c97d92ea67238105009a94b05a0a3adbd4113ed68f79a0a303708d95c6a7f520d5170e
  • Loading branch information
apoelstra committed Nov 14, 2022
2 parents 8508680 + 92b7333 commit 5a54694
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions secp256k1-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ fn main() {
base_config.file("depend/secp256k1/contrib/lax_der_parsing.c")
.file("depend/secp256k1/src/precomputed_ecmult_gen.c")
.file("depend/secp256k1/src/precomputed_ecmult.c")
.file("depend/secp256k1/src/secp256k1.c")
.compile("libsecp256k1.a");
.file("depend/secp256k1/src/secp256k1.c");

if base_config.try_compile("libsecp256k1.a").is_err() {
// Some embedded platforms may not have, eg, string.h available, so if the build fails
// simply try again with the wasm sysroot (but without the wasm type sizes) in the hopes
// that it works.
base_config.include("wasm/wasm-sysroot");
base_config.compile("libsecp256k1.a");
}
}

0 comments on commit 5a54694

Please sign in to comment.