Error when building the release version with MinGW
Limaaron opened this issue · 5 comments
If we build a library:
cmake -G "MinGW Makefiles" -B build
mingw32-make
Work!
But if we build:
cmake -G "MinGW Makefiles" -B build -DCMAKE_BUILD_TYPE=Release
mingw32-make
It doesn't work :D
W:\Cybegon\zip\src\zip.c: In function 'zip_archive_extract':
W:\Cybegon\zip\src\zip.c:356:5: error: 'strncpy' output may be truncated copying between 0 and 260 bytes from a string of length 511 [-Werror=stringop-truncation]
356 | strncpy(&path[dirlen], info.m_filename, MAX_PATH - dirlen);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1.exe: all warnings being treated as errors
mingw32-make[2]: *** [CMakeFiles\zip.dir\build.make:79: CMakeFiles/zip.dir/src/zip.c.obj] Error 1
mingw32-make[2]: Leaving directory 'W:/Cybegon/zip/build'
mingw32-make[1]: *** [CMakeFiles\Makefile2:113: CMakeFiles/zip.dir/all] Error 2
mingw32-make[1]: Leaving directory 'W:/Cybegon/zip/build'
mingw32-make: *** [makefile:148: all] Error 2
MinGW version: GNU 11.2.0
OS: Windows 10
@Limaaron - PTAL if the fix https://github.com/kuba--/zip/pull/273 works for you
We can add some if-s
for cmake to avoid building with -Werror
flag.
WDYT?
We can add some
if-s
for cmake to avoid building with-Werror
flag.WDYT?
it's possible, but I hope there won't be any problems with it.
in any case, I will let you know if there is ever a problem with this :)
it's possible, but I hope there won't be any problems with it.
in any case, I will let you know if there is ever a problem with this :)
I found the root of the problem
miniz.h
4910: #elif defined(__MINGW32__) || defined(__MINGW64__)
4911: #include <windows.h>
4912: #ifndef MINIZ_NO_TIME
4913: #include <sys/utime.h>
4914: #endif
windows.h -> winbase.h -> fileapi -> miwindef.h -> #define MAX_PATH 260
zip.c
39: #include "miniz.h"
40: #include "zip.h"
this interrupts the definition inside the zip.h MAX_PATH
@Limaaron - PTAL if the fix https://github.com/kuba--/zip/pull/273 works for you
This is not works...
We can add some
if-s
for cmake to avoid building with-Werror
flag.WDYT?
This is not a solution. Because disable this validation on the release project may add more issues with app ...