xcargo π―
Cross-compilation, zero friction
xcargo is a Rust cross-compilation tool that simplifies building for multiple targets. Automatic toolchain management, intelligent container usage, and zero-configuration cross-compilation.
π― What is xcargo?
Cross-compilation in Rust shouldn't be painful. xcargo automates the entire process:
- Detects what you need automatically
- Installs toolchains and dependencies
- Builds for any target with one command
- Uses containers only when necessary (includes embedded runtime)
β¨ Features (Planned)
- π― Zero Configuration - Works out of the box for most targets
- π§ Auto-Detection - Figures out what toolchains you need
- π³ Smart Containers - Uses native builds when possible, containers when needed
- β‘ Fast - Parallel builds, intelligent caching
- π Many Targets - Linux, Windows, macOS, mobile, embedded
- π€ CI/CD Ready - Perfect for GitHub Actions, GitLab CI
- π¦ Embedded Runtime - No Docker Desktop required (uses youki)
π§ Status
Work in Progress - Early development
Current version: 0.1.0-alpha
π Quick Example (Planned API)
# Initialize cross-compilation for your project
# Add target platforms
# Check what's needed
# β
windows-x86_64: Ready
# β linux-arm64: Missing linker (install: apt install gcc-aarch64-linux-gnu)
# β οΈ macos-aarch64: Requires macOS host for native compilation
# Build for all configured targets
# Build for specific target
# Or use as cargo wrapper
π¦ Installation
# Not yet published - coming soon!
# Or build from source:
πΊοΈ Roadmap
Phase 1: Core (Current)
- Target detection and validation
- Toolchain management
- Basic native cross-compilation
- Configuration system
Phase 2: Containers
- Embedded container runtime (youki)
- Docker/Podman fallback
- Image caching
- Native-first strategy
Phase 3: Advanced
- Build profiles (release-all, embedded, mobile)
- Parallel builds
- Dependency management (OpenSSL, SQLite, etc.)
- Custom target definitions
Phase 4: Integration
- GitHub Actions integration
- GitLab CI templates
- Pre-built binaries distribution
- GUI/TUI interface
π― Supported Targets
See TARGETS.md for the complete list.
Tier 1 (Native builds):
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- x86_64-pc-windows-gnu
- x86_64-apple-darwin
- aarch64-apple-darwin
Tier 2 (Container builds):
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- x86_64-pc-windows-msvc
- wasm32-unknown-unknown
Tier 3 (Specialized):
- Mobile (Android, iOS)
- Embedded (ARM Cortex-M)
π οΈ How It Works
βββββββββββββββββββββββββββββββββββ
β xcargo build --target windows β
ββββββββββββββ¬βββββββββββββββββββββ
β
βΌ
βββββββββββββββββ
β Can compile β
β natively? β
βββββ¬ββββββββ¬ββββ
β β
YESβ βNO
β β
βΌ βΌ
ββββββββββ ββββββββββββββββββββ
β Native β β Need container? β
β build β β Check deps... β
ββββββββββ ββββββ¬ββββββββββββββ
β
βΌ
βββββββββββββββββ
β Use youki β
β (embedded) β
βββββββββββββββββ
π Usage Examples
Basic Cross-Compilation
# Build for Windows from Linux
# Build for Linux ARM
# Build for all targets
Configuration File
# xcargo.toml
[]
= ["x86_64-unknown-linux-gnu", "x86_64-pc-windows-gnu"]
[]
= [
"x86_64-unknown-linux-gnu",
"x86_64-pc-windows-gnu",
"x86_64-apple-darwin",
]
[]
= true
= true
[]
= "auto" # auto, youki, docker, podman
= "target.os != host.os"
CI/CD Integration
# .github/workflows/build.yml
name: Cross-Platform Build
on:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install xcargo
run: cargo install xcargo
- name: Build all targets
run: xcargo build --all
- name: Upload artifacts
run: xcargo release --upload
π¨ Design Goals
Make cross-compilation boring (in a good way):
- β Just Worksβ’ - Sensible defaults for everything
- β Fast - Native when possible, containerized when needed
- β Smart - Detects and suggests solutions automatically
- β Transparent - Shows exactly what it's doing
- β Flexible - Override any behavior when needed
π Comparison
| Feature | xcargo | cross | cargo-zigbuild | Manual |
|---|---|---|---|---|
| Native builds | β First | β | β οΈ Via Zig | β |
| Container fallback | β | β | β | β |
| No Docker required | β youki | β | β | β |
| Auto-setup | β | β | β οΈ | β |
| Native deps | β Planned | β οΈ | β | β οΈ |
| CI/CD templates | β Planned | β οΈ | β | β |
π€ Contributing
Contributions welcome! This project is in early stages.
How to help:
- π Report issues or suggest features
- π» Submit PRs for bug fixes or features
- π Improve documentation
- π― Test on different platforms
- π§ Add support for new targets
π License
π Acknowledgments
Inspired by:
- cross - Container-based cross-compilation
- cargo-zigbuild - Zig linker approach
- xwin - Windows SDK management
- youki - Container runtime in Rust
xcargo - Cross-compilation, zero friction π―
Status: π§ Pre-alpha - Architecture planning
Star β this repo to follow development!