mozilla / mozilla/sccache

Wire SCCACHE_BASEDIRS into Rust hash key

Open
#2,652 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
7.7k
Forks
748
Avg merge
4d 7h
Merged PRs (30d)
21

Description

Problem

SCCACHE_BASEDIRS was done by https://github.com/mozilla/sccache/pull/2521. Pretty impressive!

However, that only deals with C compiler. Rust compiler wasn't covered.

In Rust, the most popular build tool Cargo by default using absolute paths everywhere. Such as

I think at least we need to implement a basic support to eliminate some of the most common absolute paths from the cache key, like --remap-path-prefix=/abs/path, -Clinker=/abs/path, -Clin-arge=something,/abs/path, and others.

Drawback

SCCACHE_BASEDIRS only normalize paths for cache keys not the real compiler invocations. That means embedded path in binaries are shared across different build root.

This might be a user problem, as they can fix it via prefix-map flag, like -fdebug-prefix-map, -ffile-prefix-map, -fmacro-prefix-map in C compiler and --remap-path-prefix in rustc.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing SCCACHE_BASEDIRS path normalization used for C compiler cache keys, then inspect how Rust compiler arguments are represented and hashed. Add focused coverage for the listed Rust path forms; done means those paths normalize in cache keys while the actual compiler invocation remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.