(Warning: This post is mostly a rant!)
Watch me suffer. For my internship project I thought it would be cute to complicate it as much as possible. It’s a soft PLC running ontop of Linux with PREEMPT_RT. The stack is mostly in Rust, but I wanted to find an excuse to write a part of it in Zig.
So I thought, “Ah, well. I’ll just write a Telegram bot in Zig. Easy work. I’ll just pipe bits out of the soft PLC and send alerts via Telegram”.
It quickly went from 0 to 999 real quick. Mind you, I’m just a kid who could barely make a Streamlit app in a Jupyter notebook. I was already using iceoryx2 to pipe bits between parts I wrote in Rust. Cross compiled it with cross
, easy peasy. I didn’t have to worry about paths even once.
Then it hit me. iceoryx2 is a Rust project. Crap. The Zig bindings are ‘planned’. Crap, that means I have to deal with CMake to talk through the C bindings in Zig. After 2 straight hours of talking to LLMs and reading error logs I got it working. But that was just building the C examples.
Now Zig has with it its own under-documented build system. At this point everything I see online, even those coming from the ZSF team itself needs to be taken with approximately 3 mountains of salt. I struggled with CMake, now’s the time to struggle with build.zig.
2 more hours spent, talking with LLMs. I blindly poked around and I finally got it to build, it ran just as expected on my Pi. Yippee.
I was incredibly frustrated, even questioning why I even cared about Zig in the first place. But then it hit me. I struggled about the same with CMake just 4 hours ago, yet CMake is 24 years old, 2.5 years older than me. I struggled because Zig is a massive WIP and up-to-date docs are hard to come by. One can only imagine how much of a breeze it will be once it reaches 1.0.
(End of rant)
This is unsubstantial, I just wanted to tell the world what I got myself into.