ziglibc is an experimental libc implementation in Zig covering the C standard library plus a growing POSIX surface.
- Builds with Zig
0.15.2. zig build testpasses on:- Linux native
- macOS targets executed through
darling - Windows GNU targets executed through
wine
zig build conformancepasses on the same matrix.- The in-tree parity runner compares ziglibc and the platform libc for the validated matrix on:
- process execution (
system,popen,pclose) - signal/sigaction basics
strtol/strtodno-digit behaviorsetitimer,select,pselect, andutimeswhere the platform libc exposes them
- process execution (
Conformance sources are tracked as git submodules. Initialize them before running the test or conformance steps:
git submodule update --init --recursiveThe conformance-related submodules live under dep/:
dep/libc-testdep/tiny-regex-cdep/open_posix_testsuitedep/glibc-testsuite
Build the default install artifacts with:
zig buildRun the project test suite with:
zig build testRun the conformance suite bundle with:
zig build conformanceUseful individual steps:
zig build libc-test
zig build glibc-check
zig build posix-test-suite
zig build austin-group-tests
zig build re-testsOn a Linux host, the build uses external runners for foreign test execution:
- Darwin targets:
darling - Windows GNU targets:
wine
Examples:
zig build test -Dtarget=x86_64-macos
zig build conformance -Dtarget=x86_64-macos
zig build test -Dtarget=x86_64-windows-gnu
zig build conformance -Dtarget=x86_64-windows-gnuaarch64-macos is also kept compiling in CI:
zig build -Dtarget=aarch64-macosAfter zig build, point zig cc at the generated headers and libraries:
zig cc \
-nostdlib \
-I PATH_TO_ZIGLIBC_SRC/inc/libc \
-I PATH_TO_ZIGLIBC_SRC/inc/posix \
-I PATH_TO_ZIGLIBC_SRC/inc/linux \
-L PATH_TO_ZIGLIBC_INSTALL/lib \
-lstart \
-lc- The validated Linux/macOS/Windows matrix is green for both
testandconformance. - Remaining
ENOSYSpaths are scoped to unsupported targets or unsupported OS-specific features outside that matrix. - The build will fail fast if required submodules are missing rather than cloning repositories during
zig build.