Cross-compiling builds executable binaries on a build host (e.g. x86_64 workstation) designed to run on a different target CPU architecture (e.g. ARMv7 / AArch64 embedded board).

Cross-Compilation Commands

Terminal Commandsbash
# 1. Install ARM cross-compiler toolchain
sudo apt install gcc-arm-linux-gnueabihf
 
# 2. Compile C file using ARM cross-compiler
arm-linux-gnueabihf-gcc -o myapp_arm main.c
 
# 3. Verify target architecture using file command
file myapp_arm
# Output: ELF 32-bit LSB executable, ARM, EABI5 version 1...