jpcima / ysfx

Hosting library for JSFX
Apache License 2.0
161 stars 26 forks source link

Windows, MinGW GCC: `WDL/win32_utf8.c:803:5: error: conflicting types for 'statUTF8'; have 'int(const char *, struct stat *)'` #18

Closed GavinRay97 closed 2 years ago

GavinRay97 commented 2 years ago

Not your problem, but documenting just in case others run into this The duct-tape fix is to change the definition in win32_utf8.c to use struct _stat64 instead of struct stat

====================[ Build | eel2 | RelWithDebInfo-MinGW ]=====================
C:\Users\rayga\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\213.5744.123\bin\cmake\win\bin\cmake.exe --build C:\Users\rayga\Projects\tmp\ysfx\cmake-build-relwithdebinfo-mingw --target eel2
[0/2] C:\Users\rayga\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\213.5744.123\bin\cmake\win\bin\cmake.exe -P C:\Users\rayga\Projects\tmp\ysfx\cmake-build-relwithdebinfo-mingw\CMakeFiles\VerifyGlobs.cmake
[1/2] C:\msys64\ucrt64\bin\cc.exe -DEELSCRIPT_NO_LICE -DEELSCRIPT_NO_NET -DNSEEL_ATOF=nseel_atof -DWDL_FFT_REALSIZE=8 -D_FILE_OFFSET_BITS=64 -IC:/Users/rayga/Projects/tmp/ysfx/thirdparty/WDL/source -O2 -g -DNDEBUG -fvisibility=hidden -Wall -MD -MT CMakeFiles/eel2.dir/thirdparty/WDL/source/WDL/win32_utf8.c.obj -MF CMakeFiles\eel2.dir\thirdparty\WDL\source\WDL\win32_utf8.c.obj.d -o CMakeFiles/eel2.dir/thirdparty/WDL/source/WDL/win32_utf8.c.obj -c C:/Users/rayga/Projects/tmp/ysfx/thirdparty/WDL/source/WDL/win32_utf8.c
FAILED: CMakeFiles/eel2.dir/thirdparty/WDL/source/WDL/win32_utf8.c.obj 
C:\msys64\ucrt64\bin\cc.exe -DEELSCRIPT_NO_LICE -DEELSCRIPT_NO_NET -DNSEEL_ATOF=nseel_atof -DWDL_FFT_REALSIZE=8 -D_FILE_OFFSET_BITS=64 -IC:/Users/rayga/Projects/tmp/ysfx/thirdparty/WDL/source -O2 -g -DNDEBUG -fvisibility=hidden -Wall -MD -MT CMakeFiles/eel2.dir/thirdparty/WDL/source/WDL/win32_utf8.c.obj -MF CMakeFiles\eel2.dir\thirdparty\WDL\source\WDL\win32_utf8.c.obj.d -o CMakeFiles/eel2.dir/thirdparty/WDL/source/WDL/win32_utf8.c.obj -c C:/Users/rayga/Projects/tmp/ysfx/thirdparty/WDL/source/WDL/win32_utf8.c

C:/Users/rayga/Projects/tmp/ysfx/thirdparty/WDL/source/WDL/win32_utf8.c: At top level:
C:/Users/rayga/Projects/tmp/ysfx/thirdparty/WDL/source/WDL/win32_utf8.c:803:5: error: conflicting types for 'statUTF8'; have 'int(const char *, struct stat *)'
  803 | int statUTF8(const char *filename, struct stat *buffer)
      |     ^~~~~~~~

In file included from C:/Users/rayga/Projects/tmp/ysfx/thirdparty/WDL/source/WDL/win32_utf8.c:6:
C:/Users/rayga/Projects/tmp/ysfx/thirdparty/WDL/source/WDL/win32_utf8.h:64:25: note: previous declaration of 'statUTF8' with type 'int(const char *, struct _stat64 *)'
   64 | WDL_WIN32_UTF8_IMPL int statUTF8(const char *filename, struct stat *buffer);
      |                         ^~~~~~~~

ninja: build stopped: subcommand failed.
jpcima commented 2 years ago

There is a deeper reason which is large file support. (as enabled by the definition _FILE_OFFSET_BITS=64) On Windows, this stuff works on MinGW only. The better thing to do is not enable the above definition on Windows OS, since, for support of visual studio, I replace it with the i64-suffixed versions of file functions.

(it happens that stat has such an equivalent as _stati64, but i don't actually need that one for LFS scenarios)

jpcima commented 2 years ago

most likely fixed in 7de8e44

GavinRay97 commented 2 years ago

Confirmed fixed, thanks!