cpp-cross-compilation

Configure cross-compilation toolchains for C and C++ embedded builds.

1|Updated Feb 28, 2026
One-click install
npx skills add https://github.com/Binh230199/ai --skill cpp-cross-compilation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-cross-compilation
Source: https://github.com/Binh230199/ai/tree/main/.github/skills/cpp-cross-compilation
Command: npx skills add https://github.com/Binh230199/ai --skill cpp-cross-compilation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It removes the friction and guesswork from building C and C++ binaries for embedded targets from a desktop host, helping you avoid host library leakage, wrong-architecture outputs, and broken runtime packaging.

Core Features & Use Cases

It covers cross-toolchain selection, CMake toolchain file setup, sysroot configuration, pkg-config isolation, Android NDK integration, QNX build setup, and common debugging checks for architecture, GLIBC compatibility, and RPATH. Use it when you need to audit a build system, bring up a new target toolchain, diagnose a binary that compiles but fails on-device, or wire cross-compilation into CI/CD for ARM Linux, AArch64, QNX, or Android.

Quick Start

Use the cpp-cross-compilation skill to set up the appropriate cross-toolchain for your target, configure the CMake sysroot and pkg-config path correctly, and then verify the produced binary on the target architecture before deployment.

Frequently Asked Questions about cpp-cross-compilation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up CMake toolchain files for C++ cross-compilation?

CMake cross-compilation requires a toolchain file defining the target compiler, sysroot location, and pkg-config isolation. This configuration prevents host library leakage and ensures generated build files target the correct embedded architecture like ARM Linux or AArch64.

Why does my cross-compiled binary fail to run on the target device?

Cross-compiled binaries fail on-device due to host library contamination, wrong architecture outputs, or GLIBC version mismatches. You must verify the binary architecture, check RPATH settings, and ensure the sysroot matches the target runtime environment.

How do I isolate pkg-config when cross-compiling for embedded targets?

To isolate pkg-config during cross-compilation, set PKG_CONFIG_LIBDIR and PKG_CONFIG_SYSROOT_DIR to point exclusively at the target sysroot. This prevents discovering host libraries and ensures dependency detection targets the embedded architecture correctly.

Does this approach support Android NDK and QNX build workflows?

Yes, cross-compilation setup supports AArch64 Android NDK and QNX workflows alongside ARM Linux targets. It handles toolchain selection, sysroot configuration, and CI integration for these platforms while preventing host contamination across different embedded environments.

What is the best way to integrate C++ cross-compilation into CI/CD pipelines?

The best way to integrate C++ cross-compilation into CI/CD is by using dedicated CMake toolchain files, enforcing sysroot path restrictions, and adding automated binary verification steps. This validates architecture compatibility and prevents runtime mismatches before deployment to embedded targets.