173 points · by lupyuen · 2y ago · 50 comments
OTH the Clang compiler doesn't come with the necessary cross-compilation C library and headers.
From that pov, the Zig toolchain is indeed the best option to compile a WASM blob that's not WASI (in that case, there's also the WASI SDK, which is a similar self-contained toolchain as the Zig toolchain) - PS: Zig can also compile to WASI out of the box though.
I think that’s the genius of Zig.. one of the main goals is to build a better and faster C compiler. It might end up being the only C compiler with really solid hot-swapping support. And then if you’re already using the compiler you might as well start using the language too.
Sometimes I wonder how much people nowadays actually bother to learn about compiled languages.
Same, consistent tools and versions everywhere. No need to have 10 different LLVM copies on your system.
Plus, the toolchain already includes a build system, a package manager, a cache, a way to run tests, etc.
I think what zig really needs is something like the rust Axum ecosystem for web backend development. I would never be able to make a zig case at work without those sort of frameworks. People would say why zig without web related packages when you also have GOlang.
Also as remark, Zig is going to be the new Modula-2, with revamped syntax for C minded folks, and compile time support.
Assuming it takes off post 1.0, still a long to go in the adoption chasm graph.
> We have implemented (fully or partially) 48 POSIX Functions from above. ...[however] These 24 POSIX Functions will Halt when TCC WebAssembly calls them…
I was just wondering this evening: I have seen WASM described as an environment for selectively subsetting interfaces, in part for security. Is the following sometimes done?: Compile and link to a "glibc" which implements only a subset of calls, again for runtime security?
I'll drop a link to WASIX in case is useful for the reader!
[1] https://llvm.org/docs/ExceptionHandling.html#sjlj-intrinsics