Bromeon / js-sandbox

Securely embed JavaScript code into a Rust application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unresolved import `libc::c_char` when compiled to WASM

chaosprint opened this issue · comments

cargo new js-sandbox-test --lib

Add in cargo.toml:

[dependencies]
js-sandbox = "0.1.6"

Then compile:

cargo build --target wasm32-unknown-unknown --release

Got error:

   Compiling serde_derive v1.0.136
   Compiling futures-macro v0.3.21
   Compiling pin-project-internal v1.0.10
   Compiling rusty_v8 v0.22.3
error[E0432]: unresolved import `libc::c_char`
 --> /Users/chaosprint/.cargo/registry/src/github.com-1ecc6299db9ec823/rusty_v8-0.22.3/src/V8.rs:2:5
  |
2 | use libc::c_char;
  |     ^^^^^^^^^^^^ no `c_char` in the root

error[E0432]: unresolved import `libc::c_int`
 --> /Users/chaosprint/.cargo/registry/src/github.com-1ecc6299db9ec823/rusty_v8-0.22.3/src/V8.rs:3:5
  |
3 | use libc::c_int;
  |     ^^^^^^^^^^^ no `c_int` in the root

For more information about this error, try `rustc --explain E0432`.

Does this also appear with the latest release 0.2.0-rc.1?

Also, it looks like this error appears in the upstream crate rusty_v8 (of which 0.22 is heavily outdated). If the problem still appears on latest js-sandbox version and is still originating in upstream, I'd recommend to file an issue there.