This affects static libc only. If you pass -dynamic -lc then the libc functions are provided by the target system. Some systems only support dynamic libc, such as macOS. I think OpenBSD actually does support static libc though.
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
xrd 4 hours ago [-]
"Abolish ICE" at the bottom. Obviously a Bad Bunny fan, as I am.
AndyKelley 3 hours ago [-]
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.
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.
sltkr 4 minutes ago [-]
> There's a nonzero chance I go out there next weekend to peacefully protest, and get shot like Alex Pretti.
So what are you going to do to bait the cops into killing you? Are you going to walk around with a gun, spit on them, and kick out the tail lights on their cars, like Alex Pretti did? (It took him a few days to get himself killed, but eventually he managed.) Are you going to drive your car into them like Renee Good did? Or do you have a brand new plan to get killed in a way that wouldn't happened if you had behaved like a normal person?
Because you know, you've got to put a bit of effort into getting killed by ICE. They don't just go around killing anybody. But since you're such a smart guy, and you're already talking about getting shot by ICE, I'm sure you have a solid plan to make that happen. Can't wait to see it on the news. Best of luck to you!
lvl155 40 minutes ago [-]
Andy keep safe. We gotta all come to realization that none of this is possible if we let our democracy slip away. Millions before us died to preserve it. We owe it to them to put up a good fight.
2 hours ago [-]
xrd 3 hours ago [-]
My 85 year old mom lives in Portland and she attends rallies frequently. If you know of any way to support you or other local people doing this work, I'm very interested. My email is on my profile page.
I have a friend who is in Minneapolis. He's involved in caravans which are tracking ICE. He wasn't the driver in the last one. But, the ICE vehicle they tailed suddenly started going in a very direct path, instead of randomly driving. The driver figured it out first. They drove to the driver's house and then stood outside of their car for ten minutes staring at his house. Cars in Minnesota have their license plates on both the front and the back.
Is there any justification for that kind of intimidation? Did any of the Trump supporters vote for that? I hear about paid agitators on the left but not that kind of compensated actors. Is his name in a database now once they did the lookup?
throwawaypath 3 hours ago [-]
[flagged]
AndyKelley 3 hours ago [-]
The Department of Homeland Security was created in 2003. We didn't need it then and we don't need it now.
Why waste tax dollars on ineffective, privacy-violating security theater when we could spend it on education and health?
throwawaypath 3 hours ago [-]
You didn't answer or even address a single question I asked. I'll ask again:
1. Are you OK with sovereign states enforcing their borders and deporting illegal immigrants?
2. Is it the awful tactics ICE uses to accomplish its mission, or do you find the mission in and of itself immoral?
jcranmer 2 hours ago [-]
ICE's current mission isn't to deport illegal immigrants. Its current mission is to antagonize anyone who is not a WASP, and seemingly these days, anybody who stands up for non-WASP citizens in the US. As can be easily ascertained by the sheer number of encounters where the officers insist that they don't actually care to see any papers proving the people they're arresting are legal US citizens (let alone legal US residents).
So your questions don't matter because you're arguing about a reality that doesn't exist.
hypeatei 2 hours ago [-]
You'd have a lot stronger argument if ICE wasn't being used as a secret police force. They're Immigration Enforcement in name only. Your average citizen would say it's okay to enforce immigration laws, there is no doubt about that; doing middle-of-the-night raids with a blackhawk helicopter in cities of your political opponents is not reasonable[0]. There are plenty more examples of their abhorrent behavior (like killing two American citizens in the midwest and brutalizing protestors) if you cared to search for it.
I've noticed that the MAGAs have been adamant about trying to shift the window back to: "but you agree that immigrants should be deported right?" as some sort of attempt to justify what's happening, I guess. Is that talking point coming from some popular right wing show or something as a last ditch effort before midterms?
Something smells fishy here... is that a Sea Lion?
xrd 3 hours ago [-]
Are you ok with the size of the budget these agencies control? Are you ok with it being headed by a guy who never has denied he took a $50k bribe from the FBI and wasn't even the initial target of an investigation?
I would bet you $1000 that not one of the immigrants being rounded up were even accused of that kind of corruption and crimes.
How is this not bald corruption and an insane way to spend tax dollars when people are really struggling in this country?
And I know plenty of restaurant owners in Portland that are closing because of down tourism. Why can Trump sue the IRS for $10B but Portland can't sue him for disparaging the city because he can't figure out that videos of riots are five years old?
charcircuit 31 minutes ago [-]
The budget needs to increase because there are a lot of people in the country illegally and in order to get every single one of them out the agency needs to scale up. When people start obstructing officers and being violent that increases the required number of officers even more.
thrance 3 hours ago [-]
No. Both.
MiltarizdMerica 3 hours ago [-]
[flagged]
pixelpoet 3 hours ago [-]
These few-minutes-old accounts swooping in on hot button issues to try persuade people are such a goddamn scourge, I wish there were something that could be done about it.
In the end I probably just need to leave HN for a while because it's really doing a number on what's left of my ability to trust what I read online.
thrance 3 hours ago [-]
Only thing you can do is flag them. Two strikes and they're gone. Plus usually, moderation give these accounts a perma-ban.
In fact if you were to make a police force entirely out of CBP officers who have been arrested, it would be the fourth largest police force in America.
metalliqaz 3 hours ago [-]
You don't get what the issue is?
Your account is 27 minutes old, the username is sarcastic at best, you hopped on specifically to defend the indefensible.
You really don't know?
MiltarizdMerica 3 hours ago [-]
[flagged]
3 hours ago [-]
SLWW 3 hours ago [-]
[flagged]
AndyKelley 3 hours ago [-]
When people like you finally realize what is happening in this country, I'm ready to quickly forgive and move on so that we can work together to preserve what freedoms we have left.
but please hurry... we really need you to pay attention and understand the reality that is upon us.
SLWW 3 hours ago [-]
I do know what's happening. I've been around and watching for over a decade. We are bleeding from every orifice from an economic standpoint. The recent moves for deportations is an attempt by the office of the President to save face while not doing anything to fix over-spending, it's also a good vehicle for a surveillance push, and the RNC/old-school dems will be happy so someone like JD can take power afterwards to prop up the current rising oligarchy and further support British assets moving into the middle-east for "oil".
I'm not ignorant. I just know you aren't going to change anything by getting riled up emotionally and using language that indicates instability (I don't know you, my initial comment is because I don't want to see you get snuffed out). There's nothing you can do to solve these problems at this point and time, and they would prefer you protest so they can get your face, for the purposes of marking. Portland also is full of genuinely nutty people, been there several times and there is a real social contagion. You should be spending your time helping who you can, avoiding the authorities in general (never even speak to them), and understand that this "liberal democracy" is slowly collapsing and there's no stopping what's going to happen. We are being hollowed out entirely.
Freedoms aren't going to matter much when we are owned by every foreign nation but our own. I thought about 7 years ago that we could fix this with protesting, now I know that we can't. I'm just seeing this from a view of total loss while you see that there is yet still time.
Quick addendum: this is not me attempting to demoralize. I do think that once people can't pay for bread then maybe something will change. Up until that point the majority will give away every right for even the slightest relief, anything for a little hope of a better future. This has happened many times before. Empires rise and fall, it's nothing unique or out of the ordinary across history. First and foremost look out for yourself and your loved ones, and be willing to be flexible
AndyKelley 2 hours ago [-]
Don't take the black pill.
SLWW 2 hours ago [-]
Only white pilling for me sir. I believe in the morning light after a dark night. I just know that the tide comes in and out reliably.
If you believe protesting is the way forward then go for it; just don't get shot while doing it.
Anyway; I like Zig a lot btw.. loving what you guys are doing.
baggy_trough 3 hours ago [-]
> against the will of our elected officials
Did you mean your local officials?
kstrauser 2 hours ago [-]
In the Federal model of US government, state authority overrides centralized government except in the explicit cases enumerated by the Constitution.
So yes, of course they mean their local officials, because in this case there isn’t an explicit line in the Constitution explaining why the feds are allowed to invade Minnesota.
baggy_trough 1 hours ago [-]
The Supreme Court has disagreed with you on the matter of federal immigration constitutional authority for more than a century. There isn’t any “invasion”; that’s a propaganda device.
kstrauser 55 minutes ago [-]
And yet they didn’t brag about invading other states bordering, let’s see, Canada, just the blue one that had a political spat with.
actionfromafar 1 hours ago [-]
That's clever. Just slap the "immigration sticker" on ICE and do whatever you want.
ghthor 58 minutes ago [-]
Don’t do it, your project here on zig is a much larger net positive for civilization than you spending your time at those protests.
<3 zig and want io interface in everything!
adzm 4 hours ago [-]
I too am sick of internal compiler errors
xeonmc 2 hours ago [-]
I too am sick of internal combustion engines, a product of the last century.
matheusmoreira 4 hours ago [-]
I too am sick of intrusion countermeasures electronics. Think of all the poor netrunners out there.
himujjal 25 minutes ago [-]
I don’t mind someone doing politics stuffs. Heck I am in for privacy and no enterprise model of software. Big Stallman fan here.
But I would really suggest keeping politics out of Zig stuffs.
I don’t even know what ICE is. Just read about it.
This is a show of power.
Like: “I am an American and since I am building the software, I am going to push MY politics into your throat”.
That means, to show similar power, I need to build a software as influential as Zig so that I can push my agendas of my country down your throats.
Heck let me do just that.
Keep politics to politics forums, keep code to code.
jzelinskie 5 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?
AndyKelley 3 hours ago [-]
Yes but we already have to do that for our own standard library. For shared codepaths (e.g. math) it's strictly fewer potential bugs.
generichuman 2 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?
AndyKelley 2 hours ago [-]
This use case is unchanged.
If you specify -target x86_64-windows-gnu -lc then some libc functions are provided by Zig, some are provided by vendored mingw-w64 C files, and you don't need mingw-w64 installed separately; Zig provides everything.
You can still pass --libc libc.txt to link against an externally provided libc, such as a separate mingw-w64 installation you have lying around, or even your own libc installation if you want to mess around with that.
Both situations unchanged.
generichuman 40 minutes ago [-]
That's cool. I imagine I could also maintain a MinGW package that can be downloaded through the Zig package manager and statically linked without involving the zig libc? (Such that the user doesn't need to install anything but zig)
That's a good way to sell moving over to the zig build system, and eventually zig the language itself in some real-world scenarios imo.
meisel 4 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?
ibejoeb 4 hours ago [-]
Seems like it ought to be able to do inlining and dead code stripping which, I think, wouldn't be viable at link time against optimized static libraries.
comex 4 hours ago [-]
It is viable against the IR that static libraries contain when LTO is enabled.
LTO essentially means “load the entire compiler backend into the linker and do half of the compilation work at link time”.
It’s a great big hack, but it does work.
gary_0 47 minutes ago [-]
As I understand it, compiling each source file separately and linking together the result was historically kind of a hack too, or at least a compromise, because early unix machines didn't have enough memory to compile the whole program at once (or even just hold multiple source files in memory at a time). Although later on, doing it this way did allow for faster recompilation because you didn't need to re-ingest source files that hadn't been changed (although this stopped being true for template-heavy C++ code).
ibejoeb 3 hours ago [-]
Right, but I think that's what the question of "Why is the linker too late?" is getting at. With zig libc, the compiler can do it, so you don't need fat objects and all that.
---
expanding: so, this means that you can do cross-boundary optimizations without LTO and with pre-built artifacts. I think.
nesarkvechnep 5 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.
6 hours ago [-]
squirrellous 31 minutes ago [-]
I’m sure this has crossed someone’s mind but why isn’t this called zlibc? :-)
cies 5 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.
Retro_Dev 4 hours ago [-]
There's solid reason for the translation here; the Zig core team is aiming to eliminate duplicated code and C functions, and avoid the need to track libc from multiple sources. In the future, LLMs could serve as part of this, but they are currently quite terrible at Zig (as far as I understand it, it's not a lack of Zig code samples, it's an imbalance of OLD Zig to NEW Zig, as Zig changes quite frequently).
You would need to consider if it is even worth it translating your C code. If the paradigm is identical and the entire purpose would be "haha it is now one language," surely you could just compile and link the C code with libzigc... In my opinion, it's not worth translating code if the benefit of "hey look one language" requires the cost of "let's pray the LLM didn't hallucinate or make a mistake while translating the code."
self_awareness 4 hours ago [-]
[flagged]
pravetz259 4 hours ago [-]
One can say words against one injustice without being required to mention every injustice.
self_awareness 4 hours ago [-]
[flagged]
3 hours ago [-]
4 hours ago [-]
nameconflicts 2 hours ago [-]
[flagged]
shpongled 2 hours ago [-]
As someone who has been primarily writing Rust for the past 8+ years, I am actually unaware of any political drama surrounding Rust. It's just a programming language.
nemo1618 5 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.
AndyKelley 2 hours ago [-]
hallucinations in a libc implementation would be especially bad
4 hours ago [-]
henning 4 hours ago [-]
Have you ever used an LLM with Zig? It will generate syntactically invalid code. Zig breaks so often and LLMs have such an eternally old knowledge cutoff that they only know old ass broken versions.
The same goes for TLA+ and all the other obscure things people think would be great to use with LLMs, and they would, if there was as much training data as there was for JavaScript and Python.
ezekiel68 3 hours ago [-]
To be fair, this was true of early public LLMs with rust code too. As more public zig repositories (and blogs / docs / videos) come online, they will improve. I agree it's a mess currently.
Graziano_M 4 hours ago [-]
You must have not tried this with an LLM agent in the past few months.
ale 2 hours ago [-]
i tested sonnet 4.5 just last week on a zig codebase and it has to be instructed the std.ArrayList syntax every time.
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 :/)
benatkin 38 minutes ago [-]
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])
Because doesn’t OpenBSD block direct syscalls & force everything to go through libc.
https://news.ycombinator.com/item?id=38039689
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.
So what are you going to do to bait the cops into killing you? Are you going to walk around with a gun, spit on them, and kick out the tail lights on their cars, like Alex Pretti did? (It took him a few days to get himself killed, but eventually he managed.) Are you going to drive your car into them like Renee Good did? Or do you have a brand new plan to get killed in a way that wouldn't happened if you had behaved like a normal person?
Because you know, you've got to put a bit of effort into getting killed by ICE. They don't just go around killing anybody. But since you're such a smart guy, and you're already talking about getting shot by ICE, I'm sure you have a solid plan to make that happen. Can't wait to see it on the news. Best of luck to you!
I have a friend who is in Minneapolis. He's involved in caravans which are tracking ICE. He wasn't the driver in the last one. But, the ICE vehicle they tailed suddenly started going in a very direct path, instead of randomly driving. The driver figured it out first. They drove to the driver's house and then stood outside of their car for ten minutes staring at his house. Cars in Minnesota have their license plates on both the front and the back.
Is there any justification for that kind of intimidation? Did any of the Trump supporters vote for that? I hear about paid agitators on the left but not that kind of compensated actors. Is his name in a database now once they did the lookup?
Why waste tax dollars on ineffective, privacy-violating security theater when we could spend it on education and health?
1. Are you OK with sovereign states enforcing their borders and deporting illegal immigrants?
2. Is it the awful tactics ICE uses to accomplish its mission, or do you find the mission in and of itself immoral?
So your questions don't matter because you're arguing about a reality that doesn't exist.
I've noticed that the MAGAs have been adamant about trying to shift the window back to: "but you agree that immigrants should be deported right?" as some sort of attempt to justify what's happening, I guess. Is that talking point coming from some popular right wing show or something as a last ditch effort before midterms?
0: https://www.propublica.org/article/chicago-venezuela-immigra...
I would bet you $1000 that not one of the immigrants being rounded up were even accused of that kind of corruption and crimes.
How is this not bald corruption and an insane way to spend tax dollars when people are really struggling in this country?
And I know plenty of restaurant owners in Portland that are closing because of down tourism. Why can Trump sue the IRS for $10B but Portland can't sue him for disparaging the city because he can't figure out that videos of riots are five years old?
In the end I probably just need to leave HN for a while because it's really doing a number on what's left of my ability to trust what I read online.
Especially as CBP officers commit crimes at a higher rate than undocumented migrants in the US: https://www.doomsdayscenario.co/p/accountability-for-ice-and...
In fact if you were to make a police force entirely out of CBP officers who have been arrested, it would be the fourth largest police force in America.
Your account is 27 minutes old, the username is sarcastic at best, you hopped on specifically to defend the indefensible.
You really don't know?
but please hurry... we really need you to pay attention and understand the reality that is upon us.
I'm not ignorant. I just know you aren't going to change anything by getting riled up emotionally and using language that indicates instability (I don't know you, my initial comment is because I don't want to see you get snuffed out). There's nothing you can do to solve these problems at this point and time, and they would prefer you protest so they can get your face, for the purposes of marking. Portland also is full of genuinely nutty people, been there several times and there is a real social contagion. You should be spending your time helping who you can, avoiding the authorities in general (never even speak to them), and understand that this "liberal democracy" is slowly collapsing and there's no stopping what's going to happen. We are being hollowed out entirely.
Freedoms aren't going to matter much when we are owned by every foreign nation but our own. I thought about 7 years ago that we could fix this with protesting, now I know that we can't. I'm just seeing this from a view of total loss while you see that there is yet still time.
Quick addendum: this is not me attempting to demoralize. I do think that once people can't pay for bread then maybe something will change. Up until that point the majority will give away every right for even the slightest relief, anything for a little hope of a better future. This has happened many times before. Empires rise and fall, it's nothing unique or out of the ordinary across history. First and foremost look out for yourself and your loved ones, and be willing to be flexible
Anyway; I like Zig a lot btw.. loving what you guys are doing.
Did you mean your local officials?
So yes, of course they mean their local officials, because in this case there isn’t an explicit line in the Constitution explaining why the feds are allowed to invade Minnesota.
<3 zig and want io interface in everything!
But I would really suggest keeping politics out of Zig stuffs.
I don’t even know what ICE is. Just read about it.
This is a show of power.
Like: “I am an American and since I am building the software, I am going to push MY politics into your throat”.
That means, to show similar power, I need to build a software as influential as Zig so that I can push my agendas of my country down your throats.
Heck let me do just that.
Keep politics to politics forums, keep code to code.
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?
If you specify -target x86_64-windows-gnu -lc then some libc functions are provided by Zig, some are provided by vendored mingw-w64 C files, and you don't need mingw-w64 installed separately; Zig provides everything.
You can still pass --libc libc.txt to link against an externally provided libc, such as a separate mingw-w64 installation you have lying around, or even your own libc installation if you want to mess around with that.
Both situations unchanged.
That's a good way to sell moving over to the zig build system, and eventually zig the language itself in some real-world scenarios imo.
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?
LTO essentially means “load the entire compiler backend into the linker and do half of the compilation work at link time”.
It’s a great big hack, but it does work.
---
expanding: so, this means that you can do cross-boundary optimizations without LTO and with pre-built artifacts. I think.
This is exciting! I particularly care more about kqueue but I guess the quote applies to it too.
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.
You would need to consider if it is even worth it translating your C code. If the paradigm is identical and the entire purpose would be "haha it is now one language," surely you could just compile and link the C code with libzigc... In my opinion, it's not worth translating code if the benefit of "hey look one language" requires the cost of "let's pray the LLM didn't hallucinate or make a mistake while translating the code."
The same goes for TLA+ and all the other obscure things people think would be great to use with LLMs, and they would, if there was as much training data as there was for JavaScript and Python.
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 :/)
0: https://news.ycombinator.com/item?id=46723384