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.
Problem
SCCACHE_BASEDIRSwas 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
--externand-Lflags.CARGO_HOMEaround, the path will change. See Moving CARGO_HOME invalidates target caches rust-lang/cargo#10915RUSTLINKFLAGS, while one of the most common absolute path pattern in rustflags are linker flags. See add a RUSTLINKFLAGS environment variable rust-lang/cargo#4349.-Ztrim-pathsmight be a way to partially fix this (as part of fixing the artifaict content hash), but that would also introduce more--remap-path-prefix=…, which will contain more aboslute paths. (See Tracking Issue for trim-paths RFC 3127 rust-lang/cargo#12137)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_BASEDIRSonly 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-mapin C compiler and--remap-path-prefixin rustc.