-
Notifications
You must be signed in to change notification settings - Fork 1
Fix: Use cross for cross compilation #14
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the release workflow to use the cross tool for cross-compilation instead of the standard cargo build command. This change enables more reliable cross-platform builds by using containerized build environments.
Key Changes:
- Replaces
cargo buildwithcross buildin the release workflow - Adds installation of the
crosstool from its GitHub repository
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
.github/workflows/release.yml
Outdated
| - name: Build release binary | ||
| run: cargo build --release --target ${{ matrix.target }} | ||
| run: | | ||
| cargo install cross --git https://github.com/cross-rs/cross && \ |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Installing cross from source on every workflow run is inefficient and slow. Consider using a pre-built binary via cargo-binstall or caching the installation with actions/cache to speed up builds.
| cargo install cross --git https://github.com/cross-rs/cross && \ | |
| curl -sSL https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash | |
| cargo binstall cross --no-confirm |
.github/workflows/release.yml
Outdated
| - name: Build release binary | ||
| run: cargo build --release --target ${{ matrix.target }} | ||
| run: | | ||
| cargo install cross --git https://github.com/cross-rs/cross && \ |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider pinning to a specific commit or tag when installing from git (e.g., --git https://github.com/cross-rs/cross --tag v0.2.5) to ensure reproducible builds and avoid breaking changes from the main branch.
| cargo install cross --git https://github.com/cross-rs/cross && \ | |
| cargo install cross --git https://github.com/cross-rs/cross --tag v0.2.5 && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Build release binary (ARM Linux native) | ||
| if: matrix.target == 'aarch64-unknown-linux-gnu' | ||
| run: | | ||
| cargo install cross --git https://github.com/cross-rs/cross |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Installing cross from git on every build will be slow and inefficient. Consider caching the installation or using a pre-built release version with cargo install cross (without --git flag) for faster builds.
| cargo install cross --git https://github.com/cross-rs/cross | |
| cargo install cross |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Build release binary (ARM Linux native) | ||
| if: matrix.target == 'aarch64-unknown-linux-gnu' | ||
| run: | | ||
| cargo install cross --git https://github.com/cross-rs/cross | ||
| cross build --release --target ${{ matrix.target }} | ||
| - name: Build release binary (cross-compile) |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The step names are misleading. Step '(ARM Linux native)' uses cross-compilation via the cross tool, while '(cross-compile)' uses native cargo. Consider renaming to '(ARM Linux with cross)' and '(native cargo)' respectively to accurately reflect their functionality.
| - name: Build release binary (ARM Linux native) | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| cargo install cross --git https://github.com/cross-rs/cross | |
| cross build --release --target ${{ matrix.target }} | |
| - name: Build release binary (cross-compile) | |
| - name: Build release binary (ARM Linux with cross) | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| cargo install cross --git https://github.com/cross-rs/cross | |
| cross build --release --target ${{ matrix.target }} | |
| - name: Build release binary (native cargo) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Build release binary (ARM Linux native) | ||
| if: matrix.target == 'aarch64-unknown-linux-gnu' | ||
| run: | | ||
| cargo install cross --git https://github.com/cross-rs/cross |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Installing cross from git source on every workflow run is inefficient and slow. Consider either: (1) installing from crates.io with cargo install cross for faster installation, (2) using cargo binstall cross for binary installation, or (3) caching the installation between runs to improve build performance.
| cargo install cross --git https://github.com/cross-rs/cross | |
| cargo install cross |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| cargo install cross --git https://github.com/cross-rs/cross | ||
| cross build --release --target ${{ matrix.target }} | ||
| - name: Build release binary (cross-compile) |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The step name 'cross-compile' is confusing because this step uses native cargo build, not cross-compilation. The aarch64 target is actually the one being cross-compiled. Consider renaming to 'Build release binary (native)' for clarity.
| - name: Build release binary (cross-compile) | |
| - name: Build release binary (native) |
Fix: Use cross for cross compilation
Fix: Use cross for cross compilation
Use https://github.com/cross-rs/cross to cross compile