Hacker News new | past | comments | ask | show | jobs | submit login

The built in cross compilation is just LLVM; it's a narrower set of targets than GCC, and a _far_ narrower set of targets than where you'll find a C compiler.

clang cross compilation is not really any harder, you just supply the -target flag.




Here's some relevant reading [1]:

> If zig cc is built on top of Clang, why doesn't Clang just do this? What exactly is Zig doing on top of Clang to make this work?

> The answer is, a lot, actually. I'll go over how it works here.

[1]: https://andrewkelley.me/post/zig-cc-powerful-drop-in-replace...


> clang cross compilation is not really any harder, you just supply the -target flag.

Yes, but it doesn't bundle and automatically compile the appropriate C library for the platform. Zig does.


It can, if the package manager bundles it that way. Instead, clang is usually packaged and distributed as cross-compilation variants; because most of the time users don't need all of the different possible targets, they just want one or two.


The benefit here is that zig is batteries-included. The fact that you can drive to the store and buy batteries if you need them is missing the point.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: