/xmake-skills:xmake-troubleshootingfrom xmake-skills
Diagnoses xmake build system issues: hangs, errors, slow builds, and regressions. Covers verbose traces, profiling env vars, git bisect, and Lua/C debugging.
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.
When xmake itself (not your project) is misbehaving, work from the cheapest tool to the most invasive: verbose output → profiling env → bisect → debugger.
xmake -v # verbose: show every sub-command
xmake -vD # verbose + diagnosis: full Lua tracebacks on error
xmake f -vD # same but for configure
xmake l -vD path/to/script.lua
-D is the single most important flag when something goes wrong — any Lua error comes back with a full stack into xmake/core/..., which usually tells you exactly which module is unhappy.
Project cache can also mask bugs. If something seems sticky:
xmake f -c # re-run configure, dropping cached state
xmake clean --all
rm -rf .xmake # nuclear: drop the whole local cache
XMAKE_PROFILE=stuck)Xmake has a built-in stuck-process debugger. Set XMAKE_PROFILE=stuck and it will (a) log every subprocess it spawns and (b) on Ctrl+C print the current Lua stack traceback — so you can see exactly where it was blocked.
Linux / macOS:
XMAKE_PROFILE=stuck xmake # one-shot
export XMAKE_PROFILE=stuck && xmake # whole session
Windows PowerShell:
$env:XMAKE_PROFILE="stuck"; xmake
Windows CMD:
set XMAKE_PROFILE=stuck && xmake
Subprocess trace (configure stuck probing a compiler):
$ XMAKE_PROFILE=stuck xmake f -c
<subprocess: sysctl>: /usr/sbin/sysctl -n machdep.cpu.vendor ...
checking for platform ... macosx
<subprocess: which>: which "xcrun -sdk macosx clang"
^C[xmake]: [engine]: stack traceback:
@programdir/core/base/scheduler.lua:429: in function 'base/scheduler.co_suspend'
.../lib/detect/find_program.lua:266: in function ...
@programdir/modules/detect/tools/find_clang.lua:44: ...
This tells you:
which "xcrun -sdk macosx clang" here).find_clang → find_program → scheduler.co_suspend, so xmake was waiting on a spawned process that never returned.Typical root causes this surfaces:
clang, a misconfigured wrapper).xmake process (check with ps/Task Manager).Report the trace verbatim when filing issues — it is far more useful than "xmake is stuck".
Same env var, different values. All enable per-phase timing and print a report at the end of the run.
XMAKE_PROFILE=... | What it measures |
|---|---|
stuck | Subprocess trace + Ctrl+C backtrace (see above) |
trace | Trace every sub-command xmake runs |
perf:call | Per-Lua-function call count and total time |
perf:tag | Time spent in named profiler tags (e.g. compile, link) |
perf:process | Time spent in spawned subprocesses |
Examples:
XMAKE_PROFILE=perf:call xmake # hot Lua functions
XMAKE_PROFILE=perf:tag xmake # compile/link phase timing
XMAKE_PROFILE=perf:process xmake -j1 # which child processes dominate
XMAKE_PROFILE=trace xmake f -c # log everything configure does
xmake f -c is slow → perf:process usually shows tool-detection probes dominating. Look for custom on_check / find_* modules that re-probe on every configure.perf:tag shows whether time is in compile, link, or elsewhere (dep-scan, codegen rules).xmake.lua parsing is slow → perf:call reveals expensive work done in the description phase. Move it to on_load / on_config.Also useful:
xmake -j N # parallel jobs
xmake build --jobs=N
xmake build --verbose # show actual compile invocations
xmake l cli.bisect)When a feature stopped working between two xmake versions (or two commits of your xmake.lua), use xmake's built-in bisect wrapper. It runs git bisect under the hood and runs your test command at each step.
xmake l cli.bisect \
-g <good> \
-b <bad> \
--gitdir=<path-to-xmake-checkout> \
-c "<test command>"
-g, --good — known-good tag or commit-b, --bad — known-bad tag or commit--gitdir= — path to the xmake source checkout to bisect-c, --commands — shell commands to run at each step; multiple commands separated by ;. Non-zero exit → bad commit.-s, --script — Lua script instead of -c-- — everything after is a raw command to executexmake l cli.bisect \
-g v2.9.1 -b v2.9.2 \
--gitdir=/path/to/xmake \
-c "xrepo remove --all -y; xmake f -a arm64 -cvD -y"
Output on completion:
aa278bc7fc0b723a315120bb95531991b7939229 is the first bad commit
improve to system/find_package
xmake/modules/package/manager/system/find_package.lua | 16 +++++++++++++---
You now have the exact commit, author, and diff — paste into the bug report.
xmake l cli.bisect -s /tmp/test.lua -g v2.9.1 -b v2.9.2 --gitdir=/path/to/xmake
-- /tmp/test.lua
function main()
os.exec("xrepo remove --all -y")
os.exec("xmake f -a arm64 -cvD -y")
os.exec("xmake build")
-- for custom checks, use raise() to mark the commit as bad
local output = os.iorun("xmake run hello")
if not output:find("expected output") then
raise("test output mismatch")
end
end
Semantics: os.exec failures automatically mark the commit bad. Use raise(...) for custom assertions (output matching, file existence, …).
xmake l cli.bisect -g 90846dd -b ddb86e4 --gitdir=/path/to/xmake -- xmake -rv
Everything after -- is executed verbatim. Good for one-liners.
log2(N) times.xrepo remove --all -y; xmake f -c) so cached state from a previous step does not contaminate the next.git submodule update --init --recursive inside the test script.If bisect points at a specific change and you want to dig in further, switch to source-level debugging. The full flow (build from source, srcenv.profile, editing Lua live, GDB/LLDB on the C core) has its own skill — see xmake-dev. A one-paragraph summary:
cd xmake && ./configure && make -j
source scripts/srcenv.profile
xmake l xmake.programdir # verify you are running the local tree
xmake -vD # reproduce the issue; errors now point into your checkout
From there, edit xmake/... Lua files directly (no rebuild needed) and drop print/utils.vprint/cprint where the traceback points.
For native-side issues (core/src/xmake/*.c), ./configure --mode=debug && make -j, then gdb --args core/build/xmake ... — see xmake-dev.
For interactive step-through of the Lua layer inside VS Code:
xrepo env -b emmylua_debugger -- xmake build
Then in VS Code (with the EmmyLua extension), open the xmake Lua source, go to Run and Debug → Emmylua New Debug to attach. The first breakpoint hits inside debugger:_start_emmylua_debugger; step out to land in main.lua. Swap xmake build for any other subcommand to debug it.
When escalating to maintainers, include:
xmake --versionxmake l 'print(os.host(), os.arch(), os.subhost())'xmake.lua that reproduces the issue-vD output (or at least the traceback)XMAKE_PROFILE=stuck subprocess trace + Ctrl+C backtracexmake l cli.bisectxmake f -c, xmake clean --all, deleting .xmake/)Something is wrong with xmake
│
├── It just errors
│ └─ xmake -vD → read the Lua traceback
│
├── It hangs
│ └─ XMAKE_PROFILE=stuck xmake ... → Ctrl+C → read trace
│
├── It's slow
│ ├─ XMAKE_PROFILE=perf:process → which subprocesses dominate?
│ ├─ XMAKE_PROFILE=perf:tag → compile vs link vs other?
│ └─ XMAKE_PROFILE=perf:call → expensive Lua functions?
│
├── It used to work, now it doesn't
│ └─ xmake l cli.bisect -g <old> -b <new> --gitdir=... -c "..."
│
└── I need to step through the source
└─ see the `xmake-dev` skill (build + srcenv + gdb/emmylua)
xmake-devxmake-packages, xmake-repo-testingxmake-toolchainsWhat 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