mohitmishra786/low-level-dev-skills / skills/build-systems/build-acceleration
build-acceleration
VerifiedBuild acceleration skill for C/C++ projects. Use when reducing compilation times with ccache, sccache, distcc, unity builds, precompiled headers, split DWARF, or IWYU. Covers caching strategies, distributed compilation, link time reduction, and diagnosing build bottlenecks. Activates on queries about slow builds, ccache, sccache, precompiled headers, unity builds, split-DWARF, or reducing C++ compile times.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.6 KB |
| references/ccache-config.md | markdown | 2.9 KB |
references/ccache-config.md
View on GitHub# ccache Configuration Reference
Source: <https://ccache.dev/manual/latest.html>
## Table of Contents
1. [Configuration File Locations](#configuration-file-locations)
2. [Key Settings](#key-settings)
3. [CI / Shared Cache](#ci--shared-cache)
4. [Troubleshooting Hit Rate](#troubleshooting-hit-rate)
## Configuration File Locations
ccache reads config in order (later overrides earlier):
1. `/etc/ccache.conf` — system-wide
2. `$CCACHE_CONFIGPATH` — override path
3. `~/.config/ccache/ccache.conf` — user config
4. `$CCACHE_DIR/ccache.conf` — per-cache-dir
## Key Settings
```ini
# Cache storage
max_size = 20G # Maximum cache size (K, M, G, T suffix)
cache_dir = /var/cache/ccache # Non-default location
# Compression (significant space saving, slight CPU cost)
compression = true
compression_level = 6 # 1-9, default 6
# Debug (disable in production)
log_file = /tmp/ccache.log
debug = false
# Hashing behavior
hash_dir = false # Don't include CWD in hash (helps shared cache)
base_dir = /project # Strip this prefix from file paths in hash
# Include handling
sloppiness = include_file_mtime,include_file_ctime,time_macros
# time_macros: ignore __DATE__ and __TIME__ macro changes
# include_file_mtime: don't stat all included files (faster, slight risk)
# PCH support
sloppiness = pch_defines,time_macros # needed for GCC PCH
```
## CI / Shared Cache
For GitHub Actions / Jenkins with shared NFS:
```yaml
# .github/workflows/build.yml
- name: Restore ccache
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: ccache-${{ runner.os }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: ccache-${{ runner.os }}-
- name: Configure ccache
run: |
ccache --set-config=max_size=500M
ccache --set-config=compression=true
ccache --set-config=hash_dir=false
ccache --set-config=base_dir=${{ github.workspace }}
- name: Build
run: cmake --build build -j$(nproc)
- name: ccache stats
run: ccache -s
```
## Troubleshooting Hit Rate
```bash
# Full stats
ccache -s -v
# Key miss reasons:
# "called for preprocessing" → compiler called as preprocessor, not supported
# "unsupported code directive" → inline asm or pragmas ccache can't handle
# "cache miss" → normal first-time compilation
# "preprocessor error" → fix the preprocessor invocation
# Reset statistics (not cache)
ccache --zero-stats
# Force a cache hit check without compilation
CCACHE_READONLY=1 make
```
Common miss reasons and fixes:
| Miss reason | Fix |
|-------------|-----|
| Absolute paths in source | Set `base_dir` to project root |
| `__DATE__`/`__TIME__` macros | Add `time_macros` to `sloppiness` |
| PCH changes invalidate all | Add `pch_defines` to `sloppiness` |
| Different working directory | Set `hash_dir=false` |
| Compiler version change | Expected — correct behavior |
| Response files (`@file`) | Use `CCACHE_COMPILERCHECK=content` |
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |