Zig Libc

ziglang.org

237 points by ingve 15 hours ago


OsamaJaber - 10 hours ago

250 C files were deleted. 2032 to go. Watching Zig slowly eat libc from the inside is one of the more satisfying long term projects to follow

mastermage - 33 minutes ago

That just reminds me anyone know whether rust has something similar? Not wanting to start any Rust v. Zig debate. I am just wanting to be even more independant when it comes to some of my Rust projects.

tiffanyh - 6 hours ago

Does this mean long term Zig won’t run on OpenBSD?

Because doesn’t OpenBSD block direct syscalls & force everything to go through libc.

https://news.ycombinator.com/item?id=38039689

generichuman - 7 hours ago

This is very exciting for zig projects linking C libraries. Though I'm curious about the following case:

Let's say I'm building a C program targeting Windows with MinGW & only using Zig as a cross compiler. Is there a way to still statically link MinGW's libc implementation or does this mean that's going away and I can only statically link ziglibc even if it looks like MinGW from the outside?

jzelinskie - 10 hours ago

Cool idea, for sure, but I can't help but wonder: for the code that's been ported, is there a concern that you'd have to perpetually watch out for CVEs in glibc/musl and determine if they also apply to the Zig implementations?

meisel - 10 hours ago

> It’s kind of like enabling LTO (Link-Time Optimization) across the libc boundary, except it’s done properly in the frontend instead of too late, in the linker

Why is the linker too late? Is Zig able to do optimizations in the frontend that, e.g., a linker working with LLVM IR is not?

anitil - 4 hours ago

There are so many scary parts of libc, this is a really exciting project

nesarkvechnep - 11 hours ago

"Furthermore, when this work is combined with the recent std.Io changes, there is potential for users to seamlessly control how libc performs I/O - for example forcing all calls to read and write to participate in an io_uring event loop"

This is exciting! I particularly care more about kqueue but I guess the quote applies to it too.

- 12 hours ago
[deleted]
LAC-Tech - an hour ago

Does Zig does have the man power to keep these up to date?

I think we either need to make operating systems not in C, or just accept that at some level we rely on C.

squirrellous - 6 hours ago

I’m sure this has crossed someone’s mind but why isn’t this called zlibc? :-)

cies - 11 hours ago

Super cool project.

I expect a lot of C code may be quite mechanically translated to Zig (by help of LLMs). Unlike C->Rust or C->C++, where there's more of a paradigm shift.

xrd - 10 hours ago

"Abolish ICE" at the bottom. Obviously a Bad Bunny fan, as I am.

nameconflicts - 8 hours ago

[flagged]

self_awareness - 9 hours ago

[flagged]

nemo1618 - 10 hours ago

This strikes me as a very agent-friendly problem. Given a harness that enforces sufficiently-rigorous tests, I'm sure you could spin up an agent loop that methodically churns through these functions one by one, finishing in a few days.