mozilla /sccache
Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible. Sccache has the capability to utilize caching in remote storage environments, including various cloud storage options, or alternatively, in local storage.
★ 7,869⑂ 792👁 59⑃ 1,667● 997▤ 59
7,869
stars
+0+3+101
792
forks
59
watchers
1,667
prs
997
issues
59
releases
–
discussions
README
!Crates.io
sccache - Shared Compilation Cache
==================================
sccache is a ccache-like compiler caching tool. It is used as a compiler wrapper and avoids compilation when possible, storing cached results either on local disk or in one of several cloud storage backends. Multi-level caching with automatic backfill is supported for hierarchical cache architectures (see Multi-Level Cache).
sccache includes support for caching the compilation of Assembler, C/C++ code, Rust, as well as NVIDIA's CUDA using nvcc, and clang, AMD's ROCm HIP.
sccache also provides icecream-style distributed compilation (automatic packaging of local toolchains) for all supported compilers (including Rust). The distributed compilation system includes several security features that icecream lacks such as authentication, transport layer encryption, and sandboxed compiler execution on build servers. See the distributed quickstart guide for more information.
sccache is also available as a GitHub Actions to facilitate the deployment using GitHub Actions cache.
---
Table of Contents (ToC)
=======================
Installation
Usage
Build Requirements
Build
Profile-guided optimization
Separating caches between invocations
Overwriting the cache
Debugging
Interaction with GNU make jobserver
Known Caveats
Storage Options
Multi-Level (Hierarchical Caching)
Local
S3
R2
Redis
Memcached
Google Cloud Storage
Azure
GitHub Actions
WebDAV (Ccache/Bazel/Gradle compatible)
Alibaba OSS
Tencent Cloud Object Storage
---
Installation
There are prebuilt x86-64 binaries available for Windows, Linux (a portable binary compiled against musl), and macOS on the releases page. Several package managers also include sccache packages, you can install the latest release from source using cargo, or build directly from a source checkout.
macOS
On macOS sccache can be installed via Homebrew:
bash
brew install sccache
or via MacPorts:
bash
sudo port install sccache
Windows
On Windows, sccache can be installed via scoop:
scoop install sccache
or winget:
winget install Mozilla.sccache
Via cargo
If you have a Rust toolchain installed you can install sccache using cargo. Note that this will compile sccache from source which is fairly resource-intensive. For CI purposes you should use prebuilt binary packages.
bash
cargo install sccache --locked
Or, using cargo-binstall to install a prebuilt binary:
bash
cargo binstall sccache
With Nix
Sccache is available in nixpkgs, so if you don't need the latest version you can use that:
nix
buildInputs = [ pkgs.sccache ];
We also provide a flake with an overlay for getting the latest version:
nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
sccache = {
url = "github:mozilla/sccache";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, sccache, ... }:
let
system = "x86_64-linux";
pkgs =