quazip
quazip copied to clipboard
Using Qt5Zlib to build on Windows
Building using MSVC2017-32 bit cannot find Zlib on Qt 5.14.2. zlib has been in Qt for a while but I'm guessing the module that can be used to build quazip may only be available in Qt > 5.15
I installed Qt 5.15.2 (there is now a Qt5Zlib folder) and cleared the quazip build directory and built with MSVC2019 32-bit and received the same message:
Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.11")
I'm trying to build the release version of quazip 1.1
Well, it won't work with 1.1, as the appropriate PR was merged after this release. Try with the master, and if it works, I'll make a new release shortly.
using master it finds it now but there is a linking issue (many non-defined externals). I also get this warning:
C:\Qt\5.15.2\msvc2019\lib\Qt5Core.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64' [C:\Qt\addons_source\quazip\build\quazip\QuaZip.vcxproj]
This is the same issue I was having when try to compile my own zlib as well. I tried configuring the qt command prompt on windows for vcvarsall.bat amd64_x86 and vcvars32.bat but both had the same issue
Damn, not this x86-vs-x64 stuff again.
The only easy way of dealing with it I know of is to ensure that everything has the same architecture: the installed Qt version, all libraries you use, the compiler, everything.
In your case it looks like you've installed a 32-bit version of Qt and try to compile for 64 bit (why? MSVC 64 bit installed or what?).
I selected x86 environment by opening the command prompt for Qt 5.15.2 MSVC 2019 32-bit then vcvarsall.bat amd64_x86 or vcvars32.bat and finally removed all 64-bit msvc from qt but cmake still makes the target architecture x64. I don't know enough about make files to force it to 32-bit but that seems to be the issue.
When I build projects with QtCreator I can select 32 or 64 bit but cmake seems to use my systems architecture, which is x64. is there a way to force it to 32-bit?
I always seem to have problems with this.
In my case it builds a 64-bit library successfully. Any reason why you want to build a 32-bit version? Seems like 64 bit systems are ubiquitous nowadays and support for 32 bit is dropping. Do you need to support legacy code or what?
@theMadStork Have you tried adding -A Win32
to cmake command line?
Yes! I was trying to use CMAKE_GENERATOR to select the right platform compiler and wasn't having any luck but that's all I needed. One last note, to include in my project in QtCreator for Qt 5.15.2 I had to replace all #include <zlib.h> with #include <QtZlib/zlib.h>
Thanks for all your help
Replacing zlib.h
with QtZlib/zlib.h
doesn't sound portable. I'd rather try to add an include path with zlib.h
.
Makes sense
32bit builds are now added in CI and documented in main readme.