Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental Zig support for cross-compiling #32626

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

techknowlogick
Copy link
Member

adds some additional make steps, and replaces some xgo for some steps.

Currently zig is failing for darwin targets & linux-arm5, hence why they weren't switched out, and doesn't (yet?) support cross-compiling for freebsd.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 23, 2024
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 23, 2024
ZIG_TARGET.windows-arm64 := aarch64-windows-gnu
ZIG_TARGET.windows-386 := x86-windows-gnu
ZIG_TARGET.darwin-amd64 := x86_64-macos
ZIG_TARGET.darwin-arm64 := aarch64-macos
Copy link
Member

Choose a reason for hiding this comment

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

according to https://ziglang.org/devlog/2024/#2024-11-19, maybe it should be aarch64-macos-none?

Copy link
Contributor

Choose a reason for hiding this comment

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

You were reading wrong article. That article is about zip-bootstrap which is used to "bootstrap" the zig compiler, but not for zip compiler itself.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Nov 24, 2024

I have some questions about the cross-compiling. Is it possible to do native compiling as much as possible? Zig is still at an early stage and there are a lot of 🔍 in release notes.

  • For Linux targets: use github actions qemu (or use pre-cross-compiled musl lib)
  • For FreeBSD targets: use self-hosted Linux action runner and use docker to run a FreeBSD VM via KVM (then we could also test the binary artifacts in the VM)
  • For macOS & Windows: cross-compiling from Linux for them is widely supported, so maybe it isn't a problem.

@wxiaoguang
Copy link
Contributor

And one more thing, should we split the Makefile into small files (or even small scripts)? Now more and more things are being added into the Makefile, and it seems difficult to debug on step (one build).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/internal size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants