
Cross Gcc
This walks you through cross-compiling with GCC for embedded and multi-architecture targets. You get practical guidance on toolchain setup, triplets (aarch64-linux-gnu, arm-none-eabi, etc.), configuring sysroots, and fixing pkg-config so it stops returning host libraries during cross builds. It covers CMake toolchain files, QEMU-based testing with GDB remote debugging, and common failure modes like wrong ELF class errors. The reference tables for triplets and error messages are genuinely helpful when you're staring at a linker error at 2am. If you're building for ARM, RISC-V, or MIPS from an x86 host, or integrating with Yocto and Buildroot, this gives you the essentials without the usual cross-compilation folklore.
- skills.sh installs
- 742
- GitHub stars
- 279
- last updated
- Aug 21, 2026
Install
$ npx -y skills add mohitmishra786/low-level-dev-skills --skill cross-gcc --agent claude-codeInstalls into .claude/skills of the current project.
Files
Cross-GCC
Purpose
Guide agents through setting up and using cross-compilation GCC toolchains: triplets, sysroots, pkg-config, QEMU-based testing, and common failure modes.
Triggers
- "How do I compile for ARM on my x86 machine?"
- "I'm getting 'wrong ELF class' or 'cannot execute binary file'"
- "How do I set up a sysroot for cross-compilation?"
- "pkg-config returns host libraries in my cross build"
- "How do I debug a cross-compiled binary with QEMU + GDB?"
Workflow
1. Understand the triplet
A GNU triplet has the form <arch>-<vendor>-<os>-<abi> (often 3 or 4 parts):
| Triplet | Target |
|---|---|
aarch64-linux-gnu | 64-bit ARM Linux (glibc) |
arm-linux-gnueabihf | 32-bit ARM Linux hard-float |
arm-none-eabi | Bare-metal ARM (no OS) |
riscv64-linux-gnu | 64-bit RISC-V Linux |
x86_64-w64-mingw32 | Windows (MinGW) from Linux |
mipsel-linux-gnu | Little-endian MIPS Linux |
2. Install the toolchain
# Debian/Ubuntu
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
# For bare-metal ARM (Cortex-M)
sudo apt install gcc-arm-none-eabi binutils-arm-none-eabi
Sponsors
Details
- Repository
- github.com/mohitmishra786/low-level-dev-skills
- Categories
- Code Review & Quality, Debugging
- First seen
- Jun 3, 2026
More from mohitmishra786/low-level-dev-skills
All 54- Gcc741
- Valgrind740
- Flamegraphs728
- Assembly X86724
- Strace Ltrace711
- Cpu Cache Opt709
- Assembly Arm707
- Lldb703
- Elf Inspection702
- Simd Intrinsics701
- Make697
- Memory Model693
- Freertos691
- Linux Kernel Modules689
- Ninja681
- Heaptrack676
- Rust Profiling673
- Ebpf672
- Msvc Cl671
- Fuzzing670
- Binutils665
- Linkers Lto663
- Conan Vcpkg659
- Dynamic Linking650