Repository navigation
update to Zig 0.16 - #12388
Closed
pluiedev wants to merge 16 commits into
Closed
update to Zig 0.16#12388pluiedev wants to merge 16 commits into
pluiedev wants to merge 16 commits into
Conversation
We also remove the Homebrew workaround for 0.15.2 as 0.16 should work just fine on Xcode 26.4.
Contributor
|
off-topic: would you please share the patch(es) for "Writergate"? I'm curious what that was and how it was migrated. |
Contributor
And then numerous follow-ups: https://github.com/ghostty-org/ghostty/pulls?q=is%3Apr+is%3Aclosed+zig+0.15 |
Mostly string replacements (std.fs -> std.Io) and propagating the Io interface wherever possible, but some APIs required more thought. Processes and environment variables are especially tricky.
…imestamp, and other various fixes
libvaxis has been a constant pain point when migrating language versions, so let's have a convenient way of ignoring it entirely
| block[i] == .transport_and_map_symbols; | ||
| } | ||
| } | ||
| }; |
Contributor
There was a problem hiding this comment.
confirming that this looks exactly right to me! sorry i didn't get in a PR to help prepare for this change
Contributor
|
I added this PR on top of |
Merged
Member
Author
|
Superseded by #12726 |
mitchellh
added a commit
that referenced
this pull request
Jul 22, 2026
Closes #12228 Supersedes #12388 **UPDATED** - Also check comments for additional details! This commit represents the majority of the work necessary to upgrade Ghostty to use Zig 0.16.0. At this point, all tests pass under Linux, but more work may be necessary to get them to build and function on other platforms. There are some parts of this update that deserve commentary, so that follows below: ## Expanded use of global state (IO/environment related) Global state, once generally only used by the C library, has now been expanded to be used across the project at large. The static local variable that holds the state has been moved private in its source container with all attributes that need to be accessed globally gated behind accessors, most of which guard on testing and send test copies instead. Use of the global state in non-testing scenarios asserts that the state has been initialized through `init` naturally through the optional assertion process. The rationale for this change is to have a location to store a general-purpose I/O implementation and environment variables, both of which are now provided through [Juicy Main](https://ziglang.org/download/0.16.0/release-notes.html#Juicy-Main) and hence can no longer be accessed or mutated through stdlib without use of lower-level system calls and hacks (some of which are employed, but sparingly). As the code matures, dependence on global state should naturally slim down. We do not allow global state to be used in libghostty-vt. There are comptime guards that prevent this should compilation of libghostty-vt end up pulling `global.zig`. This means that as per the last paragraph, work has already begun to de-couple the codebase from global state where necessary. Additionally, in some places where environment needs to be updated and where it can be done in an isolated fashion, environment maps are used - system-level injection of environment through the use of `setenv` or `unsetenv` now only happens during early initialization (and hopefully we can remove these in the future too, especially since they require re-synchronization of the higher-level environment primitives after this is done). ## The `lib/compat` Tree Some stdlib features that have been removed but still either seem they would be valuable to us or outright complex to move away from (particularly `SegmentedList`) have been extracted from 0.15.2, updated as needed, and placed in `src/lib/compat`. The intention again is to allow for piecemeal migration to more modern implementations or possibly straight local versions. This paradigm has also allowed us to add `std.Io.Condition.waitTimeout`, which incidentally was missed in the 0.16.0 shuffle and has been re-added for 0.17.0. We can remove this in favor of the upstream when we eventually migrate to that, obviously. Note that there was a lot more of this extracted code when this work was started, but a lot of said code has been removed (namely environment or process/fd-related functionality). ## translate-c Issues (functional on Linux, Darwin WIP) There have been a number of C translation issues that we have been working through through submitted patches and the great help from folks on the Arocc and Zig side. This is ongoing, with the remaining work to getting things fixed mainly focused on the MacOS side. Stay tuned for further developments. As mentioned at the top, follow comments for more details!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP! A lot of stuff still doesn't compile because all of this is a gigantic pain even more than Writergate.
Closes #12228