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

CARGO_TARGET_DIR spreads out files in many directories #14310

Closed
soloturn opened this issue Jul 26, 2024 · 1 comment
Closed

CARGO_TARGET_DIR spreads out files in many directories #14310

soloturn opened this issue Jul 26, 2024 · 1 comment
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

when compiling COSMIC desktop the build is very slow, as it compiles components again. cargo distributes files into a number of directories, despite setting CARGO_TARGET_DIR, and it creates an impressive number of files, just for sendfd/lib.rs :

❯ find . | grep sendfd
./tmp/mytarget/release/.fingerprint/sendfd-5d7732d47158403b
./tmp/mytarget/release/.fingerprint/sendfd-5d7732d47158403b/lib-sendfd.json
./tmp/mytarget/release/.fingerprint/sendfd-5d7732d47158403b/invoked.timestamp
./tmp/mytarget/release/.fingerprint/sendfd-5d7732d47158403b/dep-lib-sendfd
./tmp/mytarget/release/.fingerprint/sendfd-5d7732d47158403b/lib-sendfd
./tmp/mytarget/release/deps/sendfd-5d7732d47158403b.d
./tmp/mytarget/release/deps/libsendfd-5d7732d47158403b.rmeta
./tmp/mytarget/release/deps/libsendfd-5d7732d47158403b.rlib
./.cache/yay/cosmic-comp-git/src/cosmic-comp/vendor/sendfd
./.cache/yay/cosmic-comp-git/src/cosmic-comp/vendor/sendfd/LICENSE-BSD
./.cache/yay/cosmic-comp-git/src/cosmic-comp/vendor/sendfd/.cargo-checksum.json
./.cache/yay/cosmic-comp-git/src/cosmic-comp/vendor/sendfd/README.mkd
./.cache/yay/cosmic-comp-git/src/cosmic-comp/vendor/sendfd/Cargo.toml
./.cache/yay/cosmic-comp-git/src/cosmic-comp/vendor/sendfd/src
./.cache/yay/cosmic-comp-git/src/cosmic-comp/vendor/sendfd/src/lib.rs
./.cache/yay/cosmic-comp-git/src/cosmic-comp/vendor/sendfd/src/changelog.rs
./.cache/yay/cosmic-comp-git/src/cosmic-comp/vendor/sendfd/LICENSE-APACHE
./.cargo/registry/cache/index.crates.io-6f17d22bba15001f/sendfd-0.4.3.crate
./.cargo/registry/index/index.crates.io-6f17d22bba15001f/.cache/se/nd/sendfd
./.cargo/registry/src/index.crates.io-6f17d22bba15001f/sendfd-0.4.3
./.cargo/registry/src/index.crates.io-6f17d22bba15001f/sendfd-0.4.3/LICENSE-BSD
./.cargo/registry/src/index.crates.io-6f17d22bba15001f/sendfd-0.4.3/.github
./.cargo/registry/src/index.crates.io-6f17d22bba15001f/sendfd-0.4.3/.github/dependabot.yml
./.cargo/registry/src/index.crates.io-6f17d22bba15001f/sendfd-0.4.3/.github/workflows
./.cargo/registry/src/index.crates.io-6f17d22bba15001f/sendfd-0.4.3/.github/workflows/sendfd.yml
./.cargo/registry/src/index.crates.io-6f17d22bba15001f/sendfd-0.4.3/Cargo.toml.orig
./.cargo/registry/src/index.crates.io-6f17d22bba15001f/sendfd-0.4.3/README.mkd
./.cargo/registry/src/index.crates.io-6f17d22bba15001f/sendfd-0.4.3/.cargo_vcs_info.json
./.cargo/registry/src/index.crates.io-6f17d22bba15001f/sendfd-0.4.3/Cargo.toml
./.cargo/registry/src/index.crates.io-6f17d22bba15001f/sendfd-0.4.3/.cargo-ok
./.cargo/registry/src/index.crates.io-6f17d22bba15001f/sendfd-0.4.3/.gitignore
./.cargo/registry/src/index.crates.io-6f17d22bba15001f/sendfd-0.4.3/src
./.cargo/registry/src/index.crates.io-6f17d22bba15001f/sendfd-0.4.3/src/lib.rs
./.cargo/registry/src/index.crates.io-6f17d22bba15001f/sendfd-0.4.3/src/changelog.rs
./.cargo/registry/src/index.crates.io-6f17d22bba15001f/sendfd-0.4.3/LICENSE-APACHE
 

i would have expected AlL files end up in ./tmp/mytarget, and compile results will be reused when compiling next component. it is not so. what am i missing?

Steps

No response

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

Cargo has two many locations it operates with

The global cache is what lets us not re-download dependencies again and again (see #14278).

We could reuse intermediate build artifacts between projects but its rare and we need more bookkeeping to handle this. See #5931

As this is expected behavior, I'm going to go ahead and close. If there is a reason we need to keep this open, let us know!

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2024
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