Comment

Comment by emidoots

"So, a clang wrapper?" is a common thought, so here's how Zig differs from clang out of the box:

* Links MachO binaries for Apple Silicon via the custom zld linker it ships. LLVM cannot do this currently.

* Provides (deduplicated) libc headers for pretty much every platform, including macOS and glibc/musl. https://github.com/ziglang/zig/tree/master/lib/libc/include

* Provides a libc implementation (libSystem for macOS, musl and glibc, mingw for Windows, and WASI)

* Deals with lots of the deep depths of hell, like enabling you to target any version of glibc out of the box by building symbol mappings: https://github.com/ziglang/glibc-abi-tool/

And that doesn't mention the most important part, IMO, which is that it lets you cross compile _out of the box_. No fiddling with sysroots, system packages, etc. to get a cross compiling toolchain working.

parent emidoots 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton