feat: add Linux ARM64 (aarch64) build target#156
Conversation
- Add linux-aarch64 to build matrix in release workflow - Configure cross-compilation toolchain for ARM64 - Install gcc-aarch64-linux-gnu for cross-compilation - Set proper linker for aarch64 target This enables native ARM64 wheel builds for better performance on ARM-based Docker environments (AWS Graviton, Apple Silicon, etc.)
There was a problem hiding this comment.
Pull request overview
This PR adds support for building native Linux ARM64 (aarch64) wheels to improve performance on ARM-based infrastructure like AWS Graviton and Apple Silicon Docker environments. The changes configure cross-compilation toolchains and update the release workflow to produce ARM64 binaries alongside existing x86_64 builds.
Key changes:
- Added linux-aarch64 build matrix entry with aarch64-unknown-linux-gnu target
- Configured Rust toolchain to support cross-compilation targets
- Added cross-compilation setup step that installs gcc-aarch64-linux-gnu toolchain
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| env: | ||
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc |
There was a problem hiding this comment.
The linker environment variable is set globally for all build jobs, but it's only relevant for the linux-aarch64 target. This will set the environment variable unnecessarily for all other platforms (including linux-x86_64, macOS, and Windows), which could potentially cause issues. The environment variable should be conditionally set only when building for linux-aarch64, similar to how the cross-compilation tools are installed.
| @@ -59,9 +67,19 @@ jobs: | |||
|
|
|||
| - name: Setup Rust | |||
| uses: dtolnay/rust-toolchain@stable | |||
There was a problem hiding this comment.
When the target is an empty string, this will pass an empty string to the Rust toolchain setup, which may cause issues. The dtolnay/rust-toolchain action should not receive an empty targets parameter when no cross-compilation is needed. Consider adding a conditional to only include the 'with' block when the target is non-empty.
| uses: dtolnay/rust-toolchain@stable | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Setup Rust target | |
| if: matrix.target != '' | |
| uses: dtolnay/rust-toolchain@stable |
This enables native ARM64 wheel builds for better performance on ARM-based Docker environments (AWS Graviton, Apple Silicon, etc.)