build: migrate to Zig 0.16.0#28
Merged
Merged
Conversation
- zig 0.16.0 via mise; minimum_zig_version 0.16.0 - vaxis 0.5.1 -> 0.6.0 (pulls uucode 0.2.0), clap 0.11.0 -> 0.12.0, zeit 0.6.0 -> v0.9.0, zig-toml -> 00c5715e — each the last revision supporting zig 0.16 (masters already require 0.17-dev) - build.zig: link/include APIs moved from Compile to root_module; zon parse via fromSliceAlloc; drop duplicate libgit2 config on the test step (it shares exe.root_module)
zig 0.16 threads an explicit std.Io through fs/time/process/net APIs. main now uses the std.process.Init entry convention (gpa, io, environ, args provided by start code) and stores io/environ in global_io.zig so the rest of the codebase — including mruby C callbacks that cannot take an io parameter — can access them. Unit tests fall back to the blocking single-threaded Io. global_io also provides getEnv/getEnvOwned replacing the removed std.process env APIs.
std.net was removed in zig 0.16. Hostname resolution now goes through std.Io.net.HostName.lookup draining an Io.Queue (capped at 16 results), replacing getAddressList; nameserver sockaddr conversion uses std.Io.Threaded.addressToPosix; the raw UDP DNS query keeps its behavior via libc std.c.socket/sendto/recv since the std.posix socket wrappers were also removed. Note: the system-resolver path previously used libc getaddrinfo; zig's own resolver reads /etc/resolv.conf and /etc/hosts directly, so mDNS (.local) and scoped-resolver setups may behave differently.
Mechanical migration of the removed/relocated 0.15 std APIs:
- std.fs.File/Dir/cwd -> std.Io.File/Dir with io threaded as first arg;
makePath -> createDirPath; readToEndAlloc/readAll/writeAll -> reader/
writeStreamingAll interfaces; stat fields (permissions, Timestamp)
- std.time sleep/timestamps and std.Thread sleep/Mutex/Condition ->
Io equivalents (lockUncancelable for the previously-infallible lock)
- std.process Child.init/run/EnvMap/ArgIterator -> process.spawn(io)/
run(gpa, io)/Environ.Map/Args.Iterator; lowercase Term/StdIo tags
- ArrayList .{} init -> .empty; ArrayList.writer -> Io.Writer.Allocating;
std.io.fixedBufferStream -> Io.Writer.fixed; json ObjectMap unmanaged
- GeneralPurposeAllocator -> DebugAllocator; crypto.random -> io.random
- posix isatty/waitpid/fchmod/fstatat removed -> Io/libc equivalents;
chown now passes -1 to preserve ids instead of stat'ing first (musl's
struct stat does not survive translate-c, and this drops a TOCTOU)
- CoreFoundation cImports consolidated into cf.zig with narrow includes
plus a _MACH_MESSAGE_H_ guard: 0.16 translate-c cannot handle the
mach_msg descriptor types pulled in by the umbrella header
- Io.Dir.setFileOwner is broken upstream in 0.16.0 (declared error set
narrower than the implementation's); link.zig uses libc fchownat
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.
Supersedes #27 (closed automatically when its stacked base branch was deleted after #26 merged; GitHub cannot reopen it). Content is identical — see #27 for the original description and green CI run.
Summary
Migrates the codebase from Zig 0.15.2 to 0.16.0. Also fixes CI:
macos-latestrunners now ship an Xcode whoselibSystem.tbdonly declaresarm64e-macos, which 0.15.2's linker cannot resolve; 0.16.0 handles it (this is why #26's checks were red on unmodified code).Commits
std.process.Initmain convention +src/global_io.zigprocess-wide Io accessorstd.Io.net.HostName.lookup(behavior note: zig's own resolver instead of libc getaddrinfo)std.Io, Writergate fallout, unmanaged containers, libc fallbacks (Io.Dir.setFileOwnerupstream bug, musl translate-c limits), CoreFoundation cImport consolidation with_MACH_MESSAGE_H_guardVerified
version+ fullprovisionrunprovision,node-info; host = macOS 26.5.1 + Xcode 26.6, no SDK workaroundsKnown behavior deltas
std.process.runforces stdin.ignoreon capture-and-wait helperschownhelpers pass-1to preserve ids (drops a TOCTOU)