zig-webui icon indicating copy to clipboard operation
zig-webui copied to clipboard

errors with nightly zig to "build --release" on windows

Open 0x546F6D opened this issue 1 year ago • 3 comments

I get the following 2 errors when trying to build any of the release type (fast, small, safe) with zig-master. I tried with:

  • zig-windows-x86_64-0.14.0-dev.1457
  • zig-windows-x86_64-0.14.0-dev.1417
C:\Users\user\AppData\Local\zig\p\12203578c4326bd2088018f5d0f5ad395b6f4ea8228ceec99b60274c4329e832aa5c\src\civetweb\civetweb.c:714:9: error: 'MUST_IMPLEMENT_CLOCK_GETTIME' macro redefined
#define MUST_IMPLEMENT_CLOCK_GETTIME
        ^
<command line>:9:9: note: previous definition is here
C:\Users\user\AppData\Local\zig\p\12203578c4326bd2088018f5d0f5ad395b6f4ea8228ceec99b60274c4329e832aa5c\src\civetweb\civetweb.c:22173:20: error: expansion of date or time macro is not reproducible
  const char *bd = __DATE__;

can be reproduced with:

zig build run_minimal --release=safe

There is no problem with zig-0.13 to "zig build --release" on windows, nor is there any problem with zig-master to just "zig build". The issue only occurs when using zig-master to "build --release" on windows.

0x546F6D avatar Sep 05 '24 15:09 0x546F6D

This seems to be a zig master bug I'll try a minimal reproduction and report upstream

jinzhongjia avatar Sep 06 '24 10:09 jinzhongjia

I solved the problem by modifying the code in civetweb.c. I'm not sure if it's the best practice, but it does work.

Code modification at civetweb.c:714:

#if !defined(WIN_PTHREADS_TIME_H)
#ifndef MUST_IMPLEMENT_CLOCK_GETTIME
#define MUST_IMPLEMENT_CLOCK_GETTIME
#endif
#endif

Code modification at civetweb.c:22173: The compiler complained about not being able to return a the certainty value, so we just need to provide a simple string.

const char *bd = "Sep 13 2024";

uuzp avatar Sep 12 '24 15:09 uuzp

Maybe this issue should be raised directly to civetweb

jinzhongjia avatar Sep 12 '24 15:09 jinzhongjia