I am trying to use Zig on a Windows 10 virtual machine, and I get rather mystifying error when zig running a hello world:
In file included from zig\lib\libc\mingw\lib-common\ntdll.def.in:1:
In file included from zig\lib\libc\mingw\lib-common\ntdll.def.in:1:
In file included from zig\lib\libc\mingw\lib-common\ntdll.def.in:1:
In file included from zig\lib\libc\mingw\lib-common\ntdll.def.in:1:
In file included from zig\lib\libc\mingw\lib-common\ntdll.def.in:1:
In file included from zig\lib\libc\mingw\lib-common\ntdll.def.in:1:
In file included from zig\lib\libc\mingw\lib-common\ntdll.def.in:1:
In file included from zig\lib\libc\mingw\lib-common\ntdll.def.in:1:
In file included from zig\lib\libc\mingw\lib-common\ntdll.def.in:1:
In file included from zig\lib\libc\mingw\lib-common\ntdll.def.in:1:
zig\lib\libc\mingw\lib-common\ntdll.def.in:1:10: error: #include nested too deeply
#include "func.def.in"
(and that seems to happen for a bunch of different dlls)
Anyone saw something similar? Any way to fix/debug this further?
have you tried with a more recent version of the compiler ? If I remember correctly from reading issues on github, the embedded C compiler can be flaky with header file parsing, so maybe that’s related, sorry to not answer your question directly, but I would advise you to try another version or take your chance in the discord
ntdll.lib is missing and it’s trying to produce it from .def files. .def.in files are preprocessed using the C preprocessor.
The related code is in zig/mingw.zig functions buildImportLib and findDef.
I am downloading a subset of visual studio build tools, suitable for cross compiling, using a rust utility called xwin, and never had problems like this.
Visual studio build tools are neither required nor depended on by zig.
Zig produces ntdll.lib by shipping with ntdll.def.in files which are converted to ntdll.def files via aro C preprocessor (part of the zig compiler), which are then converted to ntdll.lib files via LLVM’s object::writeImportLibrary used when linking against ntdll.dll.
I don’t know why you would see “include nested too deply”. Creating ntdll.lib is an extremely commonly tested code path.
That said, I believe that message is coming from clang in zig 0.11, and since then, we switched to Aro (written in zig) for the C preprocessor being used here. This means if you get a weird error, myself or Vexu will know why it is happening and how to fix it.
Ah, the above crash isn’t even Zig compiler, it’s my code that calls realpath. I guess I got what I asked for, let me try to get rid of that realpath, which is generally always wrong to use (I think I need to set a cwd for a child process, which doesn’t assepts a dir fd, but maybe i can work around that).
Try WSL 2, you can use linux to mount remote filesystems and the linux root is visible as windows disk (for Debian distribution it is available as \\wsl$\Debian) using 9p (plan 9 remote file system).
The worst problem when working with windows is the case (in)sensitivity of the filesystem.