bin\.zig\lib\std\os\windows.zig:2192:13: error: unable to evaluate comptime expression
asm (
^~~
bin\.zig\lib\std\os\windows.zig:2201:15: note: called at comptime from here
return teb().ProcessEnvironmentBlock;
~~~^~
bin\.zig\lib\std\fs.zig:222:36: note: called at comptime from here
return .{ .fd = windows.peb().ProcessParameters.CurrentDirectory.Handle };
~~~~~~~~~~~^~
C:\Users\sk\AppData\Local\zig\p\zstd-0.0.27-JB9i946rAgCYwbIsdp-u8i8-DYeVdT7RdfAjImyq2RlM\src\zstd\paths\paths.zig:31:31: note: called at comptime from here
dir :zstd.Dir= std.fs.cwd(),
~~~~~~~~~~^~
C:\Users\sk\AppData\Local\zig\p\zstd-0.0.27-JB9i946rAgCYwbIsdp-u8i8-DYeVdT7RdfAjImyq2RlM\src\zstd\paths\paths.zig:31:31: note: struct field default value must be comptime-known
referenced by:
exists: C:\Users\sk\AppData\Local\zig\p\zstd-0.0.27-JB9i946rAgCYwbIsdp-u8i8-DYeVdT7RdfAjImyq2RlM\src\zstd\paths\paths.zig:30:39
exists: C:\Users\sk\AppData\Local\zig\p\zstd-0.0.27-JB9i946rAgCYwbIsdp-u8i8-DYeVdT7RdfAjImyq2RlM\src\zstd\paths\files.zig:108:29
8 reference(s) hidden; use '-freference-trace=10' to see all references
error: the following command failed with 1 compilation errors:
"D:\\gd\\confy\\bin\\.zig\\zig.exe" build-exe -ODebug --dep confy --dep zstd "-Mroot=D:\\gd\\confy\\src\\confy\\caller.zig" -ODebug --dep zstd "-Mconfy=D:\\gd\\confy\\src\\confy.zig" -ODebug "-Mzstd=C:\\Users\\sk\\AppData\\Local\\zig\\p\\zstd-0.0.27-JB9i946rAgCYwbIsdp-u8i8-DYeVdT7RdfAjImyq2RlM\\src\\zstd.zig" --cache-dir .zig-cache --global-cache-dir "C:\\Users\\sk\\AppData\\Local\\zig" --name confy --zig-lib-dir "bin\\.zig\\lib\\" --listen=-
Build Summary: 0/3 steps succeeded; 1 failed
install transitive failure
└─ install confy transitive failure
└─ compile exe confy Debug native 1 errors
#[solved] `std.fs.cwd()` not known at comptime (fails on Windows, works on linux)
1 messages · Page 1 of 1 (latest)
I'm trying to compile my application on Windows
(first time ever compiling on windows, I'm a Linux-main dev)
and I'm getting this comptime error, but this code worked perfectly on Linux so far 🤔
Context: In case it is needed, here is the source code where the error is triggering
Any ideas on why this is happening, and how to approach solving it? 🤔
it's beacuse std.fs.cwd() can be determined at comptime on linux, but not on windows. default values for struct fields must be known at comptime. to fix it, you could do dir: ?zstd.Dir = null and then do arg.dir orelse std.fs.cwd()