yjh0502 / rust-s2

S2 geometry library in Rust
Apache License 2.0
77 stars 20 forks source link

Does not build on WASM #40

Open ArniDagur opened 1 year ago

ArniDagur commented 1 year ago

This library fails to build on wasm32-unknown-unknown architecture. See the following:

[arni][master]% cargo build --target=wasm32-unknown-unknown
    Updating crates.io index
  Downloaded approx v0.4.0
  Downloaded libm v0.2.6
  Downloaded bigdecimal v0.3.0
  Downloaded cgmath v0.18.0
  Downloaded num-bigint v0.4.3
  Downloaded float_extras v0.1.6
  Downloaded s2 v0.0.12
  Downloaded 7 crates (459.2 KB) in 0.44s
   Compiling serde_derive v1.0.152
   Compiling libc v0.2.139
   Compiling serde v1.0.152
   Compiling libm v0.2.6
   Compiling cgmath v0.18.0
   Compiling num-traits v0.2.15
   Compiling num-integer v0.1.45
   Compiling num-bigint v0.4.3
   Compiling float_extras v0.1.6
error[E0432]: unresolved imports `libc::c_double`, `libc::c_int`
 --> /Users/arni/.cargo/registry/src/github.com-1ecc6299db9ec823/float_extras-0.1.6/src/lib.rs:5:16
  |
5 |     use libc::{c_double, c_int};
  |                ^^^^^^^^  ^^^^^ no `c_int` in the root
  |                |
  |                no `c_double` in the root

error[E0432]: unresolved import `libc::c_int`
  --> /Users/arni/.cargo/registry/src/github.com-1ecc6299db9ec823/float_extras-0.1.6/src/lib.rs:38:9
   |
38 |     use libc::c_int;
   |         ^^^^^^^^^^^ no `c_int` in the root

For more information about this error, try `rustc --explain E0432`.
error: could not compile `float_extras` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
yjh0502 commented 1 year ago

Could you retry it with --no-default-features flag?

w01fgang commented 7 months ago

works for me like this:

s2 = { version = "0.0.12", default-features = false }