When cross-compiling for ARM64 Linux fails in CI/CD due to C++ dependencies (ring crate, llama-cpp), use Docker with QEMU emulation as a reliable alternative.
- Docker Desktop with QEMU emulation support
- Windows, macOS, or Linux host system
docker run --rm --platform linux/arm64 \
-v "C:\Users\micha\repos\shimmy:/workspace" \
rust:1.89 \
bash -c "cd /workspace && cargo build --release --target aarch64-unknown-linux-gnu --no-default-features --features huggingface"- Path Format: Use Windows-style paths with quotes for Docker volume mounts
- Platform:
--platform linux/arm64enables QEMU emulation for ARM64 - Features: Use
--no-default-features --features huggingfaceto avoid C++ cross-compilation issues - Performance: Slower than native builds due to QEMU emulation, but reliable compilation
- Output: Binary will be in
target/aarch64-unknown-linux-gnu/release/shimmy
If you encounter path issues:
- Ensure proper quote usage around Windows paths
- Use forward slashes in the container path (
:workspace) - Verify Docker Desktop is running with QEMU support enabled
For CI/CD environments where Docker with QEMU is not available, consider temporarily excluding ARM64 from release builds until dedicated ARM64 runners are available.