How do integrate a C library, that uses libc when building with trunk?
Currently i am using cc crate to build for native (tested on windows). But i am unable to compile to wasm because stdlib.h is missing. I have asked AI but it told me to reimplement libc, which is the last thing i want to do. Is there any tool or step i could take to make this a bit easier.
Context:
Egui using the eframe template, should be able to build to both native and wasm
Cubiomes - this is the library i want to integrate
Walkers - for mapping the Minecraft world and generating custom tiles
The wasm32-unknown-unknown target is made for pure Rust applications only. It doesn't have a libc implementation like almost all C code needs. There are also the wasm32-unknown-emscripten and wasm32-wasip1/2/3 targets. The wasi targets while capable of running inside a browser using a proper shim are designed for standalone wasm runtimes. That leaves the wasm32-unknown-emscripten target as C capable wasm target. It looks like wasm-bindgen recently gained emscripten support by passing --target emscripten to wasm-bindgen: https://github.com/wasm-bindgen/wasm-bindgen/pull/4443. I think trunk hasn't added support for this yet though. wasm-pack should support it though since Support arbitrary targets by RReverser · Pull Request #1524 · wasm-bindgen/wasm-pack · GitHub.