-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
error: FileNotFound
/error:Unexpected
when running zig build
on Windows, when zig project is on different filesystem than OS
#16374
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
Comments
This error also persists when using
|
Reference: |
Try outside of the w64devkit shell. Can't reproduce this locally. |
@squeek502
From what I am seeing, its failing at LLD Linking. |
What does (non-ASCII characters shouldn't be a problem but maybe there's been some regression involving that) |
On another note, I wasn't able to compile zig on both methods, (using existing zig installation & cmake/ninja), as they also can't find a file.
If possible, is someone able to provide a debug executable of Zig? |
you may be able to run zig using procmon to see which file it is trying to open |
Procmon Logs |
@RadsammyT here's a debug build you can try: https://www.ryanliptak.com/misc/zig-windows-x86_64-debug-0.11.0-dev.3892+0a6cd257b.zip |
@squeek502 Thanks for the build! Unfortunately the backtrace it provides isn't... helpful.
|
Ah, that's unfortunate. At least we know the unexpected status is Weird solution that I'm not sure will work, but maybe try cloning the zig repo (at commit 0a6cd25) into |
Nope, no dice on the solution either, but while messing around a bit I was able to somehow compile init-exe on
I have 3 internal drives on my machine, C: (Windows OS, NTFS), D: (NTFS), and E: (exFAT). My zig installation is installed on E: which also houses a programming directory I do some of my work on. Theres also a F: (FAT32) USB flash drive which also houses zig. I am able to compile zig code (same debug version from E:, and on init-exe template) on C: and D: , but not E: nor F: . |
Ah, thanks for the info. Definitely a filesystem related bug; I'm able to reproduce it with a FAT32 flash drive and the stack trace is even broken for me.
|
Actually, I was being dumb and used the wrong Zig. Here are the stack traces:
|
error: FileNotFound
/error:Unexpected
when running zig build
on Windowserror: FileNotFound
/error:Unexpected
when running zig build
on Windows, when zig is on different filesystem than OS
error: FileNotFound
/error:Unexpected
when running zig build
on Windows, when zig is on different filesystem than OSerror: FileNotFound
/error:Unexpected
when running zig build
on Windows, when zig project is on different filesystem than OS
This may be related: #16209 I consistently see these errors with a cleared cache. |
Nice, thank you. This is a contributer-friendly issue at this point, just need to add more switch cases and error codes to the respective locations. |
The bug here is that I think I found the problem for the initial Lines 1025 to 1030 in 32a1757
That TODO is the key here. On NTFS, if you give a path like So I think this little optimization needs to be removed, and instead we always need to check all the results of |
This fixes a regression caused by ziglang#13993 As an optimization, the first call to `NtQueryDirectoryFile` would only ask for a single result and assume that if the result returned did not match the app_name exactly, then the unappended app_name did not exist. However, this relied on the assumption that the unappended app_name would always be returned first, but that only seems to be the same on NTFS. On FAT filesystems, the order of returned files can be different, which meant that it could assume the unappended file doesn't exist when it actually does. This commit fixes that by fully iterating the wildcard matches via `NtQueryDirectoryFile` and taking note of any unappended/PATHEXT-appended filenames it finds. In practice, this strategy does not introduce a speed regression compared to the previous (buggy) implementation. Benchmark 1 (10 runs): winpathbench-master.exe measurement mean ± σ min … max outliers delta wall_time 508ms ± 4.08ms 502ms … 517ms 1 (10%) 0% peak_rss 3.62MB ± 2.76KB 3.62MB … 3.63MB 0 ( 0%) 0% Benchmark 2 (10 runs): winpathbench-fat32-fix.exe measurement mean ± σ min … max outliers delta wall_time 500ms ± 21.4ms 480ms … 535ms 0 ( 0%) - 1.5% ± 2.8% peak_rss 3.62MB ± 2.76KB 3.62MB … 3.63MB 0 ( 0%) - 0.0% ± 0.1% --- Partially addresses ziglang#16374 (it fixes `zig build` on FAT32 when no `zig-cache` is present)
This fixes a regression caused by ziglang#13993 As an optimization, the first call to `NtQueryDirectoryFile` would only ask for a single result and assume that if the result returned did not match the app_name exactly, then the unappended app_name did not exist. However, this relied on the assumption that the unappended app_name would always be returned first, but that only seems to be the case on NTFS. On FAT filesystems, the order of returned files can be different, which meant that it could assume the unappended file doesn't exist when it actually does. This commit fixes that by fully iterating the wildcard matches via `NtQueryDirectoryFile` and taking note of any unappended/PATHEXT-appended filenames it finds. In practice, this strategy does not introduce a speed regression compared to the previous (buggy) implementation. Benchmark 1 (10 runs): winpathbench-master.exe measurement mean ± σ min … max outliers delta wall_time 508ms ± 4.08ms 502ms … 517ms 1 (10%) 0% peak_rss 3.62MB ± 2.76KB 3.62MB … 3.63MB 0 ( 0%) 0% Benchmark 2 (10 runs): winpathbench-fat32-fix.exe measurement mean ± σ min … max outliers delta wall_time 500ms ± 21.4ms 480ms … 535ms 0 ( 0%) - 1.5% ± 2.8% peak_rss 3.62MB ± 2.76KB 3.62MB … 3.63MB 0 ( 0%) - 0.0% ± 0.1% --- Partially addresses ziglang#16374 (it fixes `zig build` on FAT32 when no `zig-cache` is present)
Partially addresses ziglang#16374
This fixes a regression caused by #13993 As an optimization, the first call to `NtQueryDirectoryFile` would only ask for a single result and assume that if the result returned did not match the app_name exactly, then the unappended app_name did not exist. However, this relied on the assumption that the unappended app_name would always be returned first, but that only seems to be the case on NTFS. On FAT filesystems, the order of returned files can be different, which meant that it could assume the unappended file doesn't exist when it actually does. This commit fixes that by fully iterating the wildcard matches via `NtQueryDirectoryFile` and taking note of any unappended/PATHEXT-appended filenames it finds. In practice, this strategy does not introduce a speed regression compared to the previous (buggy) implementation. Benchmark 1 (10 runs): winpathbench-master.exe measurement mean ± σ min … max outliers delta wall_time 508ms ± 4.08ms 502ms … 517ms 1 (10%) 0% peak_rss 3.62MB ± 2.76KB 3.62MB … 3.63MB 0 ( 0%) 0% Benchmark 2 (10 runs): winpathbench-fat32-fix.exe measurement mean ± σ min … max outliers delta wall_time 500ms ± 21.4ms 480ms … 535ms 0 ( 0%) - 1.5% ± 2.8% peak_rss 3.62MB ± 2.76KB 3.62MB … 3.63MB 0 ( 0%) - 0.0% ± 0.1% --- Partially addresses #16374 (it fixes `zig build` on FAT32 when no `zig-cache` is present)
This can now be closed. |
Zig Version
0.11.0-dev.3949+27a66191c
Steps to Reproduce and Observed Behavior
OS Name: Microsoft Windows 10 Home
Version: 10.0.19045 Build 19045
Arch: x86_64
Using skeeto/w64devkit shell with zig set in its PATH, using Zig w/ Command Prompt/Powershell does not make a difference.
Using 0.10.1 will compile its respective init-exe template correctly for me.
on the above listed version and on
dev.3947+89396ff02
, I get a simpleerror: FileNotFound
when runningzig build
for the first time and future builds (where zig-cache is present) returnerror: Unexpected
, even on a freshly created init-exe project.log
However, doing
zig build-exe src/main.zig
successfully compiles it.To reproduce
I have 3 internal drives on my machine, C: (Windows OS, NTFS), D: (NTFS), and E: (exFAT). My zig installation is installed on E: which also houses a programming directory I do some of my work on. Theres also a F: (FAT32) USB flash drive which also houses zig. I am able to compile zig code on a init-exe template on C: and D: , but not E: nor F:.
One might be able to reproduce this bug by compiling a zig project on a different filesystem than the FS the OS was installed on.
Expected Behavior
zig build
should compile just fine.The text was updated successfully, but these errors were encountered: