Dear Zulip Community,
We have a general question regarding WebAssembly (Wasm) header files. When we compile a program into Wasm, which header files are used? I understand that some come from wasi-libc
, but does WebAssembly itself generate any header files?
Best,
Dennis
WebAssembly is an ISA and does not generate its own header files, in the same way that x86 or aarch64 do not generate header files.
I feel like there is perhaps an X-Y problem here: what are you trying to do?
Hi fitzgen! Thanks for answering our question! So we were trying to compile a simple "cat" from coreutils, but it indicates that we are missing some header files.
Are you using wasi-sdk to compile it? Which header files are missing?
We are actually using clang with glibc to compile it, not wasi-sdk.
Glibc doesn't support wasm. You need to use the wasi-libc that is part of wasi-sdk if you want to compile C or C++ code for wasi.
Wasi-sdk is a bundle of wasi-libc together with clang and a bunch of other tools that are frequently necessary for building C and C++ code.
Hi bjorn3! Thanks for providing these information! Yeah, we are currently trying to modify glibc to support wasm.
ah, in that case, the missing header files are part of that task -- headers are provided by the libc you're using
Last updated: Nov 22 2024 at 16:03 UTC