gpanders / ztags

Generate tags files for Zig projects
https://git.sr.ht/~gpanders/ztags
MIT License
18 stars 3 forks source link

windows host: no mmap #6

Closed matu3ba closed 1 year ago

matu3ba commented 1 year ago

Unfortunately mmap does not exist on Windows (yet) (Zig falsely has mmap in os.zig and the posix things did not get moved to posix.zig yet), so I get (even when targeting windows-gnu, but also for windows-native:

MadMax@DESKTOP-B9BTU5D MINGW64 ~/Desktop/ztags (master)
(ins)$ ../zig/bdeb/bin/zig.exe build -Drelease-safe -Dtarget=x86_64-windows-gnu
C:\Users\MadMax\Desktop\zig\bdeb\lib\zig\std\os.zig:100:23: error: root struct of file 'c' has no member named 'MAP'
pub const MAP = system.MAP;
                ~~~~~~^~~~
referenced by:
    findTags: src\Tags.zig:115:70
    main: src\main.zig:34:13
    remaining reference traces hidden; use '-freference-trace' to see all reference traces

C:\Users\MadMax\Desktop\zig\bdeb\lib\zig\std\c.zig:146:122: error: root struct of file 'c' has no member named 'off_t'
pub extern "c" fn mmap(addr: ?*align(page_size) anyopaque, len: usize, prot: c_uint, flags: c_uint, fd: c.fd_t, offset: c.off_t) *anyopaque;
                                                                                                                        ~^~~~~~
error: ztags...
error: The following command exited with error code 1:
C:\Users\MadMax\Desktop\zig\bdeb\bin\zig.exe build-exe C:\Users\MadMax\Desktop\ztags\src\main.zig -OReleaseSafe --cache-dir C:\Users\MadMax\Desktop\ztags\zig-cache --global-cache-dir C:\Users\MadMax\AppData\Local\zig --name ztags -target x86_64-windows-gnu -mcpu x86_64 --enable-cache
error: the following build command failed with exit code 1:
C:\Users\MadMax\Desktop\ztags\zig-cache\o\28d96108f4f080e89942bee8a8b80c7c\build.exe C:\Users\MadMax\Desktop\zig\bdeb\bin\zig.exe C:\Users\MadMax\Desktop\ztags C:\Users\MadMax\Desktop\ztags\zig-cache C:\Users\MadMax\AppData\Local\zig -Drelease-safe -Dtarget=x86_64-windows-gnu
matu3ba commented 1 year ago

As far as I understand, Memory mapped files Windows have a higher abstraction necessary for usage (at least the stable api).

gpanders commented 1 year ago

Thanks, I’ll take a look soon (also happy to review a PR if you’re so inclined).

Perhaps I should add cross compiling for Windows to the CI.

gpanders commented 1 year ago

@matu3ba Can you try https://github.com/gpanders/ztags/pull/8 and see if it runs ok on Windows? Unfortunately I've so far had no success getting a Windows VM up and running.

gpanders commented 1 year ago

Should be fixed by 09f0a8d966d3bf3f98b2f49e919510b4881a704d.