rust-bitcoin / rust-secp256k1

Rust language bindings for Bitcoin secp256k1 library.
Creative Commons Zero v1.0 Universal
338 stars 255 forks source link

Error duplicate symbol when compiling for wasm32 target #438

Open josediegorobles opened 2 years ago

josediegorobles commented 2 years ago

Hi,

I'm using last version of rust-bitcoin and I have several duplicate symbol errors when I try to compile for wasm32 target:

LIke that:

note: rust-lld: error: duplicate symbol: WASM32_INT_SIZE
[104](https://github.com/diba-io/bitmask-core/runs/6238804096?check_suite_focus=true#step:8:104)
          >>> defined in /home/runner/work/bitmask-core/bitmask-core/target/wasm32-unknown-unknown/debug/deps/libsecp256k1_sys-dc224e0595a95c29.rlib(precomputed_ecmult_gen.o)
[105](https://github.com/diba-io/bitmask-core/runs/6238804096?check_suite_focus=true#step:8:105)
          >>> defined in /home/runner/work/bitmask-core/bitmask-core/target/wasm32-unknown-unknown/debug/deps/libsecp256k1_sys-dc224e0595a95c29.rlib(precomputed_ecmult.o)
[106](https://github.com/diba-io/bitmask-core/runs/6238804096?check_suite_focus=true#step:8:106)

[107](https://github.com/diba-io/bitmask-core/runs/6238804096?check_suite_focus=true#step:8:107)
          rust-lld: error: duplicate symbol: WASM32_INT_ALIGN
[108](https://github.com/diba-io/bitmask-core/runs/6238804096?check_suite_focus=true#step:8:108)
          >>> defined in /home/runner/work/bitmask-core/bitmask-core/target/wasm32-unknown-unknown/debug/deps/libsecp256k1_sys-dc224e0595a95c29.rlib(precomputed_ecmult_gen.o)
[109](https://github.com/diba-io/bitmask-core/runs/6238804096?check_suite_focus=true#step:8:109)
          >>> defined in /home/runner/work/bitmask-core/bitmask-core/target/wasm32-unknown-unknown/debug/deps/libsecp256k1_sys-dc224e0595a95c29.rlib(precomputed_ecmult.o)

You can see in build phase here:

https://github.com/diba-io/bitmask-core/runs/6238804096?check_suite_focus=true

apoelstra commented 2 years ago

This was fixed by #421 but this hasn't made it out to a release yet (and it's been a month! how did that happen :().

I think we can release 5.1.0 of secp256k1-sys with this fix. Just need to check a couple other recently-merged PRs to see if they break any APIs. I'll try to do this today or tomorrow.

tcharding commented 2 years ago

I'm not a maintainer on this repo so can't edit your post, but for future readers you meant to write release v0.5.1, and that's been done here.

wilfredjonathanjames commented 1 year ago

@josediegorobles did this fix your issue? I ran into this using crates.io latest (0.24.0). Same issue when pulling git direct.

May be related, as I'm not running wasm32-wasi: https://github.com/rust-bitcoin/rust-secp256k1/issues/485

josediegorobles commented 1 year ago

This fixed the issue at he moment. Later appeared another problem with wasm32 that is solved now, but I'm not using directly the library so I can't tell if it's working 0.24.0 like this. When I run it, I will tell here if there are problems or no.