Uh oh!
There was an error while loading. Please reload this page.
fix(examples/zig): upgrade to zig 0.16 to unbreak the macOS test - #2951
Merged
Conversation
The zig-hello-world example test has been failing on macOS, which blocked
every release since `cli-release` gates on the test suite.
devbox.lock pinned zig 0.11.0 (from a Feb 2024 nixpkgs commit). Zig 0.11's
self-hosted Mach-O linker emits __DATA_CONST segments without the
SG_READ_ONLY flag, which modern macOS dyld rejects. The binary that crashed
was zig's own build runner, hence the opaque "the following build command
crashed". Linux was unaffected.
Pin zig explicitly at 0.16.0 rather than tracking `latest`: zig's build API
breaks across nearly every release, so an unpinned update would silently
re-break build.zig. This matches how go and nim are pinned in examples/.
Upgrading exposed a second, latent problem: build.zig used the pre-0.12 API
(`.root_source_file = .{ .path = ... }`), which no longer compiles. Migrate
both the executable and the test to the 0.15+ `root_module` API.
Also fix .gitignore -- zig 0.12 renamed the cache dir to .zig-cache, so
build output was no longer being ignored.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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
The
zig-hello-worldexample test has been failing on macOS, which blocks every release sincecli-releasegates on the test suite.devbox.lockpinned zig 0.11.0 (from a Feb 2024 nixpkgs commit), whose self-hosted Mach-O linker emits__DATA_CONSTsegments without theSG_READ_ONLYflag — modern macOS dyld rejects these, and the binary that crashed was zig's own build runner, hence the opaquethe following build command crashed(Linux was unaffected). This pins zig explicitly at0.16.0rather than trackinglatest, since zig's build API breaks across nearly every release and an unpinned update would silently re-breakbuild.zig— matching howgoandnimare already pinned underexamples/. Upgrading exposed a second latent problem, sobuild.zigis migrated from the pre-0.12.root_source_file = .{ .path = ... }form to the 0.15+root_moduleAPI for both the executable and the test. Finally,.gitignoreis corrected to.zig-cache/, since zig 0.12 renamed the cache directory and build output was no longer being ignored.How was it tested?
Reproduced the original
dyld: __DATA_CONST segment missing SG_READ_ONLY flagcrash locally on macos-arm64 (same architecture as themacos-latestrunner), then confirmed the fix through the exact CI harness rather than a barezig build:The Linux shard was not run locally, but both changes are platform-independent (build API) and already green there. All four systems resolve in the updated lock.
Community Contribution License
All community contributions in this pull request are licensed to the project
maintainers under the terms of the
Apache 2 License.
By creating this pull request, I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 License as stated in
the
Community Contribution License.
🤖 Generated with Claude Code