Cross-Compilation

Noun · Development

Definitions

  1. Cross-Compilation is the process of building executable code on one platform (the host) that is intended to run on a different platform (the target), where the host and target differ in CPU architecture, operating system, or both. A cross-compiler runs on the host machine but generates machine code for the target. This is essential when the target platform cannot run a compiler itself (embedded systems with limited resources), when building for multiple architectures from a single development machine (compiling ARM binaries on an x86 desktop), or when the target operating system is different (building Linux binaries on macOS). Cross-compilation is the standard workflow in embedded development, mobile app development (building iOS apps on macOS for ARM devices), and systems programming. Toolchains like GCC, LLVM/Clang, and the Rust compiler have robust cross-compilation support. Challenges include managing different system libraries, header files, and linker settings for the target platform. Docker and QEMU can simplify cross-compilation by emulating target environments on the host machine.

    In plain English: Building a program on your computer that is meant to run on a completely different type of device, like compiling on a Mac for a Linux server.

Etymology

1970s
Early Unix portability efforts required compiling code on one architecture to run on another. Cross-compilers emerged as minicomputers diversified hardware platforms.
1983
The GNU project prioritized cross-compilation support in GCC, establishing the 'build/host/target' triple convention that is still used today.
1990s
Embedded systems development made cross-compilation essential. Developers compiled on powerful workstations to target resource-constrained microcontrollers and embedded processors.
2010s-Present
Cross-compilation became routine for mobile (Android NDK, iOS toolchains), WebAssembly, and multi-architecture container images. Languages like Go and Rust simplified cross-compilation with built-in target support.

Related Terms