Use when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Not for the Rust FFI binding layer: use rust-ffi.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Use when compiling for ARM, AArch64, RISC-V, or MIPS from x86-64 with a GCC cross toolchain: triplets, sysroots, pkg-config, CMake toolchain files, QEMU. Not for Zig: use zig-cross.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
설치 방법 보기설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.
| Field | Bound contract |
|---|---|
| Trigger | The user needs to build for a different architecture with a <triplet>-gcc toolchain, gets Exec format error or wrong ELF class, finds host libraries leaking into a cross link, or wants to run and debug a cross-built binary under QEMU. |
| Authority | Read-only. The skill emits install commands, compiler invocations, environment settings, and a toolchain file to chat; the user runs them. Rollback is not needed. No remote mutation. |
| Side effect | Chat output. Confirmation compiles run on scratch files. |
| Done | The triplet, toolchain, sysroot, and build-system wiring are stated for the target, every flag is confirmed against the GCC target-options documentation or the installed cross compiler, and each error in the request has a cause and fix. |
<triplet>-gcc --version: required. Current stable is GCC 16.2; distribution cross packages often lag.Choose the triplet <arch>-<vendor>-<os>-<abi>, three or four parts. Common values: aarch64-linux-gnu (64-bit ARM, glibc), arm-linux-gnueabihf (32-bit ARM, hard float), arm-none-eabi (bare-metal ARM), riscv64-linux-gnu, mipsel-linux-gnu, x86_64-w64-mingw32 (Windows from Linux). Done when: one triplet is chosen.
Install and confirm the toolchain. Debian and Ubuntu: apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu; bare-metal ARM: apt install gcc-arm-none-eabi. Confirm with aarch64-linux-gnu-gcc --version. Done when: the compiler prints its version.
Compile. Hosted: aarch64-linux-gnu-gcc -O2 -o hello hello.c, aarch64-linux-gnu-g++ -O2 -std=c++20 -o hello hello.cpp. Bare-metal Cortex-M4: arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -ffreestanding -nostdlib -nostartfiles -T linker.ld -o firmware.elf startup.s main.c. Target flags from the reference: -march, -mcpu, -mthumb, -mfloat-abi=soft|softfp|hard, -mfpu, and for AArch64 -moutline-atomics; RISC-V uses -march=rv64gc -mabi=lp64d style ISA strings. Done when: the compile command names the CPU and ABI.
Add a sysroot when the program links target libraries: --sysroot=/path/to/sysroot on every compile and link. Sources: a vendor image, debootstrap --arch arm64 <suite> <dir> for Debian, or the Yocto or Buildroot output tree. Confirm with aarch64-linux-gnu-gcc --sysroot=<dir> -v -E - < /dev/null 2>&1 | grep sysroot. Done when: the sysroot path appears in the compiler's verbose output.
Redirect pkg-config, which returns host paths by default: export PKG_CONFIG_SYSROOT_DIR=<sysroot>, export PKG_CONFIG_LIBDIR=$PKG_CONFIG_SYSROOT_DIR/usr/lib/aarch64-linux-gnu/pkgconfig:$PKG_CONFIG_SYSROOT_DIR/usr/share/pkgconfig, export PKG_CONFIG_PATH=. Check with pkg-config --libs <lib>. Done when: the printed paths are under the sysroot.
Wire the build system. Environment for Make and autoconf: CC, CXX, AR, STRIP, OBJDUMP set to the triplet-prefixed tools, and ./configure --host=aarch64-linux-gnu. CMake toolchain file:
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
set(CMAKE_SYSROOT /path/to/sysroot)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Configure with cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=aarch64.cmake. Done when: the build system resolves the cross compiler and searches only the sysroot for libraries.
Run under QEMU user mode: apt install qemu-user-static, then qemu-aarch64-static ./hello; with binfmt_misc registered the binary runs directly. Debug: qemu-aarch64-static -g 1234 ./hello & then aarch64-linux-gnu-gdb -ex "target remote :1234" ./hello. Done when: the binary runs or the debugger attaches.
Map errors from the table. Done when: each reported error has a cause and fix.
| Error | Cause | Fix |
|---|---|---|
cannot execute binary file: Exec format error | Target binary run on the host | Run under qemu-<arch>-static |
wrong ELF class: ELFCLASS64 (or 32) | Object from another architecture in the link | One toolchain for every object; check AR and CC |
ld: cannot find -lfoo | Host library path used in a cross link | Set --sysroot; fix PKG_CONFIG_LIBDIR |
undefined reference to '__aeabi_*' | ARM runtime helpers missing from a -nostdlib link | Add -lgcc |
relocation ... out of range | Code or data too far apart for the relocation | -mcmodel=large or restructure |
unrecognized opcode | -mcpu or -march does not match the source | Set the CPU flags for the real target |
| Failure class | Behavior |
|---|---|
| No distribution package for the target | Point to the vendor toolchain download; do not invent a package name. |
| Sysroot lacks a needed library | Report the library as missing from the sysroot; the fix is to install it into the sysroot, not to use the host copy. |
| Windows target requested | Use the x86_64-w64-mingw32 triplet; MSVC-flavored builds: use msvc-cl. |
| No system cross toolchain wanted | zig cc -target cross-compiles C without one: use zig-cross. |
| Assembly-level question | AArch64 or ARM assembly: use assembly-arm. |
A chat report with the triplet, install and confirmation commands, the compile command with target flags, sysroot and pkg-config settings when needed, the build-system wiring, the QEMU run or debug command, and the error table entries that apply. Flag details are in references/arm-flags.md.
아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.
로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.
아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.
Use when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Not for the Rust FFI binding layer: use rust-ffi.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Use when configuring ADC sampling time, DMA-driven ADC, calibration, or DAC channel setup on bare-metal MCUs. Not for the DMA stream itself: use dma-baremetal.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Use when creating AF_XDP sockets, configuring UMEM and XSK rings, writing an XDP redirect program, or choosing copy versus zero-copy mode. Not for full kernel bypass: use dpdk.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Use when a completed session needs an agent-environment retrospective. Not for an engineering retrospective from telemetry: use engineering-retrospective.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Use when a redacted, trimmed agent transcript must be appended to a GitHub PR or issue body, with human approval and preview. Not for automated or model-initiated insertion.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Use when a repo needs agent setup, AGENTS.md added or made lean, CLAUDE.md audited, or agent instructions scored or pruned. Not for remote, credential, publish, deploy, or irreversible changes.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.