What problem does it solve?
This Skill helps developers and build engineers cross-compile software with GCC by explaining triplets, installing and selecting appropriate cross-compilers, configuring sysroots and pkg-config for target libraries, and validating or debugging cross-compiled binaries under QEMU so builds work reliably across host and target architectures.
Core Features & Use Cases
- Triplet and toolchain guidance: identify and choose triplets like aarch64-linux-gnu, arm-none-eabi, riscv64-linux-gnu and install matching gcc/g++ and binutils packages.
- Sysroot and pkg-config configuration: create or use a sysroot, set PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_LIBDIR, and avoid linking against host libraries.
- CMake and build integration: provide a minimal CMake toolchain file pattern and flags to find target includes and libraries.
- Testing and debugging: run user-mode QEMU for quick execution, set up binfmt_misc for transparency, and perform remote GDB debugging with qemu -g and target remote.
- Troubleshooting: diagnose common errors such as wrong ELF class, missing -lfoo during link, ABI runtime issues, and relocation or opcode mismatches.
Quick Start
Use the cross-gcc skill to set up an aarch64-linux-gnu toolchain, point CMAKE_SYSROOT or --sysroot to a target sysroot, build a simple hello program with aarch64-linux-gnu-gcc, and run it under qemu-aarch64-static to verify execution.