Skip to content

fix(examples/zig): upgrade to zig 0.16 to unbreak the macOS test - #2951

Merged
mikeland73 merged 1 commit into
mainfrom
mikeland73/fix-zig-test
Aug 16, 2026
Merged

fix(examples/zig): upgrade to zig 0.16 to unbreak the macOS test#2951
mikeland73 merged 1 commit into
mainfrom
mikeland73/fix-zig-test

Conversation

@mikeland73

Copy link
Copy Markdown
Collaborator

Summary

The zig-hello-world example test has been failing on macOS, which blocks every release since cli-release gates on the test suite. devbox.lock pinned zig 0.11.0 (from a Feb 2024 nixpkgs commit), whose self-hosted Mach-O linker emits __DATA_CONST segments without the SG_READ_ONLY flag — modern macOS dyld rejects these, and the binary that crashed was zig's own build runner, hence the opaque the following build command crashed (Linux was unaffected). This pins zig explicitly at 0.16.0 rather than tracking latest, since zig's build API breaks across nearly every release and an unpinned update would silently re-break build.zig — matching how go and nim are already pinned under examples/. Upgrading exposed a second latent problem, so build.zig is migrated from the pre-0.12 .root_source_file = .{ .path = ... } form to the 0.15+ root_module API for both the executable and the test. Finally, .gitignore is 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 flag crash locally on macos-arm64 (same architecture as the macos-latest runner), then confirmed the fix through the exact CI harness rather than a bare zig build:

DEVBOX_RUN_PROJECT_TESTS=1 go test ./testscripts -run 'TestExamples/development_zig_zig-hello-world_run_test' -v
Build Summary: 6/6 steps succeeded; 1/1 tests passed
--- PASS: TestExamples/development_zig_zig-hello-world_run_test.test (2.56s)
ok go.jetify.com/devbox/testscripts

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

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>
CopilotAI lite review requested due to automatic review settings August 16, 2026 17:06

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mikeland73
mikeland73 merged commit c8cc023 into mainAug 16, 2026
43 of 51 checks passed
@mikeland73
mikeland73 deleted the mikeland73/fix-zig-test branch August 16, 2026 17:49
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@mikeland73