CCACHE(1) CCACHE(1) (NAME) ccache - C/C++ (SYNOPSIS) ccache [ccache options] ccache [KEY=VALUE ...] compiler [compiler options] compiler [compiler options] . KEY=VALUE . ccache . (DESCRIPTION) Ccache (cache) . Ccache . (build) . CAVEATS . ccache . (RUN MODES) ccache : 1. (Prefix method): ccache . ccache . : ccache gcc -c example.c 2. (Masquerade method): (symbolic link) ccache ccache . ccache . ccache gcc g++: cp ccache /usr/local/bin/ ln -s ccache /usr/local/bin/gcc ln -s ccache /usr/local/bin/g++ ccache : cp ccache /usr/local/bin/gcc cp ccache /usr/local/bin/g++ ccache ( /usr/bin) PATH . (Warning) . USING CCACHE WITH OTHER COMPILER WRAPPERS . ccache "ccache" . ccache ( ) . (Common options) -c, --cleanup (cache) . . ccache . . -C, --clear . --config-path PATH PATH . () CCACHE_CONFIGPATH . -d, --dir PATH PATH . /shared/ccache ccache -d /shared/ccache -s . CCACHE_DIR . --dry-run . --evict-namespace NAMESPACE namespace . --evict-older-than AGE AGE . AGE d () s () . --evict-namespace namespace . -h, --help . -F NUM, --max-files NUM NUM. 0 . . -M SIZE, --max-size SIZE . SIZE : kB MB GB TB () KiB MiB GiB TiB (). GiB . 0 . . -X LEVEL, --recompress LEVEL LEVEL Zstandard. ( compression_level) uncompressed . CACHE COMPRESSION . . LEVEL . -o KEY=VALUE, --set-config KEY=VALUE KEY VALUE . CONFIGURATION . -x, --show-compression . CACHE COMPRESSION . . -p, --show-config ( ) . --show-log-stats . stats_log . -v/--verbose . -s, --show-stats . -v/--verbose . Cache statistics . --stop-storage-helpers . --threads THREADS THREADS . (CPU) . -v, --verbose ( ). . -V, --version . -z, --zero-stats ( ). --trim-dir PATH PATH --trim-max-size . . CCACHE_MAXSIZE=SIZE ccache -c . --trim-max-size SIZE --trim-dir . SIZE : kB MB GB TB () KiB MiB GiB TiB (). GiB . 0 . --trim-method METHOD --trim-dir . : atime LRU ( ) . . mtime LRU ( ) . --trim-recompress LEVEL --trim-dir Zstandard LEVEL . compression_level uncompressed . CACHE COMPRESSION . . LEVEL . (Options for scripting or debugging) --checksum-file PATH (128 XXH3) PATH (- ). --extract-result PATH PATH (- ). ccache-result.* . ccache . --format FORMAT --print-log-stats --print-stats . : tab (Tab-separated). . json JSON. -k KEY, --get-config KEY KEY . CONFIGURATION . --hash-file PATH (160 BLAKE3) PATH (- ). ccache . --inspect PATH PATH (- ) . --extract-result . ccache . --print-log-stats (stats log) ( JSON) . stats_log --format . --print-stats ( JSON) . --format . --print-version . ccache . --ccache-skip . ccache . --ccache-skip ccache -- (direct mode hash) . ccache (object file) ( ) . ccache . --ccache-skip . --ccache-skip ccache ccache . ignore_options. (CONFIGURATION) ccache . ( ): 1. KEY=VALUE. : ccache debug=true compiler_check="%compiler% --version" gcc -c example.c 2. CCACHE_ . 3. . 4. (cache). 5. /ccache.conf ( /etc/ccache.conf /usr/local/etc/ccache.conf). 6. . : CCACHE_CONFIGPATH ( )..SS " (Cache-specific configuration file)" : 1. CCACHE_CONFIGPATH . 2. CCACHE_DIR $CCACHE_DIR/ccache.conf . 3. cache_dir /ccache.conf . 4. $HOME/.ccache $HOME/.ccache/ccache.conf . 5. XDG_CONFIG_HOME $XDG_CONFIG_HOME/ccache/ccache.conf . 6. $HOME/Library/Preferences/ccache/ccache.conf ( macOS) $HOME/.config/ccache/ccache.conf ( ) . : 1. CCACHE_CONFIGPATH . 2. CCACHE_DIR %CCACHE_DIR%/ccache.conf . 3. cache_dir \ccache.conf . %ALLUSERSPROFILE%\ccache\ccache.conf . ALLUSERSPROFILE C:\ProgramData . 4. %USERPROFILE%\.ccache %USERPROFILE%\.ccache\ccache.conf . 5. %LOCALAPPDATA%\ccache\ccache.conf . 6. %APPDATA%\ccache\ccache.conf . cache_dir ..SS " " Ccache ccache.conf ( ) . ccache . : o << >> ( ) o << >> ( .git) o o ( ) << >> ( ) . safe_dirs . . POSIX : $VAR ${VAR}. VAR . ($$) ($) . "key = value" . (#) . . : # Set maximum cache size to 10 GB: max_size = 10GB . ( ) . . : ignore_options = -Wall -Wextra # This is a comment within the value -pedantic # This ends the multi-line value compiler = gcc : ignore_options = -Wall -Wextra -pedantic compiler = gcc . ( ) . true false . : o "true" ( ). o ( ) : 0 false disable no. o "false" . CCACHE_NO . CCACHE_COMPRESS CCACHE_NOCOMPRESS ..SS " (Path lists)" ; Windows : . (Configuration options) . . absolute_paths_in_stderr (CCACHE_ABSSTDERR) ccache ( ) . base_dir ( CMake "Unix Makefiles") . false . base_dir (CCACHE_BASEDIR) . ccache ( ) . <<>> << >> . . COMPILING IN DIFFERENT DIRECTORIES_ . ( ) . / . : Alice /home/alice/project1/build : ccache gcc -I/usr/include/example -I/home/alice/project2/include -c /home/alice/project1/src/example.c ccache base_dir : # Current working directory: /home/alice/project1/build # With "base_dir = /": gcc -I../../../../usr/include/example -I../../project2/include -c ../src/example.c # With "base_dir = /home" or "base_dir = /home/alice": gcc -I/usr/include/example -I../../project2/include -c ../src/example.c # With "base_dir = /home/alice/project1" or "base_dir = /home/alice/project1/src": gcc -I/usr/include/example -I/home/alice/project2/include -c ../src/example.c Bob /home/bob/stuff base_dir /home /home/$USER (cache hits) : # Current working directory: /home/bob/stuff/project1/build # With "base_dir = /home" or "base_dir = /home/bob": gcc -I/usr/include/example -I../../project2/include -c ../src/example.c base_dir (cache miss) . base_dir / /usr/include/example . base_dir /home/bob/stuff/project1 project2 . (brittle hack) . . Make Ninja . base_dir . cache_dir (CCACHE_DIR) ccache . Windows $HOME/.ccache XDG_CACHE_HOME $XDG_CACHE_HOME/ccache $HOME/Library/Caches/ccache ( macOS) $HOME/.cache/ccache ( ) . Windows %USERPROFILE%\.ccache %LOCALAPPDATA%\ccache . ccache Windows %APPDATA%\ccache . (domain) . %LOCALAPPDATA%\ccache . Cache-specific configuration file . ceiling_dirs (CCACHE_CEILING_DIRS) ccache . ( ) . (home) . ceiling_markers (CCACHE_CEILING_MARKERS) ( ; Windows : ). ccache . .git . compiler (CCACHE_COMPILER or () CCACHE_CC) . ( ) ccache . compiler_check (CCACHE_COMPILERCHECK) ccache ("mtime") . . . : content . ccache mtime (bootstrapping) . mtime mtime . . none . mtime ( ). none . string:value value . (revision) . a command string . (whitespace) . %compiler% . ; . : %compiler% -v %compiler% -dumpmachine; %compiler% -dumpversion ccache . . ( ccache) (compiler wrapper) -- mtime mtime ccache . mtime prefix_command . USING CCACHE WITH OTHER COMPILER WRAPPERS . compiler_type (CCACHE_COMPILERTYPE) . compiler_type . . : auto ( ) . . clang Clang. clang-cl clang-cl. gcc GCC. icl Intel Windows. icx LLVM Intel. icx-cl MSVC LLVM Intel. msvc Microsoft Visual C++ (MSVC). nvcc NVCC (CUDA). qcc QCC (QNX). other . compression (CCACHE_COMPRESS CCACHE_NOCOMPRESS Boolean values ) true ccache . . true . Zstandard . . ccache . ( file_clone) ( hard_link) . compression_level (CCACHE_COMPRESSLEVEL) ccache Zstandard . compression ( ). Zstandard (decompression) . 0 . compression_level: > 0 Zstandard . ( 1) . ( 19) . libzstd 19 . . 5 . -X/--recompress . < 0 << >> (ultra-fast) Zstandard 1 . -3 --fast=3 zstd . -5 . 0 () 0 ccache 1 . Zstandard . debug (CCACHE_DEBUG CCACHE_NODEBUG Boolean values ) true (debug) . (per-object) . ccache . CACHE DEBUGGING . false . debug_dir (CCACHE_DEBUGDIR) . . . . debug_dir /example /home/user build/output.o /example/home/user/build/output.o.ccache-log . CACHE DEBUGGING . debug_level (CCACHE_DEBUGLEVEL) . CACHE DEBUGGING . 2 . depend_mode (CCACHE_DEPEND CCACHE_NODEPEND Boolean values ) true (depend mode) . false . The depend mode . direct_mode (CCACHE_DIRECT CCACHE_NODIRECT Boolean values ) true (direct mode) . true . The direct mode . disable (CCACHE_DISABLE CCACHE_NODISABLE Boolean values ) true ccache . false . ccache:disable 4096 ccache . extra_files_to_hash (CCACHE_EXTRAFILES) ccache (hash sum) . file_clone (CCACHE_FILECLONE CCACHE_NOFILECLONE Boolean values ) true ccache ( << >> <> <>) . file_clone hard_link . false . . . hard_link file_clone . ccache ( hard_link) . hard_link (CCACHE_HARDLINK CCACHE_NOHARDLINK Boolean values ) true ccache . false . . . : o . 4.0 ccache . . strip file.o echo >file.o . o . o ( make) ( ) . (i-nodes) . file.o A ( ) file.o B ccache file.o A . (relinking) A . hash_dir (CCACHE_HASHDIR CCACHE_NOHASHDIR Boolean values ) true ( ) ccache ( -g ) (CWD) . : -fdebug-prefix-map -fdebug-compilation-dir CWD . COMPILING IN DIFFERENT DIRECTORIES . CWD ccache . CWD . ignore_headers_in_manifest (CCACHE_IGNOREHEADERS) ( ) ccache . . ignore_options (CCACHE_IGNOREOPTIONS) ccache . (*) . -fmessage-length=* -fmessage-length=20 -fmessage-length=70 . . ( ccache ) . Extra options . inode_cache (CCACHE_INODECACHE CCACHE_NOINODECACHE Boolean values ) true ccache . (include) . true . temporary_dir . Windows . Windows false . keep_comments_cpp (CCACHE_COMMENTS CCACHE_NOCOMMENTS Boolean values ) true ccache . false . -Wdocumentation . libexec_dirs (CCACHE_LIBEXEC_DIRS) ccache . log_file (CCACHE_LOGFILE) ccache . . syslog ccache syslog() . rsyslogd /etc/rsyslog.conf /etc/rsyslog.d : # log ccache to file :programname, isequal, "ccache" /var/log/ccache # remove from syslog & ~ max_files (CCACHE_MAXFILES) . 0 ( ). CACHE SIZE MANAGEMENT . max_size (CCACHE_MAXSIZE) . 0 . 5GiB . : kB MB GB TB () KiB MiB GiB TiB (). GiB . CACHE SIZE MANAGEMENT . msvc_dep_prefix (CCACHE_MSVC_DEP_PREFIX) MSVC . "Note: including file:" . . msvc_utf8 (CCACHE_MSVC_UTF8) /utf-8 msvc ascii . /validate-charset utf-8 [128, 255] Windows ( utf-8 ) . true . namespace (CCACHE_NAMESPACE) . . --evict-namespace --evict-older-than . . . path (CCACHE_PATH) ccache . ccache PATH ccache . pch_external_checksum (CCACHE_PCH_EXTSUM CCACHE_NOPCH_EXTSUM Boolean values ) ccache ".sum" ( "pre.h.gch.sum") . prefix_command (CCACHE_PREFIX) ( ) ccache . USING CCACHE WITH OTHER COMPILER WRAPPERS . prefix_command_cpp (CCACHE_PREFIX_CPP) ( ) ccache . read_only (CCACHE_READONLY CCACHE_NOREADONLY Boolean values ) true ccache (backend) . stats false . ccache temporary_dir ccache . stats false ccache . read_only_direct (CCACHE_READONLY_DIRECT CCACHE_NOREADONLY_DIRECT Boolean values ) read_only ccache . read_only ccache . recache (CCACHE_RECACHE CCACHE_NORECACHE Boolean values ) true ccache . . remote_only (CCACHE_REMOTE_ONLY CCACHE_NOREMOTE_ONLY Boolean values ) true ccache (remote) . false . stats false . Storage interaction . remote_storage (CCACHE_REMOTE_STORAGE) ( ) ( remote_only true ). REMOTE STORAGE BACKENDS . : remote_storage = file:/shared/nfs/directory+` remote_storage = file:///shared/nfs/one read-only file:///shared/nfs/two remote_storage = file:///Z:/example/windows/folder remote_storage = http://example.com/cache remote_storage = redis://example.com ccache secondary_storage (CCACHE_SECONDARY_STORAGE) . reshare (CCACHE_RESHARE CCACHE_NORESHARE Boolean values ) true ccache . false . response_file_format (CCACHE_RESPONSE_FILE_FORMAT) (response file) . response_file_format (quoting) . POSIX Windows . : auto . . posix POSIX. windows Windows. safe_dirs (CCACHE_SAFE_DIRS) << >> ( Directory-specific configuration file ). . : * . /* ( ) . /* . sloppiness (CCACHE_SLOPPINESS) ccache (false cache hits) . ccache . ccache . ( ): clang_index_store : Xcode index store. : -index-store-path -index-unit-output-path . : (Index) . file_stat_matches : . : . : . file_stat_matches_ctime : . : file_stat_matches (ctime) . : . gcno_cwd : (code coverage) . : .gcno (-ftest-coverage). -fprofile-abs-path . : . --coverage ( -fprofile-arcs ). incbin : .incbin . : .incbin . : . include_file_ctime : . : . : . include_file_mtime : . : . : . ivfsoverlay : Xcode Objective-C Swift . : -ivfsoverlay . : VFS . locale : (locale). : locale (LANG LC_ALL LC_CTYPE LC_MESSAGES). : . modules : Clang -fmodules. : C++ . : . C++ MODULES . pch_defines : . : #define . : . PRECOMPILED HEADERS . random_seed : -frandom-seed. : seed . : . system_headers : . : . : . : GCC ( MSVC). . ignore_headers_in_manifest . time_macros : . : __DATE__ __TIME__ __TIMESTAMP__ . : . stats (CCACHE_STATS CCACHE_NOSTATS Boolean values ) true ccache . true . false . stats_log (CCACHE_STATSLOG) ccache . . ccache --show-log-stats . (#) . temporary_dir (CCACHE_TEMPDIR) ccache . $XDG_RUNTIME_DIR/ccache-tmp ( /run/user//ccache-tmp) XDG_RUNTIME_DIR /tmp . ccache CCACHE_TEMPDIR CCACHE_DIR . umask (CCACHE_UMASK) ( ) umask . . ccache disable = true (CCACHE_DISABLE=1) . ccache:disable () ccache . Ccache disabled . (REMOTE STORAGE BACKENDS) remote_storage ccache . cache_dir remote_only true . -- . (Storage helper process) ccache ( ) . . Storage helpers . ccache-storage- URL https. ( ): 1. helper ( ). 2. libexec. 3. ccache. 4. $PATH. ccache (builtin) ccache . (Configuration syntax) URL (key=value) (@key=value) (whitespace) . =value true . % | percent-encoded . ccache | . (Properties) o data-timeout: /. . : 10s. o helper: ( ). . o idle-timeout: (0s: ). : 10m. o read-only: true . false . o request-timeout: . : 1m. o shards: (sharding / ) Rendezvous hashing . URL (*) shard URL . shard shard . shard w w/S S shard . . 1 . : o http://cache-*.example.com shards=a(3),b(1),c(1.5) (/) http://cache-a.example.com (/) http://cache-b.example.com (/) http://cache-c.example.com . o http://example.com/* shards=alpha,beta http://example.com/alpha http://example.com/beta . ms () s () m () h () d () ..SS " (Custom attributes)" @key=value storage helper . backend . : o file:///example/directory @umask=002 @update-mtime=true o https://example.com/path @bearer-token=deadbeef (Storage interaction) (hit) (miss) remote_only false ( ) : +-------------------------------+--------------------------------+--------------------------+ | | | | | | | | | | | | +-------------------------------+--------------------------------+--------------------------+ | | | | |(miss) | (miss) | | | | | | | | | | | | | [1] | +-------------------------------+--------------------------------+--------------------------+ | | (hit) | | |(miss) | | | | | | | | | | | | | | | +-------------------------------+--------------------------------+--------------------------+ | (hit) | - | | | | | | | | | | | | | | | | | [2] | +-------------------------------+--------------------------------+--------------------------+ [1] read-only=true . [2] reshare . remote_only true : +-------------------------------+--------------------------------+--------------------------+ | | | | | | | | | | | | +-------------------------------+--------------------------------+--------------------------+ |- | | | | | (miss) | | | | | | | | | | | | | | | | | | +-------------------------------+--------------------------------+--------------------------+ |- | (hit) | | | | | | | | | | | | | | | | | | | | | | +-------------------------------+--------------------------------+--------------------------+ URL: file:DIRECTORY file://[HOST]DIRECTORY DIRECTORY ( ) . NFS . DIRECTORY . HOST localhost . Windows HOST . ccache -- ccache --trim-dir. : o file:/shared/nfs/directory o file:///shared/nfs/directory @umask=002 @update-mtime=true o file:///Z:/example/windows/folder o file://example.com/shared/ccache%20folder : o @layout: . : o flat: . o local: . (mount) . (file_clone hard_link ). o subdirs: 256 . subdirs . o @umask: ( ) umask . o @update-mtime: true (mtime) . false . URL: crsh:IPC_ENDPOINT ccache (CRSH) IPC_ENDPOINT ( ) . . : o crsh:/path/to/your.sock ( ) o crsh:name-of-your-pipe ( ) HTTP HTTP ccache ( ) . . URL: http://HOST[:PORT][/PATH] HTTP . HTTP GET PUT DELETE . ccache -- ccache --trim-dir. HTTPS . HTTP ccache HTTP . : o http://localhost o http://someusername:p4ssw0rd@example.com/cache/ o http://localhost:8080 @layout=bazel : o @bearer-token: (Bearer token) HTTP. o @keep-alive: true HTTP . true . o @layout: URL. : o bazel: HTTP Bazel. /ac/ . action cache ccache (action result) . o flat: URL ( ). o subdirs: URL ( ) . . subdirs . o @header: key=value HTTP . : @header=Content-Type=application/octet-stream "Content-Type: application/octet-stream" HTTP . Redis (non-bug-fix) ccache . (remote storage helper) . URL: redis://[[USERNAME:]PASSWORD@]HOST[:PORT][/DBNUMBER] redis+unix:SOCKET_PATH[?db=DBNUMBER] redis+unix://[[USERNAME:]PASSWORD@localhost]SOCKET_PATH[?db=DBNUMBER] Redis ( Redis) . . PORT 6379 DBNUMBER 0 . ccache Redis LRU . Redis ccache Redis . shards REMOTE STORAGE BACKENDS () Redis . : o redis://localhost o redis://p4ssw0rd@cache.example.com:6379/0 o redis+unix:/run/redis.sock o redis+unix:///run/redis.sock o redis+unix://p4ssw0rd@localhost/run/redis.sock?db=0 ccache (5 GB) . -M/--max-size -F/--max-files . ( ) -s/--show-stats . : . (Automatic cleanup) max_size max_files ccache . (mtime) LRU ( ) . ccache (mtime) (cache hit) . LRU . (Manual cleanup) ccache --cleanup . max_size max_files . . ccache --evict-older-than AGE . (CACHE COMPRESSION) ccache Zstandard (zstd) . . ccache . compression compression_level . ccache --show-compression . : Total data: 14.8 GB (16.0 GB disk blocks) Compressed data: 11.3 GB (30.6% of original size) Original size: 36.9 GB Compression ratio: 3.267 x (69.4% space savings) Incompressible data: 3.5 GB : o Disk blocks: . "Cache size" ccache --show-stats . o Compressed data: . o Incompressible data: ( file_clone hard_link) ccache. o Compression ratio: compression_level . ccache --recompress . . (CACHE STATISTICS) ccache --show-stats ( ccache -c) (hit rate) / (direct/preprocessed) . ccache . ccache --zero-stats . ccache --show-stats . stats_log ccache --show-log-stats . . stats_log . "Errors" "Uncacheable" . -v/--verbose . (verbose) : +---------------------------+-----------------------------------------------+ | | (Description) | |(Counter) | | +---------------------------+-----------------------------------------------+ |Autoconf compile/link | | | | | | | Autoconf. | +---------------------------+-----------------------------------------------+ |Bad compiler arguments | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | . | +---------------------------+-----------------------------------------------+ |Called for linking | | | | (linking) | | | | | | . | | | ccache | | | | | | | | | | | | | | | | | | | | | -c | | | | | | (object file) | | | . | +---------------------------+-----------------------------------------------+ |Called for preprocessing | | | | | | | | | | . | +---------------------------+-----------------------------------------------+ |Ccache disabled | ccache | | | ccache:disable | | | | | | . | +---------------------------+-----------------------------------------------+ |Could not use modules | | | | | | | ++C | | | . | +---------------------------+-----------------------------------------------+ |Could not use precompiled | | |header | | | | | | | | | | . | +---------------------------+-----------------------------------------------+ |Could not read or parse | | |input file | | | | ( | | | | | | | | | ). | +---------------------------+-----------------------------------------------+ |Could not write to output | | |file | | | | -o | | | . | +---------------------------+-----------------------------------------------+ |Compilation failed | | | | . | | | | | | . | +---------------------------+-----------------------------------------------+ |Compiler check failed | | | | | | | compiler_check (CCACHE_COMPILERCHECK) | | | | | | . | +---------------------------+-----------------------------------------------+ |Compiler output file | | |missing | | | | | | | | | | . | +---------------------------+-----------------------------------------------+ |Compiler produced empty | | |output | | | | ( | | | ) | | | . | +---------------------------+-----------------------------------------------+ |Could not find the | | |compiler | | | | . | +---------------------------+-----------------------------------------------+ |Error hashing extra file | | | | | | | extra_files_to_hash (CCACHE_EXTRAFILES) | | | . | +---------------------------+-----------------------------------------------+ |Forced recache | CCACHE_RECACHE | | | | | | | | | . | +---------------------------+-----------------------------------------------+ |Input file modified during | | |compilation | | | | . | +---------------------------+-----------------------------------------------+ |Internal error | | | | | | | | | | / . | +---------------------------+-----------------------------------------------+ |Missing cache file | | | | | | | . | | | | | | | | | | | | | | | ccache | | | | | | | | | | | | | | | | | | . | +---------------------------+-----------------------------------------------+ |Multiple source files | | | | | | | | | | | | | . | | | ccache | | | . | +---------------------------+-----------------------------------------------+ |No input file | | | | | | | | | | . | +---------------------------+-----------------------------------------------+ |Output to stdout | | | | | | | | | | -o - | | | | | | | | | . | | | ccache | | | . | +---------------------------+-----------------------------------------------+ |Preprocessing failed | | | | | | | -E | | | | | | . | +---------------------------+-----------------------------------------------+ |Unsupported code directive | | | | .incbin | | | . | | | ccache | | | . | +---------------------------+-----------------------------------------------+ |Unsupported compiler | | |option | | | | ccache | | | . | +---------------------------+-----------------------------------------------+ |Unsupported environment | | |variable | ccache | | | | | | . | +---------------------------+-----------------------------------------------+ |Unsupported source | ( | |encoding | ) | | | | | | | | | . ccache | | | MSVC | | | msvc_utf8 | | | true | | | | | | UTF-8 | | | . | +---------------------------+-----------------------------------------------+ |Unsupported source | | |language | | | | -x ccache | | | | | | . | +---------------------------+-----------------------------------------------+ ccache . (" " "input hash") . ccache (cache) . ccache BLAKE3 , . XXH3 . ccache : o (Preprocessor mode): ccache . o (Direct mode): ccache include . . (cache miss) ccache depend mode . depend mode ccache . The depend mode . (Common hashed information) : o ( .i C .ii C++) o ( compiler_check ) o o ( hash_dir) o extra_files_to_hash ( ) (The preprocessor mode) : o -E o include (-I -include -D ) o (standard error) ..SS " (The direct mode)" : o o "manifest" . : o ( ) o include o include include . ccache . ccache . include . include . : . ccache -I . ccache . . : o direct_mode (false) o include ( ) o : o -Wp,* -Wp,-MD, -Wp,-MMD, -Wp,-D -Wp,-U o -Xpreprocessor o __TIME__ ccache . () include MSVC /showIncludes -MD -MMD . : o (overhead) ccache (cache miss) . o distcc ccache . : o (cache hit rate) . ccache . o -MD -MD make . MSVC /showIncludes . o -MMD ccache . : o depend_mode false . o -MD -MMD ( MSVC /showIncludes ). (HANDLING OF NEWLY CREATED SOURCE FILES) (mtime) (ctime) include ( ) ccache ccache . (race condition ) . (timestamp granularity) . sloppiness include_file_ctime,include_file_mtime . : 1. ccache . 2. . 3. . 4. ccache ( ) . ccache debug CCACHE_DEBUG . (cache hit) . . ccache (object file) : +-------------------------------------------+-----------------------------------+--------------------------------------+ | | | | | | | | +-------------------------------------------+-----------------------------------+--------------------------------------+ |..ccache-input-c | 2 | | | | | | | | | | | | | (direct mode) | | | | | | | | | | | | (preprocessor mode). | +-------------------------------------------+-----------------------------------+--------------------------------------+ |..ccache-input-d | 2 | | | | | | | | | | | | | . | +-------------------------------------------+-----------------------------------+--------------------------------------+ |..ccache-input-p | 2 | | | | | | | | | | | | | | | | | . | +-------------------------------------------+-----------------------------------+--------------------------------------+ |..ccache-input-text | 2 | | | | | | | | | | | | | | | | | (diffable) | | | | . | +-------------------------------------------+-----------------------------------+--------------------------------------+ |..ccache-log | 1 | | | | | . | +-------------------------------------------+-----------------------------------+--------------------------------------+ __ . debug_level ( CCACHE_DEBUGLEVEL) 1 . debug_dir ( CCACHE_DEBUGDIR) . ccache BLAKE3 "ccache-input-c" + "ccache-input-d" ( + ) "ccache-input-c" + "ccache-input-p" . "ccache-input-text" . ("COMMON" "DIRECT MODE" "PREPROCESSOR MODE") . : 1. debug (CCACHE_DEBUG) . 2. (Build). 3. (Clean and build). 4. ..ccache-input-text . ..ccache-log . ccache . : o ( -g -I) o ( include) o ( __FILE__ ) ( -g) GCC -fdebug-prefix-map=$PWD=. ( ) -fdebug-compilation-dir=. ( ). hash_dir false ( ). base_dir . Ccache . /home/user/projects base_dir /home/user/projects /home/user . (PRECOMPILED HEADERS) ccache (PCH) GCC Clang . : 1. sloppiness pch_defines,time_macros o ccache PCH #define . o include_file_mtime,include_file_ctime ( HANDLING OF NEWLY CREATED SOURCE FILES ). 2. : o GCC/Clang: -include header ( #include ). o Clang: -include-pch PCH . o GCC: -fpch-preprocess . 3. Clang -fno-pch-timestamp . : o ccache ( ) . o "Preprocessing failed" . o #pragma once . Ccache C++20 . "Clang modules" ( -fmodules) : o sloppiness modules . o direct mode depend mode . : o Ccache module.modulemap Clang . o module.modulemap . (preprocessor mode) depend mode . Clang module.modulemap . (SHARING A LOCAL CACHE) (cache hit rate) . : o . o hard_link false ( ). o . o umask 002 . . o ( ). o setgid . . : find $CCACHE_DIR -type d | xargs chmod g+s (hard link mode) (timestamp) . . (relink) . (base directory) ..SH " NFS (SHARING A CACHE ON NFS)" NFS ( ) : o NFS . (benchmarking) . o ccache NFS . temporary_dir NFS . . include (cache hit) . sloppiness system_headers . NFS (remote storage file cache) . CCACHE (USING CCACHE WITH OTHER COMPILER WRAPPERS) ccache ( "distcc") ccache . prefix_command CCACHE_PREFIX ( distcc). ccache . prefix_command . compiler_check ( ) ccache anotherwrapper compiler args . (masquerading) . ccache mtime : o . o . prefix_command ccache (preprocessor) . ( -E) prefix_command_cpp . (CAVEATS) o (direct mode) . The direct mode . (TROUBLESHOOTING) (General) ccache debug true CCACHE_DEBUG=1 . CACHE DEBUGGING . ccache -s (miss reasons) . (Performance) ccache : o (SSD ). o RAM . o . ccache -s . "preprocessed cache hits" "direct cache hits" ccache . : o o include ( -I -include -D) o -Xpreprocessor -Wp,* ( -Wp,-MD, -Wp,-MMD, -Wp,-D) o base_dir o include ccache ( HANDLING OF NEWLY CREATED SOURCE FILES ) o __TIME__ __DATE__ __TIMESTAMP__ ( sloppiness time_macros ) o ( __FILE__ ) : o / / o o : o "Multiple source files": ( ccache ). o "Unsupported compiler option": . o "Preprocessing failed": ( PRECOMPILED HEADERS ). o "Could not use precompiled header": PRECOMPILED HEADERS . o "Could not use modules": C++ MODULES . ccache . . : ( ) prefix_command (compiler wrapper). : 1. (build tree) . 2. . 3. CCACHE_RECACHE . ccache -C . ccache . . (MORE INFORMATION) ccache : . (AUTHORS) ccache Andrew Tridgell Joel Rosdahl . AUTHORS.txt AUTHORS.html . Ccache 4.14 2026-09-04 CCACHE(1)