/xmake-skills:xmake-zigccfrom xmake-skills
Configures Xmake to compile C/C++ with zig cc/c++ and cross-compile via zig, plus the zig toolchain for Zig code. Covers --toolchain=zigcc, -target tuples, and --cross.
Ships in xmake-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Xmake has two zig toolchains and they are not interchangeable:
| Toolchain | For | Toolset |
|---|---|---|
zig | Zig source code (.zig) | zig build-exe, zig build-lib … |
zigcc | C/C++ source code | zig cc, zig c++, plus ar/ranlib/objcopy/lld |
xmake f --toolchain=zigcc -c
xmake
zigcc wires up the whole toolset, so static and shared libraries build too. Point at a
specific zig with --zc:
xmake f --toolchain=zigcc --zc=/opt/zig/zig -c
::: warning
Do not hand-set the tools with --cc="zig cc" --cxx="zig c++" --ld="zig c++". That patches
three tools only: no ar/ranlib, and none of the -target handling below.
:::
zig cc is a cross compiler — it ships its own libc and headers, so no sysroot, no
cross-gcc, no --sdk. All xmake has to do is pass the right -target <tuple>.
For the platforms xmake knows, the tuple comes from -p + -a:
xmake f -p linux -a arm64 --toolchain=zigcc -c
xmake f -p macosx -a arm64 --toolchain=zigcc -c
xmake f -p windows -a x86_64 --toolchain=zigcc -c
xmake f -p mingw -a x86_64 --toolchain=zigcc -c
xmake
| Platform | Tuple xmake passes |
|---|---|
linux | <arch>-linux-gnu (arm-linux-gnueabi, mips64-linux-gnuabi64) |
macosx | <arch>-macos-none |
windows | <arch>-windows-msvc |
mingw | <arch>-windows-gnu |
Arch names are translated too: arm64 → aarch64, arm → arm, ppc64 → powerpc64,
loong64 → loongarch64, and i386 → x86 on zig >= 0.11.
For anything else, give the tuple yourself with --cross, it is passed through as-is:
xmake f -p cross --cross=riscv64-linux-musl --toolchain=zigcc
xmake f -p freebsd --cross=x86_64-freebsd --toolchain=zigcc
xmake f -p linux --cross=x86_64-linux-musl --toolchain=zigcc # musl instead of gnu
xmake
::: warning
A platform outside the table above (e.g. freebsd) has no tuple of its own. Without
--cross no -target is passed at all, and xmake falls back to looking for a native
toolchain of that platform — the symptom is error: toolchain not found!.
:::
Pin a libc version when you need to run on older systems:
xmake f -p linux --cross=x86_64-linux-gnu.2.17 --toolchain=zigcc
xmake f --toolchain=zig -c # explicit, it is auto-detected for .zig projects
xmake f --toolchain=zig --zc=/opt/zig/zig -c
xmake f --toolchain=zig -a arm64 -c
xmake f -p cross --cross=riscv64-linux-musl --toolchain=zig
target("hello")
set_kind("binary")
add_files("src/*.zig")
Zig can also consume C sources in the same target (C interop), and C targets can link zig static libraries.
--toolchain=zig for .zig files, --toolchain=zigcc for C/C++ — mixing them up is the
most common mistake.-macos-none: linking against system frameworks still needs the real
SDK, so cross-compiling to macOS is limited.x86_64-linux-gnu, not
x86_64-unknown-linux-gnu.zig targets when a tuple is rejected.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub xmake-io/xmake-skills --plugin xmake-skills58 skills in this plugin
/xmake-addon-developmentUse when writing an Xmake addon — the `addon.lua` manifest, the payload layout (plugins/rules/toolchains/modules/includes/templates), `@self` references, shipping package definitions with an addon, `add_globalmodules`, testing it locally, and publishing it to xmake-repo as an `addon` kind package./xmake-addonsUse when installing or using an Xmake addon — `xmake addon --install/--list/--remove/--upgrade/--search`, declaring `add_addons(...)` in a project, and referencing addon payloads with `@addon/<name>/<rule>`, `@addon.<name>.<module>` or `@self`. For writing and publishing one, see xmake-addon-development./xmake-async-jobsUse when running parallel / async work inside xmake scripts — `async.runjobs` for parallel job execution, `async.jobgraph` (DAG) for dependency-ordered jobs, `async.jobpool` (tree structure), `core.base.scheduler` coroutine scheduling, semaphores, and `on_build_files(..., {jobgraph = true})` in rules. For running external compile jobs faster, see `xmake-build-optimization`.Other plugins' skills for the same job