One year ago, I quit my day job to work on Zig full time. Since then, the project has seen a steady growth in funding. Thanks to the people donating, Zig is on track to become fully sustainable before my savings run out.
This support has allowed me to focus on steady improvements to the language and tooling. In the last year, Zig has released two versions:
These release notes serve as my accountability to people who donate, and if you have a look at them, I hope you can agree with me that they speak for themselves.
I know that open-source project funding has been on people's minds lately, as we've watched the Internet's reaction to the bizarre open-sourcing of the V language unfold. As to how this relates to musl libc, stick with me - let me give you the talking points of this situation:
Now that the website has the "WIP" label to communicate which features are not available, and the source is released, I no longer consider this project to be fraudulent. The information is available to everyone, and people who donate on Patreon are making an informed choice.
I'm genuinely glad it turned out this way. Good luck on your endeavor, and welcome to the programming languages club.
One thing that is crystal clear is that the V author succeeded in creating hype. He got people excited about ambitious features - so excited that they were willing to donate some cash. This made me think of another open source project in the opposite category.
The Zig project owes a lot to musl, for many reasons:
Especially in the early stages of the Zig project, but still to this day, I asked question after question in the
IRC channel, and the musl community patiently and expertly indulged them. Sometimes my questions were not even musl-related,
but just more about how the Linux kernel works.
I didn't start off as an expert systems programmer when I started Zig, but the musl community has mentored me over the years.
Zig ships with musl source code. This allows Zig projects to cross compile for Linux. For example, on Windows, you can:
> zig.exe build-exe --c-source hello.c -target x86_64-linux-musl
Copy the resulting ELF binary to a Linux machine and it will run. (Or run that in the Windows Subsystem for Linux).
This works because Zig lazily builds musl from source on demand, for the selected target. It is in no small part thanks to musl's simplicity and well-designed nature that this is possible.
It's also useful to create static builds on Linux where the native libc is glibc.
musl is such a high quality codebase, that most of the Zig standard library's interface to Linux is a direct port of musl code.
This has prevented countless bugs and made things "just work" in general. Without this head start, the Zig project would have had to spend more time on Linux system interface and less on everything else.
Zig has 128-bit floating point literals, so that compile-time computations can be done in a higher level of precision, before being casted to the floating point type of choice.
This is tricky to implement in the C++ non-self-hosted compiler, however, because libc does not have a 128-bit
function. So I took musl's
strtold function, which works with the type
long double, and then
ported the code into Zig,
making all the #ifdefs assume that
long double is 128-bits (which is only true on some architectures), and replacing all the
math with SoftFloat so that it would work on any architecture, no matter
long double maps to.
Many people are aware of Alpine Linux because it has become a popular Linux distribution to use with Docker, mainly due to its simplicity and small binary size. This is in large part thanks to the fact that the system uses musl as its libc rather than glibc.
The Zig project uses Alpine Linux to create the static Linux builds on ziglang.org/download.
And so I have decided to donate $150/month to the musl project, even though that represents 10% of my income. I'm putting my money where my mouth is. But there's more - please read on...
Now if I'm being honest about my motivations for this blog post, it's that I want to prove that open source funding is not a zero-sum game. If there's anything we've learned from the V language Internet drama that has unfolded over the past few days, it's that open source projects have to do marketing if they want to get financial support.
But I want to set a better example of what that might look like. I don't think you have to trick people. This blog post is a marketing stunt intended to show that you can do things to get attention and funding, without being dishonest.
Will you help me prove my point?
If enough people start pledging donations to Zig when reading this, and the $150/month is recovered, then this little stunt will have been a proof-of-concept of one open source project running a fund-raiser for another one. (To be clear my donations to musl are not conditional; regardless of the outcome I will continue to donate.)
Worth a shot, right?
Since making news headlines, several generous people have taken me up on this experiment:
That's a total of 178.65, well beyond the $150 that I started donating to musl.
Thank you so much! I'm really grateful for all your support. This experiment was a success! Today, the Zig project ran a fundraiser for the musl libc project, and it worked!