-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
"error: Unexpected" when zig-cache is present, compiles otherwise. #19973
Comments
What platform (OS, arch) does this occur on? |
It happens regardless of source code, I deleted everything and just left I spammed the run command a bit in frustration and now it's consistently crashing outright 🥲
After this I decided to delete the global cache and it went back to this:
After also deleting the local cache it turned to this (for a brief moment):
It's completely unpredictable. |
are you sync'ing folder(s) to iCloud? |
Yes... |
zig's caching logic makes extensive use of filesystem features wrt locking, moving/renaming, and it seems sync'd folders behave differently under such pressing conditions. As an aside, I once tried sharing a filesystem from one mac to another, and running zig's cache off that, and it was a disaster mainly due to the impl of filesystem sharing. But that's no surprise, remote filesystems are mostly terrible when it comes to locking and atomic'y operations. This comment suggests renaming the folder or parent folder to |
Moved it to a normal folder, deleted both caches, rebooted mac and it still kept crashing, probably for a different reason though Thankfully I kept the older zig version |
Also getting an error (removing zig-cache/ fixes the issue):
The build.zig only fails if I enable:
|
@rohlem thanks a lot, this indeed resolves my issue. Sorry for misidentifying the actual issue. |
@pierrec close? |
@rofrol I did not create this issue, but it looked really really close to mine. |
I'm also getting the issue @TeamPuzel is experiencing with 0.12.0, macOS Sonoma 14.4.1. Exact same error messages and cause from the cache, either |
After some more testing, I've ascertained that the error occurs after some amount of time in between builds, and |
I turned off syncing with iCloud as @mikdusan recommended, and the bug was fixed. I do agree with @TeamPuzel that this error is unusual, but I was annoyed with iCloud as well first my own reasons, so this just gave me an excuse to turn it off. |
For those who are having this issue with iCloud, it's sufficient to add the suffix ".nosync" to the name of a directory to exclude it from iCloud sync. |
Closing as invalid since it seems other software was making edits to the zig-cache folder. |
We could add a flag that trades performance for being more resistant to external edits. |
Seems like an odd reason, the first time I ran into this issue was running a project that was untouched for months, what edits would iCloud be doing? Doesn't seem likely. |
Sorry, as it stands this issue is not actionable enough to remain open. |
This is a duplicate of #17342 which has the relevant details (see #17342 (comment) and below). |
Zig Version
0.13.0-dev.211+6a65561e3
Steps to Reproduce and Observed Behavior
I'm trying to compile a zig program initially written with zig 0.12, and after fixing some errors where the standard library api changed it still didn't compile, with no other information but
error: Unexpected
. I deleted the zig-cache and it compiled, however in doing so it created zig-cache again and the issue returned.To see if it would help I updated my zig to the version above from an earlier 0.13 build, however that did not fix the issue and only got worse.
Expected Behavior
I expected my code to compile regardless of zig-cache being present.
The text was updated successfully, but these errors were encountered: