Skip to content

Zig 0.16 migration #12228

Closed

Description

@pluiedev

Zig 0.16 has landed on April 13, 2026, so it's time to do this all over again :)

In progress PR at #12388

The major breaking change this time is the new std.Io interface that will be part of any code that has to access basically any system interface (filesystem, threads, timers, etc.), and OS-specific APIs like std.posix has almost been completely removed. This will likely be an even greater challenge compared to Writergate due to how much we rely on libxev for these sorts of tasks. I would recommend trying to port the codebase to use a generic std.Io implementation, and polyfilling in the features we need but aren't quite in the standard library yet — then we could either try to run the whole program off of std.Io.Evented, or try to repackage libxev as yet another std.Io implementation.

These Zig dependencies need to be migrated:

Activity

  1. added this to the 1.4.0 milestone on Apr 10, 2026
  2. added theissue type on Apr 10, 2026
  3. pinned this issue on Apr 10, 2026
  4. francisqureshi commented on Apr 12, 2026

    @francisqureshi

    I'd love to help out with this, I've been wanting to start contributing on Ghostty for some time and I've been working on Zig Master on my own Zig projects that use zig-objc so can for sure help there as I have a simple fork at the moment.

  5. pluiedev commented on Apr 12, 2026

    @pluiedev
    MemberAuthor

    If you can make a PR to zig-objc that will be great, as I only have access to a Linux machine :)

  6. pluiedev commented on Apr 12, 2026

    @pluiedev
    MemberAuthor

    @jacobsandlund Looks like the API changed a lot with the Zig 0.16 branch. I'm not smart enough to figure out how to port our uucode setup to the new system — could you maybe lend a hand?

    Update: never mind, I figured this out myself :)

  7. francisqureshi commented on Apr 12, 2026

    @francisqureshi

    If you can make a PR to zig-objc that will be great, as I only have access to a Linux machine :)

    Please see PR via: mitchellh/zig-objc#34 - as mentioned this will need a zig-objc 0.16 branch

  8. pluiedev commented on Apr 12, 2026

    @pluiedev
    MemberAuthor

    In-progress branch at https://github.com/pluiedev/ghostty/tree/zig-0.16 — the port is even trickier than I thought not just because of std.Io, but also because we apparently access environment variables somewhat haphazardly throughout the codebase which means a std.process.Environ object has to be lugged around everywhere. The fact that most of std.posix got nuked doesn't help, either.

  9. jcollie commented on Apr 12, 2026

    @jcollie
    Member

    because we apparently access environment variables somewhat haphazardly throughout the codebase which means a std.process.Environ object has to be lugged around everywhere.

    #11172

  10. jcollie commented on Apr 12, 2026

    @jcollie
    Member

    #11969 does something similar for arg parsing.

  11. ReillyBrogan commented on Apr 13, 2026

    @ReillyBrogan

    0.16.0 was tagged a couple of hours ago.

  12. jcollie commented on Apr 13, 2026

    @jcollie
    Member

    0.16.0 was tagged a couple of hours ago.

    Yep. There's a lot of work to do so this won't happen soon.

  13. jacobsandlund commented on Apr 14, 2026

    @jacobsandlund
    Contributor

    @jacobsandlund Looks like the API changed a lot with the Zig 0.16 branch. I'm not smart enough to figure out how to port our uucode setup to the new system — could you maybe lend a hand?

    ah shoot @pluiedev i meant to make a pr before 0.16 went out to make this easier. ty for getting this!

    @jcollie's pr on uucode is merged too.

    i also intend to switch main to 0.16, maybe in a day or so when i have time

    edit: main is now 0.16

  14. jcollie commented on Apr 16, 2026

    @jcollie
    Member

    Probably should remove all uses of @cImport to get ahead of:
    https://codeberg.org/ziglang/zig/pulls/31892

  15. vancluever commented on Apr 16, 2026

    @vancluever
    Contributor

    Just looking at the detail here and given the fact that I think z2d will be stable for at least a few weeks before I need to push anything, I'll just leave the Zig 0.16 branch as-is and then tag a new release once the migration is complete here. Will keep an eye out!

  16. 2 remaining items

  17. mitchellh commented on Apr 17, 2026

    @mitchellh
    Contributor

    libxev updated to be compatible with 0.16 (see notes for disclaimers): mitchellh/libxev#220

  18. vancluever commented on Apr 18, 2026

    @vancluever
    Contributor

    z2d should now be updated to work with Zig 0.16.0: vancluever/z2d#169

  19. hejdb commented on Apr 22, 2026

    @hejdb

    0.16
    Could we consider just removing the dependency on libxev altogether?

  20. pluiedev commented on Apr 23, 2026

    @pluiedev
    MemberAuthor

    In progress PR at #12388.

    @hejdb It's not as trivial as it sounds. We heavily depend on libxev's proven synchronization primitives while the std.Io.Evented implementation is not really ready for general use yet. The objective right now is to get everything working in the new language version, and reconciling libxev with std.Io is something we can work on later.

  21. ReillyBrogan commented on Apr 25, 2026

    @ReillyBrogan

    FYI apparently they are doing a shortened cycle for Zig 0.17 and it's expected to be released within a week or two. It's primarily to pull in the LLVM 22 update in order to fix a WASM regression with 0.16.

  22. dribic commented on Apr 28, 2026

    @dribic

    so 0.17 will be LLVM update only?

  23. jcollie commented on Apr 28, 2026

    @jcollie
    Member

    so 0.17 will be LLVM update only?

    I think that there will be some small bugfixes but no major new features other than LLVM. But the best place to check for that is on the ZSF Zulip.

  24. vancluever commented on Apr 28, 2026

    @vancluever
    Contributor

    BTW, I did end up releasing 0.11.0: https://github.com/vancluever/z2d/blob/v0.11.0/CHANGELOG.md

    Will probably end up releasing 0.12.0 off of Zig 0.17.0 when it comes out.

  25. ReillyBrogan commented on Apr 30, 2026

    @ReillyBrogan

    so 0.17 will be LLVM update only?

    I noticed that they committed this so there might be other major changes too. What they should really do is branch from 0.16 and cherry-pick just the LLVM support + bugfixes but I'm not a Zig maintainer so 🤷

  26. dribic commented on Apr 30, 2026

    @dribic

    so 0.17 will be LLVM update only?

    I noticed that they committed this so there might be other major changes too. What they should really do is branch from 0.16 and cherry-pick just the LLVM support + bugfixes but I'm not a Zig maintainer so 🤷

    The deletion of @cImport was expected, given that it is now being handled through the build system.

  27. vancluever commented on May 16, 2026

    @vancluever
    Contributor

    Just an update as this issue as there hasn't been many updates for a bit: we're still working on this and should hopefully have an update soon in the current WIP PR or one that supersedes it, whatever is easier. Thanks for your patience!

  28. added a commit that references this issue on Jul 22, 2026
    7aa9591
  29. unpinned this issue on Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions