add target architecture validation for cross-compilation in zig toolchain#7269
add target architecture validation for cross-compilation in zig toolchain#7269waruqi merged 4 commits intoxmake-io:devfrom
Conversation
Summary of ChangesHello @luadebug, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Xmake build system's Zig toolchain integration by introducing architecture validation for cross-compilation. It prevents potentially invalid or unsupported cross-compilation configurations, specifically for Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds validation for the target architecture during cross-compilation with the Zig toolchain. The change ensures that if a cross-compilation target is specified, its architecture is consistent with the build's target architecture for x86_64 and aarch64. My review includes a suggestion to refactor the validation logic to be more concise and maintainable, and raises a question about the scope of the validation.
Refactor target and architecture initialization logic for cross-compilation support.
It's a bit strange; the |
|
If you remove |
|
I just tested it with actions, and everything works perfectly. It's mysterious xmake on my pc always has some issues that others can't reproduce... |
|
The problem is that I have the opencc installed on my Archlinux system, and xmake works correctly if I use a clean container. opencc's Considering that any build using zigcc should use |
#7180
hello.cpp
xmake.lua
Lets assume we cross-compile from amd64 to aarch64... Run
xmake f -vD -p linux -m debug -a arm64-v8a --toolchain=zig --cross=aarch64-linux-gnu && xmakeSo issue is that it tries to execute aarch64 executable on my amd64 machine... We need to make sure ~host postfix packages are being built to host processor not to target processor.
As
/home/lin/Downloads/packages/2601/o/opencc~host/1.1.9/source/build_cc7a577c/src/tools/opencc_dictis very good example of arm64 executable file according tofile /home/lin/Downloads/packages/2601/o/opencc~host/1.1.9/source/build_cc7a577c/src/tools/opencc_dict