zig icon indicating copy to clipboard operation
zig copied to clipboard

Zig cannot compile on Windows filesystem in WSL

Open Daimanta opened this issue 4 months ago • 4 comments

Zig Version

0.15.1

Steps to Reproduce and Observed Behavior

I am in the process of upgrading my projects from Zig 0.14 to Zig 0.15.1. I normally use WSL for compiling Linux based applications. During the upgrade I found out that, when using the Windows filesystem virtualization layer (everything provided under /mnt/[driveletter]), compilation will fail in all circumstances with an error similar to

error: failed to rename compilation results ('.zig-cache/tmp/32178becae17858e') into local cache ('.zig-cache/o/a44e453d175df7691523b6f5aead7548'): AccessDenied

This is easy to reproduce

  1. Run zig init on WSL on a windows file system (as specified above)
  2. Run zig build, the build will always fail with a rename failure

Note that when running on a "Linux filesystem", compilation succeeds as normal.

Expected Behavior

This behaviour fully works in Zig 0.14 and below as I have been using this for a couple of years already. Therefore, zig build should compile a compilable program on WSL with a Windows filesystem

Daimanta avatar Aug 22 '25 17:08 Daimanta

im have the same issue. my projects are in the windows file system but i use WSL to edit files and compile before upgrading i had no problems with this workflow

Hotschmoe avatar Sep 08 '25 18:09 Hotschmoe

Duplicate of https://github.com/ziglang/zig/issues/24586

jeffective avatar Sep 08 '25 19:09 jeffective

I have added a re-open request on the linked issue

Daimanta avatar Sep 24 '25 11:09 Daimanta

There is currently a workaround by using the --cache-dir with a directory that is on the WSL side

PastMoments avatar Nov 03 '25 01:11 PastMoments