A powerful GitHub Action for building, testing, and checking Rust projects with cross-compilation support. This action automatically downloads and configures the necessary cross-compilation toolchains, making it easy to execute various Rust commands for multiple platforms. No Need Docker!
- 🚀 Cross-compilation support for Linux (GNU/musl), Windows, macOS, FreeBSD, Android, and iOS
- 🖥️ Multi-platform hosts - runs on Linux (x86_64/aarch64/armv7/riscv64/s390x/powerpc64/powerpc64le/mips64/mips64el/loongarch64), macOS (x86_64/aarch64), and Windows (x86_64)
- 📦 Automatic toolchain setup - downloads and configures cross-compilers as needed
- 🎯 Multiple target support - build for 63+ target platforms in a single run
- 🏗️ Workspace support - work with entire workspaces or specific packages
- ⚡ Flexible linking - some musl targets default to static (varies by target), GNU targets default to dynamic, both configurable via
crt-staticparameter - đź”§ Flexible configuration - extensive customization options
- 🛠️ Multiple commands - supports build, bench, test, and check operations
You can install this tool as a cargo subcommand for easy cross-compilation:
# Install from crate
cargo install cargo-cross
# Install from GitHub
cargo install cargo-cross --git https://github.com/zijiren233/cargo-cross
# Or install from local path
cargo install --path .After installation, you can use cargo cross command:
# Show help
cargo cross --help
# Show all supported targets
cargo cross --show-all-targets
# Build for a specific target
cargo cross build --target x86_64-unknown-linux-musl
# Build for multiple targets
cargo cross build --targets x86_64-unknown-linux-musl,aarch64-unknown-linux-musl
# Build with release profile
cargo cross build --target x86_64-unknown-linux-musl --release
# Build with features
cargo cross build --target x86_64-unknown-linux-musl --features feature1,feature2
# Test for a target
cargo cross test --target x86_64-unknown-linux-musl
# Check the project
cargo cross check --target x86_64-unknown-linux-musl
# Build with specific glibc version for GNU targets
cargo cross build --target x86_64-unknown-linux-gnu --glibc-version 2.31
# Build iOS targets with specific iPhone SDK version
cargo cross build --target aarch64-apple-ios --iphone-sdk-version 18.2
# Build macOS targets with specific macOS SDK version (native macOS only)
cargo cross build --target aarch64-apple-darwin --macos-sdk-version 14.0
# Build FreeBSD targets with specific FreeBSD version
cargo cross build --target x86_64-unknown-freebsd --freebsd-version 14
# Build with custom SDK path (skips version lookup)
cargo cross build --target aarch64-apple-darwin --macos-sdk-path /path/to/MacOSX.sdk
cargo cross build --target aarch64-apple-ios --iphone-sdk-path /path/to/iPhoneOS.sdk
cargo cross build --target aarch64-apple-ios-sim --iphone-simulator-sdk-path /path/to/iPhoneSimulator.sdkname: Build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cross compile
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: |
x86_64-unknown-linux-musl
aarch64-unknown-linux-muslname: Release
on:
release:
types: [created]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Build Release
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: |
x86_64-unknown-linux-musl
aarch64-unknown-linux-musl
x86_64-pc-windows-gnu
x86_64-apple-darwin
aarch64-apple-darwin
profile: release
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: binaries-${{ matrix.os }}
path: target/*/release/*This action can run on the following GitHub Actions runners or local platforms:
| Platform | Architecture | GitHub Runner | Local Support |
|---|---|---|---|
| Linux | x86_64 (amd64) | ubuntu-latest, ubuntu-24.04, ubuntu-22.04, ubuntu-20.04 |
âś… Yes |
| Linux | aarch64 (arm64) | ubuntu-24.04-arm |
âś… Yes |
| Linux | armv7 | Self-hosted runners | âś… Yes |
| Linux | riscv64 | Self-hosted runners | âś… Yes |
| Linux | s390x | Self-hosted runners | âś… Yes |
| Linux | powerpc64 | Self-hosted runners | âś… Yes |
| Linux | powerpc64le | Self-hosted runners | âś… Yes |
| Linux | mips64 | Self-hosted runners | âś… Yes |
| Linux | mips64el | Self-hosted runners | âś… Yes |
| Linux | loongarch64 | Self-hosted runners | âś… Yes |
| macOS | x86_64 (Intel) | macos-15-intel |
âś… Yes |
| macOS | aarch64 (Apple Silicon) | macos-15 |
âś… Yes |
| Windows | x86_64 | windows-latest |
âś… Yes |
For maximum compatibility and cross-compilation support, use Linux x86_64 runners:
jobs:
build:
runs-on: ubuntu-latest # Best for cross-compilation
steps:
- uses: actions/checkout@v3
- uses: zijiren233/cargo-cross@v1
with:
targets: |
x86_64-unknown-linux-musl
aarch64-unknown-linux-musl
x86_64-pc-windows-gnu
aarch64-apple-darwin
aarch64-apple-iosFor macOS/iOS native/cross builds, use macOS runners:
jobs:
build-macos:
runs-on: macos-latest # Apple Silicon
steps:
- uses: actions/checkout@v3
- uses: zijiren233/cargo-cross@v1
with:
targets: |
x86_64-unknown-linux-musl
aarch64-unknown-linux-musl
x86_64-pc-windows-gnu
aarch64-apple-darwin
aarch64-apple-iosMost musl targets produce statically linked binaries by default, but this varies by target (check rustc --print=target-spec-json -Z unstable-options --target <target> for the actual default). Use crt-static: true/false to explicitly control linking behavior.
i586-unknown-linux-musl- Linux i586i686-unknown-linux-musl- Linux i686x86_64-unknown-linux-musl- Linux x86_64arm-unknown-linux-musleabi- ARM Linuxarm-unknown-linux-musleabihf- ARM Linux hard-floatarmv5te-unknown-linux-musleabi- ARMv5TE Linuxarmv7-unknown-linux-musleabi- ARMv7 Linuxarmv7-unknown-linux-musleabihf- ARMv7 Linux hard-floataarch64-unknown-linux-musl- ARM64 Linuxloongarch64-unknown-linux-musl- LoongArch64 Linuxmips-unknown-linux-musl- MIPS Linuxmipsel-unknown-linux-musl- MIPS little-endian Linuxmips64-unknown-linux-muslabi64- MIPS64 Linuxmips64-openwrt-linux-musl- MIPS64 OpenWrt Linuxmips64el-unknown-linux-muslabi64- MIPS64 little-endian Linuxpowerpc64-unknown-linux-musl- PowerPC64 Linuxpowerpc64le-unknown-linux-musl- PowerPC64 little-endian Linuxriscv64gc-unknown-linux-musl- RISC-V 64-bit Linuxs390x-unknown-linux-musl- S390x Linux
GNU libc targets produce dynamically linked binaries by default. Use crt-static: true to enable static linking.
Glibc version: By default, glibc 2.28 is used. You can specify a different version (2.28-2.42) using the glibc-version parameter for better compatibility with specific Linux distributions.
i586-unknown-linux-gnu- Linux i586i686-unknown-linux-gnu- Linux i686x86_64-unknown-linux-gnu- Linux x86_64arm-unknown-linux-gnueabi- ARM Linuxarm-unknown-linux-gnueabihf- ARM Linux hard-floatarmv5te-unknown-linux-gnueabi- ARMv5TE Linuxarmv7-unknown-linux-gnueabi- ARMv7 Linuxarmv7-unknown-linux-gnueabihf- ARMv7 Linux hard-floataarch64-unknown-linux-gnu- ARM64 Linuxloongarch64-unknown-linux-gnu- LoongArch64 Linuxmips-unknown-linux-gnu- MIPS Linuxmipsel-unknown-linux-gnu- MIPS little-endian Linuxmips64-unknown-linux-gnuabi64- MIPS64 Linuxmips64el-unknown-linux-gnuabi64- MIPS64 little-endian Linuxpowerpc64-unknown-linux-gnu- PowerPC64 Linuxpowerpc64le-unknown-linux-gnu- PowerPC64 little-endian Linuxriscv64gc-unknown-linux-gnu- RISC-V 64-bit Linuxs390x-unknown-linux-gnu- S390x Linux
i686-pc-windows-gnu- Windows i686 (MinGW)x86_64-pc-windows-gnu- Windows x86_64 (MinGW)
x86_64-unknown-freebsd- FreeBSD x86_64aarch64-unknown-freebsd- FreeBSD ARM64powerpc64-unknown-freebsd- FreeBSD PowerPC64powerpc64le-unknown-freebsd- FreeBSD PowerPC64 little-endianriscv64gc-unknown-freebsd- FreeBSD RISC-V 64-bit
x86_64-apple-darwin- macOS Intel (x86_64)x86_64h-apple-darwin- macOS Intel (x86_64h, optimized for Haswell+)aarch64-apple-darwin- macOS Apple Silicon (ARM64)arm64e-apple-darwin- macOS Apple Silicon (ARM64e)
i686-linux-android- Android x86x86_64-linux-android- Android x86_64armv7-linux-androideabi- Android ARMv7arm-linux-androideabi- Android ARMaarch64-linux-android- Android ARM64riscv64-linux-android- Android RISC-V 64-bit
x86_64-apple-ios- iOS Simulator (x86_64)aarch64-apple-ios- iOS ARM64aarch64-apple-ios-sim- iOS ARM64 Simulator
| Input | Description | Default |
|---|---|---|
command |
Command to execute (build, test, check) |
build |
targets |
Newline-separated list of Rust target triples (comma-separated also supported) | Host target |
profile |
Build profile (debug or release) |
release |
features |
Comma-separated list of features to activate | |
no-default-features |
Do not activate default features | false |
all-features |
Activate all available features | false |
package |
Package to build (workspace member) | |
bin |
Binary target to build | |
workspace |
Build all workspace members | false |
manifest-path |
Path to Cargo.toml | |
source-dir |
Directory containing the Rust project | ${{ github.workspace }} |
github-proxy-mirror |
GitHub proxy mirror URL | |
cross-compiler-dir |
Directory to store cross compilers | |
ndk-version |
Android NDK version (e.g., r27d, r29) | r27d (LTS) |
glibc-version |
Glibc version for GNU targets (e.g., 2.31, 2.42) | (default) |
iphone-sdk-version |
iPhone SDK version for iOS targets (non-macOS: bundled SDKs, macOS: installed Xcode SDK) | (default 26.2) |
iphone-sdk-path |
Override iPhoneOS SDK path for device targets (skips version lookup, native macOS only) | |
iphone-simulator-sdk-path |
Override iPhoneSimulator SDK path for simulator targets (skips version lookup, native macOS only) | |
macos-sdk-version |
macOS SDK version for Darwin targets (non-macOS: bundled SDKs, macOS: installed Xcode SDK) | (default 26.2) |
macos-sdk-path |
Override macOS SDK path directly (skips version lookup, native macOS only) | |
freebsd-version |
FreeBSD version for FreeBSD targets (13, 14, or 15) | 13 |
use-default-linker |
Use system default linker | false |
cc |
Force set the C compiler | |
cxx |
Force set the C++ compiler | |
rustflags |
Additional rustflags | |
crt-static |
Control CRT linking mode: true for static (+crt-static), false for dynamic (-crt-static), empty for target default (varies by target) |
|
build-std |
Use -Zbuild-std for building standard library from source (true for default, or specify crates like core,alloc) |
false |
args |
Additional arguments to pass to cargo command | |
toolchain |
Rust toolchain to use (stable, nightly, etc.) | stable |
cargo-trim-paths |
Set CARGO_TRIM_PATHS environment variable for reproducible builds | |
no-embed-metadata |
Add -Zno-embed-metadata flag to cargo | false |
rustc-bootstrap |
Set RUSTC_BOOTSTRAP environment variable: 1 for all crates, -1 for stable behavior, or crate_name for specific crate |
|
clean-cache |
Clean build cache before building | false |
no-strip |
Do not strip binaries | false |
verbose |
Use verbose output | false |
| Output | Description |
|---|---|
targets |
Targets that were processed |
- name: Build with features
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-musl
features: feature1,feature2
no-default-features: true- name: Build specific binary
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-musl
package: my-package
bin: my-binary- name: Build for Android
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: |
aarch64-linux-android
armv7-linux-androideabi
# ndk-version: r29 # Optional: specify NDK version (default: r27d LTS)- name: Build with custom compiler
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-gnu
cc: /usr/bin/custom-gcc
cxx: /usr/bin/custom-g++Note: The default linking behavior varies by target. Most musl targets default to static linking, but not all. Use
crt-staticto explicitly control the behavior.
# Force static linking for musl target
- name: Build musl with static linking
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-musl
crt-static: true
# Force dynamic linking for musl target
- name: Build musl with dynamic linking
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-musl
crt-static: false
# GNU targets: dynamic by default, set to true for static linking
- name: Build GNU with static linking
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-gnu
crt-static: true
# Leave empty to use target's default behavior
- name: Build with default linking
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: |
x86_64-unknown-linux-musl
x86_64-unknown-linux-gnu
# crt-static not specified - uses target defaultsThe cross-make toolchains support multiple glibc versions (2.28 to 2.42). Use the glibc-version parameter to specify a particular version for GNU targets.
# Use glibc 2.31 (Ubuntu 20.04 compatible)
- name: Build with glibc 2.31
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-gnu
glibc-version: "2.31"
# Use latest glibc 2.42
- name: Build with glibc 2.42
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: |
x86_64-unknown-linux-gnu
aarch64-unknown-linux-gnu
glibc-version: "2.42"
# Leave empty for default glibc version (2.28 for most targets)
- name: Build with default glibc
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-gnu
# glibc-version not specified - uses defaultSupported glibc versions: 2.28 (default), 2.31, 2.32, 2.33, 2.34, 2.35, 2.36, 2.37, 2.38, 2.39, 2.40, 2.41, 2.42
You can specify a specific iPhone SDK version using the iphone-sdk-version parameter:
- On non-macOS: Uses bundled SDK versions for cross-compilation. Only supported versions can be used.
- On macOS: Uses installed Xcode SDK. If the specified version is not found, falls back to system default with a warning.
# Use iPhone SDK 18.2
- name: Build with iPhone SDK 18.2
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: aarch64-apple-ios
iphone-sdk-version: "18.2"
# Use iPhone SDK 17.5
- name: Build with iPhone SDK 17.5
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: |
aarch64-apple-ios
aarch64-apple-ios-sim
iphone-sdk-version: "17.5"
# Leave empty or use default (26.2)
- name: Build with default iPhone SDK
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: aarch64-apple-ios
# iphone-sdk-version not specified - uses default 26.2Supported iPhone SDK versions: 17.0, 17.2, 17.4, 17.5, 18.0, 18.1, 18.2, 18.4, 18.5, 26.0, 26.1, 26.2 (default)
You can specify a specific macOS SDK version using the macos-sdk-version parameter:
- On non-macOS: Uses bundled SDK versions for cross-compilation via osxcross. Only supported versions can be used.
- On macOS: Uses installed Xcode SDK. If the specified version is not found, falls back to system default with a warning.
# Use macOS SDK 15.2
- name: Build with macOS SDK 15.2
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: aarch64-apple-darwin
macos-sdk-version: "15.2"
# Use macOS SDK 14.0
- name: Build with macOS SDK 14.0
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: |
x86_64-apple-darwin
aarch64-apple-darwin
macos-sdk-version: "14.0"
# Leave empty or use default (26.2)
- name: Build with default macOS SDK
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: aarch64-apple-darwin
# macos-sdk-version not specified - uses default 26.2Supported macOS SDK versions (for non-macOS cross-compilation): 14.0, 14.2, 14.4, 14.5, 15.0, 15.1, 15.2, 15.4, 15.5, 26.0, 26.1, 26.2 (default)
On macOS, any SDK version installed via Xcode can be used.
You can specify a specific FreeBSD version using the freebsd-version parameter. Available versions are 13, 14, and 15:
# Use FreeBSD 15 (latest)
- name: Build with FreeBSD 15
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-freebsd
freebsd-version: "15"
# Use FreeBSD 13 (default)
- name: Build with FreeBSD 13
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: |
x86_64-unknown-freebsd
aarch64-unknown-freebsd
freebsd-version: "13"
# Leave empty for default (FreeBSD 13)
- name: Build with default FreeBSD
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-freebsd
# freebsd-version not specified - uses default 13Supported FreeBSD versions: 13 (default), 14, 15
- name: Build with custom rustflags
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-musl
rustflags: "-C opt-level=3 -C codegen-units=1"# Build with default std crates
- name: Build with build-std (default)
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-musl
build-std: true
toolchain: nightly
# Build with specific crates
- name: Build with build-std (custom crates)
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-musl
build-std: core,alloc
toolchain: nightlyjobs:
build:
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- x86_64-pc-windows-gnu
- x86_64-apple-darwin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: ${{ matrix.target }}
- name: Upload
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release/*- name: Test cross-platform
uses: zijiren233/cargo-cross@v1
with:
command: test
targets: |
x86_64-unknown-linux-musl
aarch64-unknown-linux-musl- name: Check code
uses: zijiren233/cargo-cross@v1
with:
command: check
targets: x86_64-unknown-linux-musl
all-features: true- name: Build with nightly
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-musl
toolchain: nightly- name: Build with reproducible paths
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-musl
cargo-trim-paths: all- name: Build without embedding metadata
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-musl
no-embed-metadata: true
toolchain: nightlyThe RUSTC_BOOTSTRAP environment variable tells rustc to act as if it is a nightly compiler, allowing use of #![feature(...)] attributes and -Z flags even on the stable release channel.
# Enable nightly features for all crates
- name: Build with nightly features on stable
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-musl
rustc-bootstrap: "1"
# Enable nightly features for specific crate
- name: Build with nightly features for specific crate
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-musl
rustc-bootstrap: "my_crate_name"
# Force stable behavior even on nightly
- name: Build with stable behavior on nightly
uses: zijiren233/cargo-cross@v1
with:
command: build
targets: x86_64-unknown-linux-musl
toolchain: nightly
rustc-bootstrap: "-1"This action uses the following toolchain versions from cross-make v0.7.0:
| Component | Version |
|---|---|
| GCC | 15.2.0 |
| Binutils | 2.45.1 |
| GMP | 6.3.0 |
| MPC | 1.3.1 |
| MPFR | 4.2.2 |
| ISL | 0.27 |
| Zstd | 1.5.7 |
| Platform | C Library / SDK | Version |
|---|---|---|
| Linux musl | musl | 1.2.5 |
| Linux GNU | glibc | 2.28 (default), 2.31-2.42 available |
| Linux | Linux Headers | 6.12.59 |
| Windows | MinGW-w64 | v13.0.0 |
| FreeBSD 13 | FreeBSD | 13.5 |
| FreeBSD 14 | FreeBSD | 14.3 |
| FreeBSD 15 | FreeBSD | 15.0 |
| macOS | macOS SDK | 26.2 (default), 14.0-26.2 available |
| iOS | iPhone SDK | 26.2 (default), 17.0-26.2 available |
| Android | NDK | r27d LTS (default), r29 stable available |
For GNU libc targets, use glibc-version parameter to select:
| Version | Compatible With |
|---|---|
| 2.28 | Debian 10, Ubuntu 18.04, RHEL 8 |
| 2.31 | Ubuntu 20.04, Debian 11 |
| 2.34 | RHEL 9, Ubuntu 22.04 |
| 2.35 | Ubuntu 22.04 |
| 2.36 | Debian 12 |
| 2.38 | Ubuntu 24.04 |
| 2.39-2.42 | Latest distributions |
For iOS targets, use iphone-sdk-version parameter to select the SDK version. On non-macOS hosts, only the following bundled versions are available:
| Version | Notes |
|---|---|
| 17.0 | iOS 17.0 SDK |
| 17.2 | iOS 17.2 SDK |
| 17.4 | iOS 17.4 SDK |
| 17.5 | iOS 17.5 SDK |
| 18.0 | iOS 18.0 SDK |
| 18.1 | iOS 18.1 SDK |
| 18.2 | iOS 18.2 SDK |
| 18.4 | iOS 18.4 SDK |
| 18.5 | iOS 18.5 SDK |
| 26.0 | iOS 26.0 SDK |
| 26.1 | iOS 26.1 SDK |
| 26.2 | iOS 26.2 SDK (default) |
On macOS, any SDK version installed via Xcode can be used. If the specified version is not found, the system default SDK will be used with a warning.
For macOS (Darwin) targets, use macos-sdk-version parameter to select the SDK version. On non-macOS hosts, only the following bundled versions are available:
| Version | Notes |
|---|---|
| 14.0 | macOS 14.0 (Sonoma) SDK |
| 14.2 | macOS 14.2 SDK |
| 14.4 | macOS 14.4 SDK |
| 14.5 | macOS 14.5 SDK |
| 15.0 | macOS 15.0 (Sequoia) SDK |
| 15.1 | macOS 15.1 SDK |
| 15.2 | macOS 15.2 SDK |
| 15.4 | macOS 15.4 SDK |
| 15.5 | macOS 15.5 SDK |
| 26.0 | macOS 26.0 SDK |
| 26.1 | macOS 26.1 SDK |
| 26.2 | macOS 26.2 SDK (default) |
On macOS, any SDK version installed via Xcode can be used.
For FreeBSD targets, use freebsd-version parameter to select the FreeBSD version:
| Version | Notes |
|---|---|
| 13 | FreeBSD 13.5 (default) |
| 14 | FreeBSD 14.3 |
| 15 | FreeBSD 15.0 |
- Command Detection: The action detects the requested command (build, test, or check)
- Target Detection: The action detects the requested target platforms
- Toolchain Setup: Automatically downloads and configures the necessary cross-compilation toolchains
- Environment Configuration: Sets up the correct environment variables for cross-compilation
- Command Execution: Runs the specified cargo command with the appropriate flags and configuration
- Artifact Output: Built binaries and libraries are placed in
target/{target}/{profile}/directories following Cargo's standard structure
Make sure you're running on a supported host OS. Linux hosts support the most targets. For macOS and Windows targets, you may need to run on the respective OS runners.
Use profile: release and ensure stripping is enabled (default). Note that:
- musl targets usually produce statically linked binaries by default (varies by target), which are larger but completely self-contained
- GNU targets produce dynamically linked binaries by default, which are smaller but require system libraries
- You can explicitly configure the linking behavior using the
crt-staticparameter
Ensure you have enough disk space for the Android NDK download. You can also try a different NDK version with the ndk-version input.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
This action uses cross-compilation toolchains from:
- cross-make for Linux/Windows/Freebsd targets
- osxcross for macOS targets
- cctools-port for ios targets
- Android NDK for Android targets