Skip to content

Wire SCCACHE_BASEDIRS into Rust hash key #2652

@weihanglo

Description

@weihanglo

Problem

SCCACHE_BASEDIRS was done by #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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions