fix(build): link libc to fix CI failures on Linux + cross-compile#7
Merged
fix(build): link libc to fix CI failures on Linux + cross-compile#7
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
std.c.{getcwd,getenv,realpath,write,mprotect}directly (the equivalentstd.posix.*surface was removed), butbuild.zigwas never updated to link libc.zig build test) and all 4 cross-compile targets (*-macos-none,*-linux-gnu), the build fails withdependency 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 therelease: v0.5.0push.link_libc = trueon the test module, thecache_genmodule, and thecljwexe module. F146 still tracks the eventual removal once pure-Zig equivalents land.Test plan
zig build test(macOS native) passeszig build -Doptimize=ReleaseSafe(macOS native) passes; smoke test(+ 1 2 3)returns 6zig build -Dtarget=x86_64-linux-gnu -Doptimize=ReleaseSafepasses (locally)zig build -Dtarget=aarch64-linux-gnu -Doptimize=ReleaseSafepasses (locally)zig build -Dtarget=x86_64-macos-none -Doptimize=ReleaseSafepasses (locally)zig build -Dtarget=aarch64-macos-none -Doptimize=ReleaseSafepasses (locally)test-macos,test-linux,cross-compile (×4)) all green