4 ms·
> added a Rust dependency which in turn changed the list of supported platforms My understanding is that `zig cc`/`zig c++` are thin wrappers around LLVM, so d
by vlovich123 5y ago
> added a Rust dependency which in turn changed the list of supported platforms
My understanding is that `zig cc`/`zig c++` are thin wrappers around LLVM, so doesn't that just reintroduce the same problem?
- deleted 5y ago[deleted]
- skybrian 5y agoYes, if you exclusively use Zig to build the code. But on an platform that Zig doesn’t support, you could write your own makefile instead to compile the C code with the native compiler, so the situation seems a bit better than with Rust?
- williamstein 5y ago‘zig cc’ is more than that. You get a very powerful caching system, and built in support for cross compilation to a huge range of targets (via zig shipping with libc sources). Zig is extremely impressive.
- dleslie 5y agoThe 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.
- messe 5y ago> 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.
- dleslie 5y agoIt 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.
- klyrs 5y agoThe 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.
- AndyKelley 5y agoHere'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-replacement-gcc-clang.html https://andrewkelley.me/post/zig-cc-powerful-drop-in-replace...
- steveklabnik 5y agollvm’s platform support or the lack thereof was not the issue, it was assuming you had a compiler other than a C compiler installed at all on certain platforms. This would have affected zig in the same way, or any non-C language.
- kristoff_it 5y agoQuoting a reply about this point I left in another comment thread: The point about the Python package example is not to say that Zig can get on platforms where Rust can't, but rather that the C infrastructure that we all use is not that easy to replace and every time you touch something, regardless of how decrepit and broken it might have been, you will irritate and break someone else's use case, which can be a necessary evil sometimes but not always. This is a point I made in the section of the blog post dedicated to explaining the limits or rewriting code.