zlacker

Zig Libc

submitted by ingve+(OP) on 2026-02-02 17:28:19 | 355 points 106 comments
[view article] [source] [go to bottom]

NOTE: showing posts with links only show all posts
◧◩
16. AndyKe+pj1[view] [source] [discussion] 2026-02-02 23:20:17
>>xrd+161
The very same day I sat at home writing this devlog like a coward, less than five miles away, armed forces who are in my city against the will of our elected officials shot tear gas, unprovoked, at peaceful protestors, including my wife.

https://www.kptv.com/2026/01/31/live-labor-unions-rally-marc...

This isn't some hypothetical political agenda I'm using my platform to push. There's a nonzero chance I go out there next weekend to peacefully protest, and get shot like Alex Pretti.

Needless to say, if I get shot by ICE, it's not good for the Zig project. And they've brought the battle to my doorstep, almost literally.

Abolish ICE.

◧◩◪◨⬒
34. benatk+rL1[view] [source] [discussion] 2026-02-03 02:03:29
>>ale+mw1
Try it again. This time do something different with CLAUDE.md. By the way it's happy to edit its own CLAUDE.md files (don't have an agent edit another agent's CLAUDE.md files though [0])

0: >>46723384

35. tiffan+8M1[view] [source] 2026-02-03 02:08:17
>>ingve+(OP)
Does this mean long term Zig won’t run on OpenBSD?

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

>>38039689

◧◩
37. action+JM1[view] [source] [discussion] 2026-02-03 02:12:55
>>tiffan+8M1
https://news.ycombinator.com/reply?id=46864849&goto=item%3Fi...
◧◩◪◨⬒
39. rudedo+UO1[view] [source] [discussion] 2026-02-03 02:27:13
>>ale+mw1
I made a Zig agent skill yesterday if interested: https://github.com/rudedogg/zig-skills/

Claude getting the ArrayList API wrong every time was a major reason why

It’s AI generated but should help. I need to test and review it more (noticed it mentions async which isn’t in 0.15.x :| )

◧◩◪◨
44. manana+w02[view] [source] [discussion] 2026-02-03 04:04:10
>>winter+XV1
For static executables, “the system’s libc” is of course not a thing. To support those, OpenBSD requires them to include an exhaustive list of all addresses of syscall instructions in a predefined place[1].

(With that said, OpenBSD promises no stability if you choose to bypass libc. What it promises instead is that it will change things in incompatible ways that will hurt. It’s up to you whether the pain that thus results from supporting OpenBSD is worth it.)

[1] https://nullprogram.com/blog/2025/03/06/

◧◩◪◨
45. AndyKe+712[view] [source] [discussion] 2026-02-03 04:09:40
>>winter+XV1
Sorry I got mixed up with FreeBSD: https://codeberg.org/ziglang/zig/issues/30981 (original github link has more information)
◧◩◪
49. dnauti+c42[view] [source] [discussion] 2026-02-03 04:37:11
>>hennin+W11
i find claude does quite well with zig. this project is like > 95% claude, and it's an incredibly complicated codebase [0] (which is why i am not doing it by hand):

https://github.com/ityonemo/clr

[0] generates a dynamically loaded library which does sketchy shit to access the binary representation of datastructures in the zig compiler, and then transpiles the IR to zig code which has to be rerun to do the analysis.

◧◩
50. kibibu+E42[view] [source] [discussion] 2026-02-03 04:40:37
>>squirr+kM1
Perhaps to avoid confusion with zlib?

https://www.zlib.net/

◧◩◪◨
54. Cloude+ui2[view] [source] [discussion] 2026-02-03 06:54:52
>>dnauti+042
It's completely possible to implement printf. here is my impl (not 100% correct yet) of snprintf for my custom libc implemented on top of a platform I'm working on <https://zigbin.io/ab1e79> The va_arg stuff are extern because zig's va arg stuff is pretty broken at the moment. Here's a C++ game ported to web using said libc running on top of the custom platform and web frontend that implements the platform ABI <https://cloudef.pw/sorvi/#supertux.sorvi> (you might need javascript.options.wasm_js_promise_integration enabled if using firefox based browser)
◧◩
64. erk__+Ls2[view] [source] [discussion] 2026-02-03 08:17:28
>>master+Oo2
There is a couple libc implementations:

- c-ward [0] a libc implementation in Rust

- relibc [1] a libc implementation in Rust mainly for use in the Redox os (but works with linux as well)

- rustix [2] safe bindings to posix apis without using C

[0]: https://github.com/sunfishcode/c-ward

[1]: https://gitlab.redox-os.org/redox-os/relibc/

[2]: https://github.com/bytecodealliance/rustix

◧◩
80. jibal+Oi3[view] [source] [discussion] 2026-02-03 14:21:44
>>voidUp+Gt2
There's no timeline for 1.0

You might find this interesting: https://www.youtube.com/watch?v=x3hOiOcbgeA

◧◩◪◨⬒
97. Goblin+3q4[view] [source] [discussion] 2026-02-03 19:03:52
>>oguz-i+eZ1
Can't you just have one syscall(2) to rule them all? https://man7.org/linux/man-pages/man2/syscall.2.html
◧◩◪◨⬒⬓
101. oguz-i+rO5[view] [source] [discussion] 2026-02-04 03:09:03
>>Goblin+3q4
You can. There is a thread-unsafe implementation here <https://gist.github.com/oguz-ismail/72e34550af13e3841ed58e29...>. But the listing needs to be per system call number, so this one only supports system calls 1 (_exit) and 4 (write). It should be fairly easy to automatically generate the complete list but I didn't try it.
[go to top]