Since macos sequoia 15.*, incremental cargo build --all-targets randomly fails for me in a workspace with the following error:
error: failed to create dependency graph at
/.../target/debug/incremental/test_xzz-.../.../dep-graph.part.bin:
No such file or directory (os error 2)
I can see the file being referred to as STAGING_DEP_GRAPH_FILENAME in rust/compiler/rustc_incremental/src/persist/fs.rs.
Has anyone seen this before?
Observed behavior:
Whether the error appears or not seems to be random, more often if more crates have changes. I could not yet identify a pattern how to force it to reproduce.
What crate the error appears on seems to be random as well.
Often the problem is resolved by running the build again a few times, but sometimes many new attempts are required. When it happened again today I gave up after 10 attempts and did a cargo clean.
cargo clean always resolves the problem, but is of course expensive
Operating System:
I've only seen the error on macos since upgrading to Sequoia 15.0 (also 15.1), never on 14.*.
Never seen the error on Linux nor on Windows (same repo/workspace).
Machine:
I only have access to multiple different M2 macs, all of them are affected the same way.
Rust:
stable-aarch64-apple-darwin 1.82.0 (f6e511eec 2024-10-15), but was also a problem with 1.81 and I believe also earlier versions - the issue appeared with upgrading macos, not upgrading rust (but could be accidental/anecdotal)
rm -r target/debug/incremental may be enough to get it working again. This only removes the incr comp cache and doesn't cause any unchanged crates to be built again.
No, unfortunately not. I wanted to investigate a bit more myself first before opening an issue.
But while I used to have this problem sometimes even multiple times per day (the work around of deleting the incremental folder worked reliably, thank you!), I could not reproduce it anymore over the last weeks. Like when it started, unfortunately again I can't provably isolate a single cause of what made it stop (or whether I'm just lucky so far).
I do not run any extra anti-virus/anti-malware software myself, but have all the macOS built-in mechanism enabled, some of which behave similarly. It is indeed possible that the update to macOS 15.2 (24C101) mid December was the reason I can no longer reproduce, which may have included some fixes in this area.