Skip to content

Fix build for Windows when using CMake

maek requested to merge maek/netradiant:fix-minizip into master

When trying to compile for Windows via MinGW you get the following error:

/usr/lib/gcc/x86_64-w64-mingw32/7.1.1/../../../../x86_64-w64-mingw32/lib/../lib/libminizip.a(unzip.o):(.text+0x1097): undefined reference to `crc32'
/usr/lib/gcc/x86_64-w64-mingw32/7.1.1/../../../../x86_64-w64-mingw32/lib/../lib/libminizip.a(unzip.o):(.text+0x1381): undefined reference to `inflate'
/usr/lib/gcc/x86_64-w64-mingw32/7.1.1/../../../../x86_64-w64-mingw32/lib/../lib/libminizip.a(unzip.o):(.text+0x13d4): undefined reference to `crc32'
/usr/lib/gcc/x86_64-w64-mingw32/7.1.1/../../../../x86_64-w64-mingw32/lib/../lib/libminizip.a(unzip.o):(.text+0x15e9): undefined reference to `inflateEnd'
/usr/lib/gcc/x86_64-w64-mingw32/7.1.1/../../../../x86_64-w64-mingw32/lib/../lib/libminizip.a(unzip.o):(.text+0x1aea): undefined reference to `get_crc_table'
/usr/lib/gcc/x86_64-w64-mingw32/7.1.1/../../../../x86_64-w64-mingw32/lib/../lib/libminizip.a(unzip.o):(.text+0x1cb3): undefined reference to `inflateInit2_'
collect2: error: ld returned 1 exit status

It turns out that this is caused by an incorrect linking order (see https://stackoverflow.com/a/2395371).

Merge request reports