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

build: probabilistic inconsistent cache state on MacOS #19715

Closed
mitiko opened this issue Apr 20, 2024 · 4 comments
Closed

build: probabilistic inconsistent cache state on MacOS #19715

mitiko opened this issue Apr 20, 2024 · 4 comments
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@mitiko
Copy link

mitiko commented Apr 20, 2024

Zig Version

0.13.0-dev.3+dddddcffd

OS: macOS 14.4.1

Steps to Reproduce and Observed Behavior

zig init
zig build

On an empty project the build errors out with a message like:

install
└─ install harley
   └─ zig build-lib harley Debug native 1 errors
error: failed to rename compilation results ('/Users/mitiko/Documents/Compression/harley/zig-cache/tmp/5d25342d02e7feb3') into local cache ('/Users/mitiko/Documents/Compression/harley/zig-cache/o/ce78af496c76221b67d202951678cae3'): Unexpected
error: the following command failed with 1 compilation errors:
/Users/mitiko/.zvm/master/zig build-lib -ODebug -Mroot=/Users/mitiko/Documents/Compression/harley/src/root.zig --cache-dir /Users/mitiko/Documents/Compression/harley/zig-cache --global-cache-dir /Users/mitiko/.cache/zig --name harley -static --listen=- 
install
└─ install harley
   └─ zig build-exe harley Debug native 1 errors
error: failed to rename compilation results ('/Users/mitiko/Documents/Compression/harley/zig-cache/tmp/a7d9ffbd9621177d') into local cache ('/Users/mitiko/Documents/Compression/harley/zig-cache/o/7c66ffb5a3e7200bb814453bc8eb7e62'): Unexpected
error: the following command failed with 1 compilation errors:
/Users/mitiko/.zvm/master/zig build-exe -ODebug -Mroot=/Users/mitiko/Documents/Compression/harley/src/main.zig --cache-dir /Users/mitiko/Documents/Compression/harley/zig-cache --global-cache-dir /Users/mitiko/.cache/zig --name harley --listen=- 
Build Summary: 0/5 steps succeeded; 2 failed (disable with --summary none)
install transitive failure
├─ install harley transitive failure
│  └─ zig build-lib harley Debug native 1 errors
└─ install harley transitive failure
   └─ zig build-exe harley Debug native 1 errors
error: the following build command failed with exit code 1:
/Users/mitiko/Documents/Compression/harley/zig-cache/o/b9b7eb2041cc09bf2d5b9e45691c6ffe/build /Users/mitiko/.zvm/master/zig /Users/mitiko/Documents/Compression/harley /Users/mitiko/Documents/Compression/harley/zig-cache /Users/mitiko/.cache/zig --seed 0xccce38c2 -Zf2790a3be8ae49c3

Sometimes it fails to build just the library, sometimes it fails on both the library and the executable. Clearing the cache with rm -rf zig-cache zig-out and rebuilding sometimes succeeds though.

Subsequent zig build and zig build run will give me (even after a successful initial build):

error: Unexpected

Related issues:

These seem to be targeting Windows only, so I chose to open a new issue instead.

Expected Behavior

I expect the build to pass on an empty project.

@mitiko mitiko added the bug Observed behavior contradicts documented or intended behavior label Apr 20, 2024
@ben-laird
Copy link

Is there a chance this could be related to #17342, or even what causes the behavior of that issue? I made it a while back and thought it was related to the cache, maybe look at it and see if that helps.

@mitiko
Copy link
Author

mitiko commented Apr 21, 2024

Oh, wow, that's most likely it. I was never able to reproduce this in /tmp/repro, and the only difference is I'm not backing up /tmp to iCloud.
I am wondering if there's a better way to exclude folders from being backed up, instead of suffixing with .nosync.

@ben-laird
Copy link

If you want your Zig projects in iCloud, I don't think there's a better way currently. My own workaround has been not uploading them to iCloud and instead using a completely local directory that iCloud doesn't touch (~/dev/), and Zig has worked completely fine there since there isn't a remote resource it has to use.

Maybe this is also connected to Zig's async/await development, but I'm not sure. Hopefully the completely local directory workaround helps!

@mitiko
Copy link
Author

mitiko commented Apr 22, 2024

Yeah, thanks! I went local as well and haven't had problems since.
I'll go ahead and close this one as it doesn't seem like a problem solvable by the compiler?
That said, I've never had similar issues with Rust, maybe the caching system there never does moves?

@mitiko mitiko closed this as completed Apr 22, 2024
@mitiko mitiko closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

2 participants