Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCCACHE not caches same crate for different component #14313

Closed
soloturn opened this issue Jul 26, 2024 · 3 comments
Closed

SCCACHE not caches same crate for different component #14313

soloturn opened this issue Jul 26, 2024 · 3 comments
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@soloturn
Copy link
Contributor

soloturn commented Jul 26, 2024

Problem

am using

 CARGO_TARGET_DIR=/tmp/mytarget  RUSTC_WRAPPER=sccache cargo ... 

for 2 components, on linux. the cache works quite well when compiling a component again. but when compiling the second component it fails. both comonents have approximately 600 crates, most of them same version. so download into CARGO_HOME is done only one time for 95% of the crates. compile is 2 times 600, 100% cache miss.

Steps

❯ rm -rf ~/.cargo/
❯ rm -rf ~/.cache/sccache/
❯ git clone --filter=blob:none git@github.com:pop-os/cosmic-comp.git
❯ git clone --filter=blob:none git@github.com:pop-os/cosmic-session.git
❯ cd cosmic-comp
❯ RUSTUP_TOOLCHAIN=stable RUSTFLAGS="-C link-arg=-fuse-ld=mold" CARGO_TARGET_DIR=/tmp/mytarget RUSTC_WRAPPER=sccache cargo vendor 
  Downloaded 628 crates (108.5 MB) in 2m 14s (largest was `windows` at 11.8 MB)
❯ RUSTUP_TOOLCHAIN=stable RUSTFLAGS="-C link-arg=-fuse-ld=mold" CARGO_TARGET_DIR=/tmp/mytarget RUSTC_WRAPPER=sccache cargo build --release --frozen --offline

❯ rm -rf /tmp/mytarget
❯ RUSTUP_TOOLCHAIN=stable RUSTFLAGS="-C link-arg=-fuse-ld=mold" CARGO_TARGET_DIR=/tmp/mytarget RUSTC_WRAPPER=sccache cargo build --release --frozen --offline

❯ sccache --show-stats
Compile requests                   1138
Compile requests executed           892
Cache hits                          405
Cache hits (Rust)                   405
Cache misses                        477


❯ cd cosmic-session
❯ RUSTUP_TOOLCHAIN=stable RUSTFLAGS="-C link-arg=-fuse-ld=mold" CARGO_TARGET_DIR=/tmp/mytarget RUSTC_WRAPPER=sccache cargo vendor 
  Downloaded 100 crates (12.0 MB) in 13.63s
❯ RUSTUP_TOOLCHAIN=stable RUSTFLAGS="-C link-arg=-fuse-ld=mold" CARGO_TARGET_DIR=/tmp/mytarget RUSTC_WRAPPER=sccache cargo build --release --frozen --offline
    Building [============>            ] 104/189: rustix, futures-util, tracing-subscriber, tokio                                                                                                                                           

during compile one can check the cache state
``
❯ sccache --show-stats
Compile requests 86
Compile requests executed 51
Cache hits 0
Cache misses 45
Cache misses (Rust) 45



### Possible Solution(s)

_No response_

### Notes

_No response_

### Version

_No response_
@soloturn soloturn added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Jul 26, 2024
@epage
Copy link
Contributor

epage commented Jul 26, 2024

As expressed in other threads, this is not a Cargo bug or feature request but a support request for a third-party tool, sccache.

Please either reach out to sccache through their means or the wider Rust community at https://users.rust-lang.org/

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2024
@soloturn
Copy link
Contributor Author

this is a cargo flag, would be strange if this would not be in cargo then.

@epage
Copy link
Contributor

epage commented Jul 26, 2024

Its a cargo flag that allows you to plug third-party programs into Cargo. What those third-party programs do is not up to Cargo which is the intent of a flag like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants