/xmake-skills:xmake-distributed-compilationfrom xmake-skills
Sets up and uses xmake's built-in distributed compilation (distcc-equivalent) to offload compile jobs to a cluster of servers. Covers server/client config, token auth, job control, cache integration, and cross-compilation.
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 ships a built-in distributed compile service similar to distcc — but fully cross-platform (GCC, Clang, and MSVC) and tightly integrated with xmake's cache. Use it when a team or CI setup needs to pool compile resources.
┌──── distcc server (linux) 9693 ─┐
client ──┼──── distcc server (macos) 9693 ─┤──── jobs scheduled + compiled remotely
└──── distcc server (win) 9693 ─┘
local compile ─── small/fast files stay local after preprocessing
local cache ────── cache hits short-circuit everything
xmake service --distcc is a server.client.conf; xmake schedules jobs across them automatically.xmake service --distcc # foreground
xmake service --distcc -vD # foreground + verbose
xmake service --distcc --start # daemonize
xmake service --distcc --stop
xmake service --distcc --restart
First run generates ~/.xmake/service/server.conf and prints a token.
{
distcc_build = {
listen = "0.0.0.0:9693",
workdir = "/home/ruki/.xmake/service/server/distcc_build"
},
known_hosts = { },
logfile = "/home/ruki/.xmake/service/server/logs.txt",
tokens = { "590234653af52e91b9e438ed860f1a2b" }
}
listen — host:port.workdir — scratch dir for per-job files.tokens — whitelist. Generate more with xmake service --gen-token.known_hosts — optional IP allowlist.If the server must cross-compile (e.g. Android from Linux, iOS from macOS), declare the toolchains in server.conf so the client doesn't need to ship them:
{
distcc_build = {
listen = "0.0.0.0:9693",
toolchains = {
ndk = {
ndk = "~/files/android-ndk-r26"
},
cross = {
sdkdir = "~/files/arm-linux-musleabi-cross"
}
},
workdir = "/home/ruki/.xmake/service/server/distcc_build"
},
tokens = { "..." }
}
Keys under toolchains.* match the xmake toolchain names (ndk, cross, clang, gcc, etc.) and map to set_sdkdir, set_bindir, set_cross fields.
~/.xmake/service/client.conf:
{
distcc_build = {
hosts = {
{
connect = "192.168.22.168:9693",
token = "590234653af52e91b9e438ed860f1a2b",
njob = 8
},
{
connect = "192.168.22.169:9693",
token = "590234653af52e91b9e438ed860f1a2b",
njob = 4
}
}
}
}
hosts — array; jobs are load-balanced across entries.njob = N — max parallel jobs this particular server will handle. Omit to use the server's default.{
distcc_build = {
connect_timeout = 5000,
send_timeout = 5000,
recv_timeout = 5000,
}
}
Unit: milliseconds. On timeout the client automatically falls back to local compilation, so jobs don't hang.
cd myproject
xmake service --connect --distcc # just distcc
xmake service --connect --distcc --ccache # distcc + remote cache (recommended)
xmake # compiles normally, jobs farmed out
Output during a build with distcc connected:
[ 93%]: cache compiling.release src/demo/network/unix_echo_client.c ← local hit
[ 93%]: compiling.release src/demo/network/ipv4.c ← local
[ 93%]: distcc compiling.release src/demo/network/http.c ← remote
[ 94%]: distcc compiling.release src/demo/math/fixed.c ← remote
Three categories:
cache compiling — served from the cache, no work done.compiling — compiled locally.distcc compiling — shipped to a server.Xmake chooses automatically: small files after preprocessing often stay local (cheaper than round-tripping).
Default total parallelism when distcc is connected:
n = ⌈3/2 × local_ncpu⌉ (default local job count)
c = server_count
d = per_server_default_njob
maxjobs = n + c × d
Override locally with xmake -jN. The -j flag does not override server-side job counts — those are set in the client config's njob field per host.
Once toolchains are declared on the server, client-side config is unchanged:
# Android from any client
xmake f -p android -a arm64-v8a --ndk=~/files/android-ndk-r26
xmake
# iOS (server must be macOS with Xcode)
xmake f -p iphoneos
xmake
# Custom cross
xmake f -p cross --sdk=/opt/arm-linux-musleabi-cross
xmake
The client does the configure locally, the server compiles each object.
The ideal setup pairs all three:
xmake service --connect --distcc --ccache
Order of fallback per compile unit:
See xmake-build-cache for the cache setup.
xmake service --disconnect --distcc # drop connection for current project
xmake service --clean --distcc # clean this project's server scratch
xmake service --logs # tail server logs
xmake service --gen-token # generate a new token
xmake service --add-user=ruki # password-auth user (not recommended for distcc)
xmake service --rm-user=ruki
connect_timeout / send_timeout / recv_timeout so clients degrade to local on trouble.known_hosts empty means open. If you don't populate it, any host with a valid token can connect. For exposed networks, fill the allowlist.xmake-build-cachexmake-remote-compilationxmake-build-optimizationxmake-cross-compilationWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
distcc, distributed-compilation, xmake, build-cluster, cross-compilation
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