WebAssembly / tool-conventions

Conventions supporting interoperatibility between tools working with WebAssembly.
Artistic License 2.0
306 stars 66 forks source link

--target=wasm32-unknown-unknown: 'stdio.h' file not found #227

Closed ahaoboy closed 7 months ago

ahaoboy commented 7 months ago

When setting target to wasm32-unknown-unknown, stdio.h is not found.

#include <stdio.h>
#include <stdint.h>
 bindgen ./test.h -o test.rs  -- --target=wasm32-unknown-unknown
./test.h:1:10: fatal error: 'stdio.h' file not found
panicked at bindgen-cli/main.rs:52:36:
Unable to generate bindings: ClangDiagnostic("./test.h:1:10: fatal error: 'stdio.h' file not found\n")

stdlib.h also has the same problem

'stdlib.h' file not found
jedisct1 commented 7 months ago

Issues regarding bindgen would be better opened in the bindgen repository.

Anyway, the easiest way is to run bindgen in your build.rs file and then just compile your project with cargo-zigbuild (cargo-zigbuild --target=wasm32-unknown-unknown or cargo-zigbuild --target=wasm32-wasi).

ahaoboy commented 7 months ago

the easiest way is to run bindgen in your build.rs file and then just compile your project with cargo-zigbuild (cargo-zigbuild --target=wasm32-unknown-unknown or cargo-zigbuild --target=wasm32-wasi).

Thx