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

Cache libstd artifacts between projects #84

Open
jyn514 opened this issue May 2, 2023 · 6 comments
Open

Cache libstd artifacts between projects #84

jyn514 opened this issue May 2, 2023 · 6 comments
Labels
plan before stabilization This needs a plan for how to address before stabilization, but does not need to be implemented. S-needs-design Status: needs design work

Comments

@jyn514
Copy link
Member

jyn514 commented May 2, 2023

Right now, cargo rebuilds std for each target directory:

; cargo build -Z build-std --target x86_64-unknown-linux-gnu
   Compiling compiler_builtins v0.1.91
   Compiling core v0.0.0 (/home/jyn/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
...
   Compiling inner v0.1.0 (/home/jyn/src/example/inner)
    Finished dev [unoptimized + debuginfo] target(s) in 8.43s
; cd ..
; c b -Z build-std --target x86_64-unknown-linux-gnu
   Compiling compiler_builtins v0.1.91
   Compiling core v0.0.0 (/home/jyn/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
...
   Compiling inner v0.1.0 (/home/jyn/src/example/inner)
   Compiling example v0.1.0 (/home/jyn/src/example)
    Finished dev [unoptimized + debuginfo] target(s) in 8.63s

It would be nice to cache this (in CARGO_HOME/.cargo?) so that it's not duplicated. This should follow all of cargo's normal caching rules, so e.g. changing RUSTFLAGS or profile.dev.debug would rebuild.

@jyn514
Copy link
Member Author

jyn514 commented May 3, 2023

@rustbot claim

@rustbot
Copy link

rustbot commented May 3, 2023

Error: This repository is not enabled to use triagebot.
Add a triagebot.toml in the root of the default branch to enable it.

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

@ehuss
Copy link
Contributor

ehuss commented May 3, 2023

I just want to warn you that this is a huge change that has some history (not to dissuade you, just to clarify what it means). There's an overview of the tasks at rust-lang/cargo#11429 (comment). Each one is quite large and needs some design work.

@Lokathor
Copy link

Lokathor commented May 3, 2023

I hope this doesn't clog up my $user/.cargo directory with a bunch of junk. That is on my rather small C drive, compared to my larger D drive where my rust projects live.

I update nightly more often than I start new cross-build projects, so I don't want the libstd of a bunch of nightly versions hanging out in my C drive.

So hopefully this will include something to make it be cleaned by cargo clean or cleaned by rustup update or just be something that can be turned off entirely.

@ehuss ehuss added plan before stabilization This needs a plan for how to address before stabilization, but does not need to be implemented. S-needs-design Status: needs design work labels May 3, 2023
@jyn514
Copy link
Member Author

jyn514 commented May 4, 2023

Hmm, good point, I hadn't thought about how the cache would grow without bound.

So I don't lose it, my work so far is https://github.com/rust-lang/cargo/compare/master...jyn514:cargo:build-std-cache?expand=1

@Lokathor
Copy link

Lokathor commented May 4, 2023

This is marked "plan before stabilization", but I don't think it should be a stabilization blocker.

It would be nice to have, but caching stuff more often seems like a quality of implementation detail, not an essential part of build-std.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plan before stabilization This needs a plan for how to address before stabilization, but does not need to be implemented. S-needs-design Status: needs design work
Projects
None yet
Development

No branches or pull requests

4 participants