atproto utils for zig zat.dev

build: stop linking libc #35

Merged zzstoatzz.io
targeting main from feat/no-libc
Merged opened by and assigned to zzstoatzz.io
targeting main from feat/no-libc

zat stops linking libc: on Linux, Windows and wasi it now builds static binaries with no C library, as the Go SDKs do. libc came in through websocket.zig's C zlib (permessage-deflate) and a link_libc flag in zttp, which this branch replaces with pmdeflate and drops.

target zat v0.7.0-alpha.2 this branch atmos
linux x86_64, aarch64, armv7, riscv64, s390x musl no libc, ran no libc
windows x86_64, aarch64 UCRT no libc no libc
wasi wasi-libc no libc no libc
macOS libSystem libSystem libSystem
freebsd FreeBSD libc FreeBSD libc no libc

the build matrix in atproto-bench (matrix/zat-no-libc, spindle run 3mzz7ccccuu22) built and ran the same probe against d6463aa, the previous round, which pinned the dependency commits before their releases. probes built unstripped against the release carry musl's start-up symbols, import the UCRT's api-ms-win-crt-* DLLs and contain wasi-libc; against this branch they carry none, and the Windows probe imports only KERNEL32, ntdll and CRYPT32. FreeBSD differs from Go because Zig's standard library uses the system libc there.

dependencies

both dependencies are pinned to tagged releases:

  • zttp v0.3.0 drops zttp's link_libc flag; zttp makes no libc calls.
  • websocket.zig v0.3.0 compresses with pmdeflate v0.1.0 instead of C zlib. Autobahn TestSuite gives the same result as zlib on all 1,551 case results, rerun against the release.

the last commit cuts v0.7.0-alpha.3.

what's in it
  • the stress test and publish-docs read environment variables through std.testing.environ and std.process.Init instead of libc getenv, zat's last libc calls.
  • build.zig no longer sets link_libc on the module, examples or scripts.
tests
  • every commit passes just check and zig build test (606 tests).
  • all 14 installed artifacts build for x86_64, aarch64 and riscv64-linux-none as static binaries, and the test suite compiles for x86_64-linux-none and for CI's arm-linux-musleabihf -Dcpu=arm1176jzf_s.
  • the atproto-bench zig decode bench, interleaved twice against v0.7.0-alpha.2, is within 2% on every path.
  • #34's xrpc campaign fails from zttp 7b1e56e onward, which zat main already pins: zttp refuses a deadlined request on an Io without concurrent, and #34's simulated Io has none. its firehose and runtime campaigns pass at 300 cases.
  • for Windows, examples and bench tools that read arguments through std.process.Args do not build (Zig 0.17 requires initAllocator there); main fails the same way.

🤖 Generated with Claude Code

Commits 0