Stream: general

Topic: Question about Wasm Header Files


view this post on Zulip Dennis Zhang (Sep 18 2024 at 22:30):

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

view this post on Zulip fitzgen (he/him) (Sep 18 2024 at 22:31):

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?

view this post on Zulip Dennis Zhang (Sep 19 2024 at 14:43):

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.

view this post on Zulip bjorn3 (Sep 19 2024 at 14:51):

Are you using wasi-sdk to compile it? Which header files are missing?

view this post on Zulip Dennis Zhang (Sep 19 2024 at 15:32):

We are actually using clang with glibc to compile it, not wasi-sdk.

view this post on Zulip bjorn3 (Sep 19 2024 at 15:34):

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.

view this post on Zulip bjorn3 (Sep 19 2024 at 15:35):

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.

view this post on Zulip Dennis Zhang (Sep 19 2024 at 15:44):

Hi bjorn3! Thanks for providing these information! Yeah, we are currently trying to modify glibc to support wasm.

view this post on Zulip Chris Fallin (Sep 19 2024 at 15:44):

ah, in that case, the missing header files are part of that task -- headers are provided by the libc you're using


Last updated: Oct 23 2024 at 20:03 UTC