Linux command
sccache 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Start server
sccache --start-server
Show statistics
sccache --show-stats
Stop server
sccache --stop-server
Zero statistics
sccache --zero-stats
Use with cargo
RUSTC_WRAPPER=sccache cargo build
Use with cmake
cmake -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache [..]
Show advanced statistics
sccache --show-adv-stats
Show statistics in JSON
sccache --show-stats --stats-format json
说明
sccache is a compiler cache supporting C, C++, Rust, and other languages. It caches compilation results to speed up rebuilds. The server runs as a daemon, caching compilation outputs. Subsequent compilations with the same inputs return cached results instantly. Local caching stores results on disk. Cloud backends (S3, GCS, Redis, Azure) enable shared caching across machines and CI. Rust integration through RUSTC_WRAPPER caches rustc invocations. The cargo build system automatically uses the wrapper. C/C++ integration uses compiler launchers or wrapper scripts. CMake's launcher variables provide clean integration. Distributed compilation schedules work across multiple machines. This scales builds beyond single-machine parallelism.
参数
- --start-server
- Start the server daemon.
- --stop-server
- Stop the server.
- --show-stats
- Show cache statistics.
- --zero-stats
- Reset statistics.
- --show-adv-stats
- Show advanced statistics.
- --dist-auth _TOKEN_
- Authenticate to dist server.
- --dist-status
- Show distributed status.
- --stats-format _FMT_
- Set output format for statistics (text or json).
FAQ
What is the sccache command used for?
sccache is a compiler cache supporting C, C++, Rust, and other languages. It caches compilation results to speed up rebuilds. The server runs as a daemon, caching compilation outputs. Subsequent compilations with the same inputs return cached results instantly. Local caching stores results on disk. Cloud backends (S3, GCS, Redis, Azure) enable shared caching across machines and CI. Rust integration through RUSTC_WRAPPER caches rustc invocations. The cargo build system automatically uses the wrapper. C/C++ integration uses compiler launchers or wrapper scripts. CMake's launcher variables provide clean integration. Distributed compilation schedules work across multiple machines. This scales builds beyond single-machine parallelism.
How do I run a basic sccache example?
Run `sccache --start-server` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --start-server do in sccache?
Start the server daemon.