Skip to content

fix(build): link libc to fix CI failures on Linux + cross-compile#7

Merged
chaploud merged 1 commit intomainfrom
develop/hotfix-link-libc
Apr 26, 2026
Merged

fix(build): link libc to fix CI failures on Linux + cross-compile#7
chaploud merged 1 commit intomainfrom
develop/hotfix-link-libc

Conversation

@chaploud
Copy link
Copy Markdown
Contributor

Summary

  • Zig 0.16.0 migration switched runtime helpers to call std.c.{getcwd,getenv,realpath,write,mprotect} directly (the equivalent std.posix.* surface was removed), but build.zig was never updated to link libc.
  • macOS native auto-links libc, which masked the regression locally. On Linux native (zig build test) and all 4 cross-compile targets (*-macos-none, *-linux-gnu), the build fails with dependency on libc must be explicitly specified — observed on every CI run from PR Migrate to Zig 0.16.0 + zwasm v1.11.0 #5 onward, including the release: v0.5.0 push.
  • This patch sets link_libc = true on the test module, the cache_gen module, and the cljw exe module. F146 still tracks the eventual removal once pure-Zig equivalents land.

Test plan

  • zig build test (macOS native) passes
  • zig build -Doptimize=ReleaseSafe (macOS native) passes; smoke test (+ 1 2 3) returns 6
  • zig build -Dtarget=x86_64-linux-gnu -Doptimize=ReleaseSafe passes (locally)
  • zig build -Dtarget=aarch64-linux-gnu -Doptimize=ReleaseSafe passes (locally)
  • zig build -Dtarget=x86_64-macos-none -Doptimize=ReleaseSafe passes (locally)
  • zig build -Dtarget=aarch64-macos-none -Doptimize=ReleaseSafe passes (locally)
  • CI (test-macos, test-linux, cross-compile (×4)) all green

The Zig 0.16.0 migration switched several runtime helpers
(runtime/lifecycle, lang/builtins/system, lang/interop/classes/file,
engine/vm/jit, runtime/io_default) to call std.c.{getcwd, getenv,
realpath, write, mprotect} directly because the corresponding
std.posix.* surface was removed. build.zig was never updated to
link libc explicitly, so the references resolved only on macOS
native targets where libc is auto-linked. Linux native builds and
all *-macos-none / *-linux-gnu cross-compile targets failed with
"dependency on libc must be explicitly specified" (cache_gen
ReleaseSafe + zig build test on Linux + every cross-compile job).

Set link_libc = true on the test module, the cache_gen module, and
the cljw exe module to match the post-migration source-level
dependency. F146 still tracks the eventual removal once std.c
usages get pure-Zig equivalents.
@chaploud chaploud merged commit 184c873 into main Apr 26, 2026
6 checks passed
@chaploud chaploud deleted the develop/hotfix-link-libc branch April 26, 2026 18:13
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