#[solved] `std.fs.cwd()` not known at comptime (fails on Windows, works on linux)

1 messages · Page 1 of 1 (latest)

upbeat compass
#
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
#

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? 🤔

tepid jetty
hallow scarab
#

or you can just not have a default field value

#

the caller can just do std.fs.cwd() when creating the struct

upbeat compass
#

F no

#

the point of that is having sane defaults