🔄 Implement Comprehensive Cross-Compilation Setup
Overview
Set up robust cross-compilation infrastructure to build VanitySSH for all target platforms from any host, with static linking and platform-specific optimizations.
Tasks
1. Cross-Compilation Infrastructure
2. Target Platform Configuration
3. Static Linking Setup
4. Build Optimization
Acceptance Criteria
Implementation Details
Cross.toml Configuration
[build]
default-target = "x86_64-unknown-linux-gnu"
[target.x86_64-unknown-linux-musl]
image = "ghcr.io/cross-rs/x86_64-unknown-linux-musl:edge"
[target.aarch64-unknown-linux-gnu]
image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:edge"
[target.x86_64-pc-windows-gnu]
image = "ghcr.io/cross-rs/x86_64-pc-windows-gnu:edge"
[target.aarch64-pc-windows-msvc]
image = "ghcr.io/cross-rs/aarch64-pc-windows-msvc:edge"
Target Installation
# Install all required targets
rustup target add x86_64-unknown-linux-gnu
rustup target add x86_64-unknown-linux-musl
rustup target add aarch64-unknown-linux-gnu
rustup target add x86_64-pc-windows-gnu
rustup target add x86_64-pc-windows-msvc
rustup target add aarch64-pc-windows-msvc
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
CI Matrix Configuration
strategy:
matrix:
include:
# Linux targets
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
use-cross: false
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
use-cross: true
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
use-cross: true
# Windows targets
- target: x86_64-pc-windows-msvc
os: windows-latest
use-cross: false
- target: x86_64-pc-windows-gnu
os: ubuntu-latest
use-cross: true
- target: aarch64-pc-windows-msvc
os: windows-latest
use-cross: true
# macOS targets
- target: x86_64-apple-darwin
os: macos-latest
use-cross: false
- target: aarch64-apple-darwin
os: macos-latest
use-cross: false
Build Script
#!/bin/bash
set -euo pipefail
TARGET=${1:-x86_64-unknown-linux-gnu}
USE_CROSS=${2:-false}
if [ "$USE_CROSS" = "true" ]; then
cross build --release --target "$TARGET"
else
cargo build --release --target "$TARGET"
fi
# Strip debug symbols
strip "target/$TARGET/release/vanityssh-rust" 2>/dev/null || true
# Verify binary
file "target/$TARGET/release/vanityssh-rust"
ls -lah "target/$TARGET/release/vanityssh-rust"
Target Platform Details
Linux MUSL (Static)
[target.x86_64-unknown-linux-musl]
linker = "x86_64-linux-musl-gcc"
rustflags = ["-C", "target-feature=+crt-static"]
Windows Static
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
Platform-Specific Optimizations
# Intel/AMD optimizations
[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "target-cpu=x86-64-v2"]
# ARM64 optimizations
[target.aarch64-unknown-linux-gnu]
rustflags = ["-C", "target-cpu=cortex-a72"]
# Apple Silicon optimizations
[target.aarch64-apple-darwin]
rustflags = ["-C", "target-cpu=apple-m1"]
Testing Strategy
1. Build Verification
2. Portability Testing
3. Performance Validation
Binary Size Optimization
[profile.release]
opt-level = "z" # Optimize for size
lto = true # Link-time optimization
codegen-units = 1 # Single codegen unit
panic = "abort" # Smaller binaries
strip = true # Remove debug symbols
Platform Matrix Summary
| Platform |
Architecture |
Static |
Priority |
| Linux GNU |
x86_64 |
No |
High |
| Linux MUSL |
x86_64 |
Yes |
High |
| Linux |
ARM64 |
Yes |
Medium |
| Windows MSVC |
x86_64 |
Yes |
High |
| Windows GNU |
x86_64 |
Yes |
Medium |
| Windows |
ARM64 |
Yes |
Low |
| macOS |
x86_64 |
No |
High |
| macOS |
ARM64 |
No |
High |
Timeline
Estimate: 4-5 days
Priority: High
Phase: 2
Labels
enhancement, ci/cd, phase-2, priority-high, cross-compilation, architecture
Dependencies
- Phase 1 completion (CI optimization)
- ARM64 macOS support implementation
- Docker/containerization support in CI
Part of Phase 2: Multi-Architecture Support - Foundation for multi-platform distribution
🔄 Implement Comprehensive Cross-Compilation Setup
Overview
Set up robust cross-compilation infrastructure to build VanitySSH for all target platforms from any host, with static linking and platform-specific optimizations.
Tasks
1. Cross-Compilation Infrastructure
crosstool for containerized cross-compilation2. Target Platform Configuration
3. Static Linking Setup
4. Build Optimization
Acceptance Criteria
Implementation Details
Cross.toml Configuration
Target Installation
# Install all required targets rustup target add x86_64-unknown-linux-gnu rustup target add x86_64-unknown-linux-musl rustup target add aarch64-unknown-linux-gnu rustup target add x86_64-pc-windows-gnu rustup target add x86_64-pc-windows-msvc rustup target add aarch64-pc-windows-msvc rustup target add x86_64-apple-darwin rustup target add aarch64-apple-darwinCI Matrix Configuration
Build Script
Target Platform Details
Linux MUSL (Static)
Windows Static
Platform-Specific Optimizations
Testing Strategy
1. Build Verification
2. Portability Testing
3. Performance Validation
Binary Size Optimization
Platform Matrix Summary
Timeline
Estimate: 4-5 days
Priority: High
Phase: 2
Labels
enhancement,ci/cd,phase-2,priority-high,cross-compilation,architectureDependencies
Part of Phase 2: Multi-Architecture Support - Foundation for multi-platform distribution