Skip to content

fix: translate Rust ARM64 target for Zig - #78

Merged
OnlineChef merged 5 commits into
mainfrom
fix/zig-musl-target-translation
Jul 25, 2026
Merged

fix: translate Rust ARM64 target for Zig#78
OnlineChef merged 5 commits into
mainfrom
fix/zig-musl-target-translation

Conversation

@OnlineChef

@OnlineChef OnlineChef commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Failures resolved

  1. cc-rs forwarded Rust's --target=aarch64-unknown-linux-musl, which Zig rejects because its equivalent triple is aarch64-linux-musl.
  2. Once compilation completed, the final link failed with duplicate _start / _start_c symbols because Rust's self-contained musl target and Zig both supplied crt1.o.

Fix

  • The C/C++ wrappers remove only the duplicate Rust-form --target argument and invoke Zig with aarch64-linux-musl; every other compiler argument is preserved.
  • zig cc always injects its own musl crt1.o and honours neither -nostartfiles nor -nostdlib to suppress it (reproduced and verified against Zig 0.15.2 by cross-compiling a musl binary), so the duplicate _start cannot be resolved from the wrapper side. Instead the aarch64 build disables Rust's self-contained linking so Rust stops emitting its own CRT/libc and Zig alone owns the CRT, libc, and libunwind:
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS=-C link-self-contained=no"
  • The link behavior lives inside the release workflow, so it applies while building the immutable tag commit rather than depending on files added after the tag.

Acceptance

The branch runs the real v0.7.6 portable release workflow. Linux ARM64 must compile and link, publish alongside both macOS binaries, generate SHA256SUMS, and update the stable manifest.

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The AArch64 musl build configuration now disables default standard-library linkage and updates generated Zig C/C++ wrappers to remove incompatible Rust target arguments before compilation.

Changes

AArch64 musl build configuration

Layer / File(s) Summary
Musl linker and compiler wrappers
.cargo/config.toml, .github/workflows/release-portable-assets.yml
Cargo passes -nostdlib for the AArch64 musl target. Release workflow wrappers use strict Bash mode, filter the Rust target argument, and invoke Zig with the fixed aarch64-linux-musl target.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: translating the Rust ARM64 target for Zig.
Description check ✅ Passed The description is directly related to the workflow and linker changes in the pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)

✅ Unit Test PR creation complete.

  • Create PR with unit tests
  • Commit unit tests in branch fix/zig-musl-target-translation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@OnlineChef
OnlineChef merged commit 2903932 into main Jul 25, 2026
26 checks passed
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Note

Unit test generation is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.


Generating unit tests... This may take up to 20 minutes.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

✅ Created PR with unit tests: #81

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