Es una caché del compilador para la recompilación rápida de código C/C++/Rust. Acelera la recompilación al almacenar en caché compilaciones anteriores y detectar cuándo se está realizando la misma compilación del mismo código con los mismo parámetros..
$ sccache gcc -c main.c -o main.o
$ sccache g++ -std=c++17 -O2 main.cpp -o main
$ sccache rustc main.rs
$ sccache --show-stats
$ sccache --start-server
$ sccache --stop-server
$ rm -rf ~/.cache/sccache
$ sccache --show-adv-stats
$ sccache --show-stats | grep "Cache location"
Para proyectos es preferible configurar variables de entorno. Configurar sccache como compilador de C y C++
$ export CC="sccache gcc"
$ export CXX="sccache g++"
O con clang
$ export CC="sccache clang"
$ export CXX="sccache clang++"
Para Rust
$ export RUSTC_WRAPPER=sccache
Luego cuando se compila normalmente sccache actúa en segundo plano
$ make
$ cargo build
Con Make sin modificar el Makefile
$ make CC="sccache gcc" CXX="sccache g++" -j$
1.-
Configurar para un proyecto C/C++
$ cd mi-proyecto
$ export CC="sccache gcc"
$ export CXX="sccache g++"
$ time make -j$(nproc)
$ make clean
$ time make -j$(nproc)