Open-Source Wikis

/

Zig

/

Reference

/

Dependencies

ziglang/zig

Dependencies

What zig depends on — at build time, at run time, and as bundled vendor trees.

Build-time dependencies (CMake stage1)

The cold-bootstrap path uses CMake to produce a stage1 zig. It pins:

  • CMake ≥ 3.15 (CMakeLists.txt).
  • LLVM, Clang, and LLD development packages, version pinned by the find_package(LLVM ...) calls in CMakeLists.txt. Look there for the exact version.
  • A C/C++ host toolchain — Clang, GCC, or MSVC.
  • Git (used to derive the RESOLVED_ZIG_VERSION via git describe).

Build-time dependencies (zig build)

Once a zig binary exists:

  • Just zig. build.zig consumes only the standard library plus declarations in src/dev.zig, src/Sema.zig, src/Compilation.zig, etc. There are no third-party Zig packages; build.zig.zon only references local-path test packages:

    .dependencies = .{
        .standalone_test_cases = .{ .path = "test/standalone" },
        .link_test_cases = .{ .path = "test/link" },
    },

Run-time dependencies of the built zig binary

zig is statically linked when possible. The runtime dependencies in practice are:

  • LLVM/clang/LLD — only when the LLVM backend is selected. Linked as native libraries via src/zig_llvm.cpp, src/zig_clang_*.cpp, src/zig_llvm-ar.cpp. With the self-hosted backend (-fno-llvm -fno-lld), no LLVM runtime is needed.
  • libc of the host — same caveats as any compiler.

Bundled vendor dependencies

These travel inside the repository (and inside the installed zig). Each is copied from upstream and refreshed periodically by a maintenance script.

Vendored Path Refresh script
glibc sources lib/libc/glibc/ tools/update_glibc.zig
musl sources lib/libc/musl/ (manual / periodic)
mingw-w64 sources lib/libc/mingw/ tools/update_mingw.zig
FreeBSD libc lib/libc/freebsd/ tools/update_freebsd_libc.zig
NetBSD libc lib/libc/netbsd/ tools/update_netbsd_libc.zig
WASI libc stubs lib/libc/wasi/ (manual)
Darwin headers lib/libc/darwin/ tools/fetch_them_macos_headers.zig, tools/macos-headers.c, tools/gen_macos_headers_c.zig
Linux UAPI headers lib/libc/include/ (subset) tools/update-linux-headers.zig, tools/process_headers.zig
libc++ lib/libcxx/ (manual: track LLVM release)
libc++abi lib/libcxxabi/ (manual)
libunwind lib/libunwind/ (manual)
libtsan lib/libtsan/ (manual)
Clang resource headers lib/include/ (manual: pinned to LLVM version)
Aro (C frontend) lib/compiler/aro/ (vendored copy of upstream Aro)
resinator lib/compiler/resinator/ (vendored upstream)

See Bundled libraries for how these trees are consumed.

Build-system dependencies of build.zig

build.zig uses only:

  • The standard library.
  • The internal src/dev.zig (Env enum) for build-mode feature gating.
  • The test driver test/tests.zig.
  • lib/init/ (for zig init template install).

No external Zig packages are required to build the compiler.

CI dependencies

The .forgejo/workflows/ci.yaml matrix expects:

  • Self-hosted runners labeled per target (aarch64-linux, aarch64-macos, ...). See the workflow file for the full list.
  • The shell scripts under ci/ install/locate the LLVM version they need on each runner.

Notes on hosting

README.md notes the project has moved to Codeberg. The dependency situation is unchanged; only the upstream forge has moved. The bundled trees and refresh scripts continue to work the same way.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Dependencies – Zig wiki | Factory