Skip to content

upgrade to zig 0.17.0 - #64

Merged
marler8997 merged 1 commit into
masterfrom
zig-0.17
Oct 18, 2026
Merged

marler8997 merged 1 commit into
masterfrom
zig-0.17

Conversation

@marler8997

@marler8997 marler8997 commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Drops zig 0.15/0.16 support and moves to 0.17.0.

Changes

  • Networking on std.Io (std.net is gone in 0.17). Breaking API changes: draft.connect(io, environ, buf), connect(io, host), disconnect(io, stream), getDisplay(environ, buf) (no heap allocation on windows), getAuthFilename(environ, ...), connectUnix(io, path), and a new x11.Address replacing std.net.Address. socketReader/socketWriter/wsaStartup are removed (0.17 doesn't need WSAStartup on windows).
  • zig-staticio (via zig-patch) for the examples and xauth to keep the binaries small. The unit tests use stock std since that's what most users of the module have.
  • TrueType switched to codeberg.org/andrewrk/TrueType, which supports 0.17.
  • dbe example waits on the socket with io.operateTimeout instead of std.posix.poll, which no longer compiles for windows.
  • Removed the zigversion/netpatch/stdext compat shims and examples/Cmdline.zig.
  • zig fmt on the whole codebase. Most of the diff is its mechanical @intFromEnum/@enumFromInt → @backingInt/@fromBackingInt(@intCast(...)) migration. The charset generator was updated to emit the formatted output (regenerating reproduces the files exactly).
  • CI: macos-latest instead of the macos-15 pin, which was only needed for zig 0.15.2.

Verification

  • zig build install test-non-interactive passes (31/31 unit tests); everything cross-compiles for x86_64/aarch64 windows and macos.
  • Against a 0.15.2 build on Xvfb: identical getserverfontnames/queryfont output, pixel-identical screenshots for all non-animated examples, and the same behavior for unix/TCP/hostname connections, Xauthority cookies and the auth retry/reconnect path.
  • Not run on real windows. Under Wine, std 0.17's windows networking fails before reaching zigx code (see zig-bugs/wine-host-name-lookup-segfault).

Follow-ups

Pre-existing issues found while testing, both also exist on the 0.15.2 master:

Binary size (stripped, 0.15.2 → 0.17.0 + staticio)

exe small fast safe debug
hello 149K → 159K 669K → 821K 501K → 562K 2.9M → 3.5M
xauth 25K → 30K 39K → 57K 268K → 318K 1.7M → 2.1M
text 1087K → 1096K 1682K → 1836K 1481K → 1555K 4.8M → 5.2M

Without staticio, 0.17 small xauth is 124K and hello 226K. The remaining growth vs 0.15.2 is in std's stack trace/log code (e.g. sort.block is ~100K of ReleaseFast hello); zigx's own networking code got smaller. Clean build times (single run): small 5.7s → 6.2s, fast 22.5s → 28.5s, safe 16.7s → 21.1s, debug ~2.3s unchanged.

https://ampcode.com/threads/T-01a14b88-aff8-717e-bb9f-364137832240

@marler8997
marler8997 force-pushed the zig-0.17 branch 6 times, most recently from fb676a3 to 83c39d0 Compare October 17, 2026 22:05
Drop support for zig 0.15 and 0.16 and go straight to 0.17.0.

- port networking from std.net/std.posix to std.Io; the connect, auth and
  environment functions now take an io and/or environ
  (draft.connect(io, environ, buf), connect(io, host), disconnect(io, stream),
  getDisplay(environ, buf), getAuthFilename(environ, ...), connectUnix(io, path))
- add x11.Address (std.net.Address is gone) and remove socketReader,
  socketWriter and wsaStartup
- remove the zigversion/netpatch/stdext compat shims and examples/Cmdline.zig
- getDisplay converts DISPLAY into a caller provided buffer on windows
  instead of leaking a page_allocator allocation
- examples and xauth use zig-staticio (applied with zig-patch) to keep the
  binaries small; the unit tests use stock std
- switch TrueType to codeberg.org/andrewrk/TrueType which supports 0.17
- dbe example waits on the socket with io.operateTimeout instead of
  std.posix.poll, which no longer compiles for windows
- run zig fmt on the whole codebase (mostly the @intFromEnum/@enumFromInt
  to @backingInt/@fromBackingInt migration) and update the charset
  generator to produce the formatted output
- ci: macos-latest instead of pinning macos-15

Amp-Thread-ID: https://ampcode.com/threads/T-01a14b88-aff8-717e-bb9f-364137832240
Co-authored-by: Amp <amp@ampcode.com>
@marler8997
marler8997 merged commit 7934b50 into master Oct 18, 2026
4 checks passed
@marler8997
marler8997 deleted the zig-0.17 branch October 18, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant