fuyu12345/terminalgen-skills/cross-compile-arm-toolchain-hard

Claude Code and agent skill by fuyu12345/terminalgen-skills

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Build a statically linked ARM64 executable from C sources using a cross-toolchain and emit a verifier-friendly result file. Use when deploying x86-developed C tools to aarch64 targets with minimal runtime libraries.

Install

npx vskill@latest install fuyu12345/terminalgen-skills/cross-compile-arm-toolchain-hard

SKILL.md

The same SKILL.md was published earlier as fuyu12345/terminalgen-skills/cross-compile-arm-toolchain-hard.

Cross-Compiling Static ARM64 C Binaries

When to Use

  • Cross-compiling a C CLI tool on x86_64 for ARM64/aarch64 devices.
  • Producing a fully static binary (-static) for minimal target environments.
  • Completing tasks that require a result.txt containing absolute binary path metadata.

Minimal Reliable Workflow

  1. Inspect project build inputs.
  • Run: ls -la /path/to/project && sed -n '1,200p' Makefile
  • Identify whether the build rule uses $(CC) $(CFLAGS) only, or also $(LDFLAGS).
  1. Clean and cross-compile with explicit static flags.
  • Prefer build-system override first:
  • make clean || true
  • make CC=aarch64-linux-gnu-gcc CFLAGS='-O2 -static'
  • If Makefile supports target override, set a distinct output name:
  • make CC=aarch64-linux-gnu-gcc CFLAGS='-O2 -static' TARGET=mytool-arm64
  • If no usable build system exists, compile directly:
  • aarch64-linux-gnu-gcc -O2 -static -o mytool-arm64 *.c
  1. Resolve absolute path and enforce execute bit.
  • chmod +x "$BIN"
  • ABS_BIN="$(readlink -f "$BIN")"
  1. Verify architecture.
  • file "$ABS_BIN" must include ELF 64-bit and ARM aarch64/AArch64.
  1. Verify static linkage with multiple checks.
  • file "$ABS_BIN" should include statically linked.
  • readelf -l "$ABS_BIN" | grep INTERP should return nothing.
  • ldd "$ABS_BIN" 2>&1 should mention not a dynamic executable or statically linked.
  1. Write required output file exactly.
  • ```bash

printf 'binary_path=%s\nstatic_linked=yes\n' "$ABS_BIN" > /workspace/result.txt ```

  1. Re-open and sanity-check format.
  • cat /workspace/result.txt
  • Confirm exactly two lines, correct key names, absolute path.

Common Pitfalls

  • Relying on `LDFLAGS=-static` when the Makefile never uses `$(LDFLAGS)`.

In observed runs, the Makefile link rule used $(CC) $(CFLAGS) -o ..., so static linking only applied when -static was placed in CFLAGS.

  • Using only one static-link verification signal.

file may say “statically linked,” but robust validation should also confirm no INTERP segment via readelf.

  • Misreading `ldd` in cross-arch contexts.

For ARM64 binaries checked on x86 hosts, ldd diagnostics can appear on stderr; some test harnesses incorrectly inspect only stdout, causing false failures even when binary is truly static.

  • Formatting drift in `result.txt`.

Extra spaces, wrong key names, relative paths, or extra lines can fail strict parsers.

Verification Strategy

Run this exact sequence before finalizing:

bash
BIN="/absolute/path/to/binary"
file "$BIN"
readelf -h "$BIN" | grep -E 'Class:|Machine:|Type:'
readelf -l "$BIN" | grep -E 'INTERP|Requesting program interpreter' || true
ldd "$BIN" 2>&1
test -x "$BIN" && echo "executable=yes"
cat /workspace/result.txt

Expected outcomes:

  • file: ARM64 ELF executable, statically linked.
  • readelf -h: Machine: AArch64, Type: EXEC (or valid executable type).
  • readelf -l: no interpreter line.
  • ldd 2>&1: contains static/non-dynamic message.
  • result.txt: exactly:
  • binary_path=/absolute/path/to/binary
  • static_linked=yes

If harness still fails only the static-link test while all above pass, treat it as a harness stream-capture issue (stdout vs stderr), not a build issue.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/fuyu12345/terminalgen-skills/cross-compile-arm-toolchain-hard/badge)](https://verified-skill.com/skills/fuyu12345/terminalgen-skills/cross-compile-arm-toolchain-hard)

Something wrong with this skill or its page? Tell us.