Cross-compilation
交叉编译AdvancedCompiling on an x86 computer a program meant to run on a robot's ARM-based onboard controller.
Cross-compilation means building, on one machine (the host), an executable meant to run on a different CPU architecture or operating system. In robotics this is a very practical need: the onboard controller is often an ARM board like a Jetson, Raspberry Pi, or Rockchip device, with limited compute and memory, and compiling a large project directly on it — a ROS 2 workspace, OpenCV, an inference engine — can take forever or fail to complete at all, while the development machine is x86. The approach is to install a toolchain for the target architecture (e.g. aarch64-linux-gnu-gcc) plus the target system's headers and libraries, and configure a CMake toolchain file accordingly; Docker combined with QEMU emulation of the target architecture is also common, as a way to sidestep environment mismatches.
ExampleCompile ROS 2 nodes and an inference program on an x86 workstation using an aarch64 toolchain, then copy them onto a Jetson Orin to run directly.
- Also called
- cross-building
- Related
- Embedded Software Development · CMake · NVIDIA Jetson · Docker · On-Device / Edge Deployment · Firmware
- Sources
- Cross compiler - Wikipedia
cmake-toolchains(7) - CMake Documentation