ninja -v: See the Exact Commands
ninja -v prints each compile and link command in full instead of the compact progress line.
Ninja's default output is a terse progress counter, which is unhelpful when a CI build fails on a flag or a missing include. -v shows the real command so you can reproduce it.
What it does
ninja -v echoes the complete command line of each job as it runs, rather than the short description. -d explain prints why ninja decided a target was dirty, which explains unexpected rebuilds. Both are read-only diagnostics that do not change the build.
Common usage
ninja -C build -v # print full commands
ninja -C build -d explain my_app # explain why targets rebuild
ninja -C build -d stats # print internal timing stats
NINJA_STATUS="[%f/%t] " ninja -C build # custom progress formatOptions
| Flag | What it does |
|---|---|
| -v | Show full command lines for each job |
| -d explain | Explain why each target is considered dirty |
| -d stats | Print ninja internal statistics |
| -d keeprsp | Keep response files for inspection |
| --quiet | Suppress status updates (newer ninja) |
In CI
When a build only fails in CI, rerun the failing step with ninja -v so the log carries the exact flags and include paths the runner used. Pair with -d explain when ccache or a restored build dir causes a surprising full rebuild.
Common errors in CI
If -v shows the compiler invoked without your expected -I or -D flags, the configure step (cmake/meson) did not pick up your toolchain or cache variables; fix it there, not in ninja. "-d: unknown debug setting" means a typo after -d; valid values include explain, stats, and keeprsp.