quazip
quazip copied to clipboard
Dose not work on Windwos 10.
I'm trying to install QuaZip 1.1 on a Windows 10 but I get stuck on this, error.
- I've downloaded the quazip-1.1.zip from here
- Open Qt 5.14.1 (MinGW 7.3.0 64-bit)
- I've used
cd /quazip-1.1
- Next
cmake -S . -B .\build -D QUAZIP_QT_MAJOR_VERSION=5 -G "MinGW Makefiles"
Where the output was this:
- All good so far, but when I've used
cmake --build .\build
I've got the following error:
The ERROR:
Any idea why? Can any of you guys explain to me what I'm doing wrong here?
Perhaps it's because you're using Winapi zlib, judging by that it's named zlib.lib
, and not zlib.a
. Maybe you can temporary fix it by defining ZLIB_WINAPI somewhere in CMakeLists.txt. I guess I could add an option to do it without hacking CMakeLists.txt, but it would be the best if it was possible to determine the zlib flavor automatically.
I'm not sure if Winapi zlib will link at all with MinGW, even when ZLIB_WINAPI is used. Need to check on that.
Nope, I can't link even with ZLIB_WINAPI defined. Well, just don't use MSVC libraries in combination with MinGW. Install zlib from here instead:
http://gnuwin32.sourceforge.net/packages/zlib.htm
Sure, it's not the latest version, but at least it works. Or, alternatively, switch to MSVC Qt instead of MinGW.
Well... I'm not sure why would happen this, but I've installed the Zlib from here https://github.com/horta/zlib.install. And it should be just for windows this install. Basically I just run this bat.
I've tried to install the zlib from your link but I did get basically the same error.
Scanning dependencies of target QuaZip_autogen
[ 5%] Automatic MOC for target QuaZip
[ 5%] Built target QuaZip_autogen
Scanning dependencies of target QuaZip
[ 11%] Building CXX object quazip/CMakeFiles/QuaZip.dir/QuaZip_autogen/mocs_compilation.cpp.obj
[ 17%] Building C object quazip/CMakeFiles/QuaZip.dir/unzip.c.obj
[ 23%] Building C object quazip/CMakeFiles/QuaZip.dir/zip.c.obj
[ 29%] Building CXX object quazip/CMakeFiles/QuaZip.dir/JlCompress.cpp.obj
[ 35%] Building CXX object quazip/CMakeFiles/QuaZip.dir/qioapi.cpp.obj
[ 41%] Building CXX object quazip/CMakeFiles/QuaZip.dir/quaadler32.cpp.obj
[ 47%] Building CXX object quazip/CMakeFiles/QuaZip.dir/quachecksum32.cpp.obj
[ 52%] Building CXX object quazip/CMakeFiles/QuaZip.dir/quacrc32.cpp.obj
[ 58%] Building CXX object quazip/CMakeFiles/QuaZip.dir/quagzipfile.cpp.obj
[ 64%] Building CXX object quazip/CMakeFiles/QuaZip.dir/quaziodevice.cpp.obj
[ 70%] Building CXX object quazip/CMakeFiles/QuaZip.dir/quazip.cpp.obj
[ 76%] Building CXX object quazip/CMakeFiles/QuaZip.dir/quazipdir.cpp.obj
[ 82%] Building CXX object quazip/CMakeFiles/QuaZip.dir/quazipfile.cpp.obj
[ 88%] Building CXX object quazip/CMakeFiles/QuaZip.dir/quazipfileinfo.cpp.obj
[ 94%] Building CXX object quazip/CMakeFiles/QuaZip.dir/quazipnewinfo.cpp.obj
[100%] Linking CXX shared library libquazip1-qt5.dll
CMakeFiles\QuaZip.dir/objects.a(unzip.c.obj):unzip.c:(.text+0x1b6a): undefined reference to `inflateEnd'
CMakeFiles\QuaZip.dir/objects.a(unzip.c.obj):unzip.c:(.text+0x3e11): undefined reference to `get_crc_table'
CMakeFiles\QuaZip.dir/objects.a(unzip.c.obj):unzip.c:(.text+0x3fe5): undefined reference to `inflateEnd'
CMakeFiles\QuaZip.dir/objects.a(unzip.c.obj):unzip.c:(.text+0x402e): undefined reference to `inflateInit2_'
CMakeFiles\QuaZip.dir/objects.a(unzip.c.obj):unzip.c:(.text+0x452e): undefined reference to `inflateInit2_'
CMakeFiles\QuaZip.dir/objects.a(unzip.c.obj):unzip.c:(.text+0x45aa): undefined reference to `inflateEnd'
CMakeFiles\QuaZip.dir/objects.a(unzip.c.obj):unzip.c:(.text+0x4884): undefined reference to `get_crc_table'
CMakeFiles\QuaZip.dir/objects.a(unzip.c.obj):unzip.c:(.text+0x4a4e): undefined reference to `inflateInit2_'
CMakeFiles\QuaZip.dir/objects.a(unzip.c.obj):unzip.c:(.text+0x4a95): undefined reference to `inflateEnd'
CMakeFiles\QuaZip.dir/objects.a(unzip.c.obj):unzip.c:(.text+0x4ffa): undefined reference to `inflateEnd'
CMakeFiles\QuaZip.dir/objects.a(unzip.c.obj):unzip.c:(.text+0x50df): undefined reference to `inflateInit2_'
CMakeFiles\QuaZip.dir/objects.a(unzip.c.obj):unzip.c:(.text+0x52f1): undefined reference to `inflate'
CMakeFiles\QuaZip.dir/objects.a(unzip.c.obj):unzip.c:(.text+0x5339): undefined reference to `crc32'
CMakeFiles\QuaZip.dir/objects.a(unzip.c.obj):unzip.c:(.text+0x53d7): undefined reference to `crc32'
CMakeFiles\QuaZip.dir/objects.a(unzip.c.obj):unzip.c:(.text+0x54fa): undefined reference to `crc32'
CMakeFiles\QuaZip.dir/objects.a(unzip.c.obj):unzip.c:(.text+0x5709): undefined reference to `inflateEnd'
CMakeFiles\QuaZip.dir/objects.a(zip.c.obj):zip.c:(.text+0x19fc): undefined reference to `crc32'
CMakeFiles\QuaZip.dir/objects.a(zip.c.obj):zip.c:(.text+0x1c13): undefined reference to `deflate'
CMakeFiles\QuaZip.dir/objects.a(zip.c.obj):zip.c:(.text+0x217d): undefined reference to `deflateEnd'
CMakeFiles\QuaZip.dir/objects.a(zip.c.obj):zip.c:(.text+0x2239): undefined reference to `deflate'
CMakeFiles\QuaZip.dir/objects.a(zip.c.obj):zip.c:(.text+0x2286): undefined reference to `deflate'
CMakeFiles\QuaZip.dir/objects.a(zip.c.obj):zip.c:(.text+0x22c7): undefined reference to `deflateEnd'
CMakeFiles\QuaZip.dir/objects.a(zip.c.obj):zip.c:(.text+0x241a): undefined reference to `deflateEnd'
CMakeFiles\QuaZip.dir/objects.a(zip.c.obj):zip.c:(.text+0x2446): undefined reference to `deflateEnd'
CMakeFiles\QuaZip.dir/objects.a(zip.c.obj):zip.c:(.text+0x2c28): undefined reference to `get_crc_table'
CMakeFiles\QuaZip.dir/objects.a(zip.c.obj):zip.c:(.text+0x3509): undefined reference to `deflateInit2_'
CMakeFiles\QuaZip.dir/objects.a(quaadler32.cpp.obj):quaadler32.cpp:(.text+0x20): undefined reference to `adler32'
CMakeFiles\QuaZip.dir/objects.a(quaadler32.cpp.obj):quaadler32.cpp:(.text+0x4b): undefined reference to `adler32'
CMakeFiles\QuaZip.dir/objects.a(quaadler32.cpp.obj):quaadler32.cpp:(.text+0x8a): undefined reference to `adler32'
CMakeFiles\QuaZip.dir/objects.a(quaadler32.cpp.obj):quaadler32.cpp:(.text+0xbb): undefined reference to `adler32'
CMakeFiles\QuaZip.dir/objects.a(quaadler32.cpp.obj):quaadler32.cpp:(.text+0x5e): undefined reference to `adler32'
CMakeFiles\QuaZip.dir/objects.a(quacrc32.cpp.obj):quacrc32.cpp:(.text+0x20): undefined reference to `crc32'
CMakeFiles\QuaZip.dir/objects.a(quacrc32.cpp.obj):quacrc32.cpp:(.text+0x4b): undefined reference to `crc32'
CMakeFiles\QuaZip.dir/objects.a(quacrc32.cpp.obj):quacrc32.cpp:(.text+0x8a): undefined reference to `crc32'
CMakeFiles\QuaZip.dir/objects.a(quacrc32.cpp.obj):quacrc32.cpp:(.text+0xbb): undefined reference to `crc32'
CMakeFiles\QuaZip.dir/objects.a(quacrc32.cpp.obj):quacrc32.cpp:(.text+0x5e): undefined reference to `crc32'
CMakeFiles\QuaZip.dir/objects.a(quagzipfile.cpp.obj):quagzipfile.cpp:(.text+0x3d): undefined reference to `gzopen'
CMakeFiles\QuaZip.dir/objects.a(quagzipfile.cpp.obj):quagzipfile.cpp:(.text+0x242): undefined reference to `gzflush'
CMakeFiles\QuaZip.dir/objects.a(quagzipfile.cpp.obj):quagzipfile.cpp:(.text+0x25d): undefined reference to `gzread'
CMakeFiles\QuaZip.dir/objects.a(quagzipfile.cpp.obj):quagzipfile.cpp:(.text+0x28a): undefined reference to `gzwrite'
CMakeFiles\QuaZip.dir/objects.a(quagzipfile.cpp.obj):quagzipfile.cpp:(.text+0x342): undefined reference to `gzopen'
CMakeFiles\QuaZip.dir/objects.a(quagzipfile.cpp.obj):quagzipfile.cpp:(.text+0x6d5): undefined reference to `gzdopen'
CMakeFiles\QuaZip.dir/objects.a(quagzipfile.cpp.obj):quagzipfile.cpp:(.text+0xa13): undefined reference to `gzclose'
CMakeFiles\QuaZip.dir/objects.a(quagzipfile.cpp.obj):quagzipfile.cpp:(.text+0xab2): undefined reference to `gzclose'
CMakeFiles\QuaZip.dir/objects.a(quagzipfile.cpp.obj):quagzipfile.cpp:(.text+0xa6): undefined reference to `gzdopen'
CMakeFiles\QuaZip.dir/objects.a(quagzipfile.cpp.obj):quagzipfile.cpp:(.text+0x98c): undefined reference to `gzclose'
CMakeFiles\QuaZip.dir/objects.a(quaziodevice.cpp.obj):quaziodevice.cpp:(.text+0x380): undefined reference to `deflate'
CMakeFiles\QuaZip.dir/objects.a(quaziodevice.cpp.obj):quaziodevice.cpp:(.text+0x6af): undefined reference to `inflate'
CMakeFiles\QuaZip.dir/objects.a(quaziodevice.cpp.obj):quaziodevice.cpp:(.text+0xac0): undefined reference to `deflate'
CMakeFiles\QuaZip.dir/objects.a(quaziodevice.cpp.obj):quaziodevice.cpp:(.text+0xd58): undefined reference to `deflateInit_'
CMakeFiles\QuaZip.dir/objects.a(quaziodevice.cpp.obj):quaziodevice.cpp:(.text+0xe0b): undefined reference to `inflateInit_'
CMakeFiles\QuaZip.dir/objects.a(quaziodevice.cpp.obj):quaziodevice.cpp:(.text+0xf21): undefined reference to `inflateEnd'
CMakeFiles\QuaZip.dir/objects.a(quaziodevice.cpp.obj):quaziodevice.cpp:(.text+0xf4d): undefined reference to `deflateEnd'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[2]: *** [quazip\CMakeFiles\QuaZip.dir\build.make:331: quazip/libquazip1-qt5.dll] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:134: quazip/CMakeFiles/QuaZip.dir/all] Error 2
mingw32-make.exe: *** [Makefile:159: all] Error 2
“Zlib for Windows” doesn't mean a thing. Different compilers and linkers are often incompatible. It's especially true for MSVC and GCC.
Try to nuke the build directory and reconfigure. You should see something like this:
-- Found ZLIB: C:/Program Files (x86)/GnuWin32/lib/libz.dll.a (found version "1.2.3")
I did that already, that the message which showed me before that error.
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Qt/Tools/mingw730_64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Qt/Tools/mingw730_64/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: C:/Program Files/zlib/lib/libz.dll.a (found version "1.2.3")
-- Configuring done
-- Generating done
-- Build files have been written some/path/to/quazip-1.1/build
Basically I've just copied everything from GnuWin32 into zlib folder from Program Files and it found it so far.
Did you really delete your build directory before reconfiguring?
yes, I've did it with a fresh build
Oh, wait. You're using 64-bit Qt, but GnuWin32 library is 32-bit. That won't link, naturally. I don't know where to get a GCC-built 64-bit zlib for windows, but that's what you need to link properly. Maybe you can get away with using a 64-bit MSVC build, but I have no idea how.
Here's my setup that works fine:
$ cmake -S . -B ../quazip-cmake-build -G 'MinGW Makefiles'
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/programs/Qt/Tools/mingw730_32/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/programs/Qt/Tools/mingw730_32/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: C:/Program Files (x86)/GnuWin32/lib/libz.dll.a (found version "1.2.3")
-- Configuring done
-- Generating done
-- Build files have been written to: C:/alqualos/pr/quazip-cmake-build
Oh... I see... So I need some how-to either change my Qt to be on 32bits or to use MSVC on 64bits you mean? Alright then, I will try to change that and see if it's going to work.
I'm saying that Qt, zlib and GCC must either all be 32-bit or all 64-bit. That's without doubt.
And I'm fairly sure, although I wouldn't guarantee it, that Qt and zlib should either both be GCC (MinGW) compiled or MSVC compiled, but maybe you can somehow make, say, 64-bit MSVC zlib work together with 64-bit MinGW Qt, but I wouldn't even try. Even trying to make work together different releases of MSVC can be very tricky sometimes, and GCC+MSVC are even more incompatible.
I'm running into a linking issue with Windows as well. I'm using Qt with MSVC 2017-32bit and using the same MSVC to build zlib and quazip which ran into linking issues. Then I saw the win32 readme for zlib suggested finding a zlib1.dll that will link correctly and advised against building it yourself. I found a really old one here :http://gnuwin32.sourceforge.net/packages/zlib.htm but now building quazip cannot find zlib. Can you help on the config step I'm missing to find it?
After PR #111 it shouldn't be necessary to link to a separate zlib, as the one bundled with Qt should be used now.
Are your compiling the master branch or a release?
Thanks! I've installed the Qt sources and deleted my zlib builds in "program files", deleted the quazip build directory and ran cmake hoping it would find the QtZlib module but I get the message: Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.11")
The #111 you pointed to mentioned it will look for QtZlib first. I installed it in the default directory.
I don't think installing Qt sources is necessary...
Which Qt version do you use? I have Qt 5.12 and 5.15 installed, and I can only see Qt5Zlib in 5.15.
On a side note, it doesn't look like it has anything to do with the original issue, so could you please create a new one instead of hijacking this one? I think this one can be closed.
Created new issue #115 . More of a misunderstanding on my part than an issue but I'm guessing the Qt5Zlib module is not available in 5.14.2. I wanted to avoid switching to 5.15 since I might need a different msvc but if that's the easiest solution I'll give it a go.
@Vildnex: Can you update the title of the ticket? Windwos -> Windows
QUAZIP_USE_QT_ZLIB
works for Qt5 in theory. I've also added vcpkg and conan support for zlib installs so this should cover everything. 32bit builds are now also documented.