Inherited project with libzip.
-
Hello,
I have inherited a project in QT, but I struggle to build it.
There is a reference to #include <zip.h> that is not resolved.
The library I'm looking for is: Libzip from https://libzip.org/Trying to download packages, I end up here: https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-libzip
but not sure what to do with this.I use:
Qt Creator 12.0.1
with QT 6.6.1
Windows 11From the CMakeLists.txt I see that it links "libzip-static.lib" and "libz-static.lib" but the folder referenced, is on the previous devs machines, I don't have those.
I tried adding the sources of libzip to my project, but that fails as zipconf.h is missing.
I tried all my googlefu, but could not find the answer. I did dive into MSYS2, and was able to install qt creator and libzip, but then I failed to setup a working kit.
Any help or pointers in the right direction is appreciated.
-
Hi and welcome to devnet,
zlib is using cmake as build system as does Qt 6 so you likely already have cmake in your machine as well. You can build the library on your machine to get the configuration you want.
-
I have the QT installer taken care of installing dependencies.
So cmake is at: "C:\Qt\Tools\CMake_64\bin\cmake.exe"
I have used cmake-gui to fix the refences to zlib as described here: https://gist.github.com/davidcorbin/0b13604900089b8fcb28
But now stuck on make. Where would I find that binary? It does not seem to be in the QT folder.
-
I have the QT installer taken care of installing dependencies.
So cmake is at: "C:\Qt\Tools\CMake_64\bin\cmake.exe"
I have used cmake-gui to fix the refences to zlib as described here: https://gist.github.com/davidcorbin/0b13604900089b8fcb28
But now stuck on make. Where would I find that binary? It does not seem to be in the QT folder.
@QtUser17456 just call
cmake --build .
There's no make on Windows. By default Qt 6 uses ninja which should also be installed.
On Windows, you either have nmake for Visual Studio or mingw32-make for MinGW. Qt used to use jom to help parallelism on Windows.
-
Thanks for your help! I am getting closer:
C:\Users\User\Downloads\libzip-1.10.1.tar\libzip-1.10.1>cmake --build .
[ 0%] Linking C shared library libzip.dll
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find C:/Program Files (x86)/GnuWin32/lib: Permission denied
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[2]: *** [lib\CMakeFiles\zip.dir\build.make:2129: lib/libzip.dll] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:216: lib/CMakeFiles/zip.dir/all] Error 2
mingw32-make.exe: *** [Makefile:145: all] Error 2That location does exist, and I do run the command line elevated. I have double checked the permissions, they seem ok to me.
-
Thanks for your help! I am getting closer:
C:\Users\User\Downloads\libzip-1.10.1.tar\libzip-1.10.1>cmake --build .
[ 0%] Linking C shared library libzip.dll
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find C:/Program Files (x86)/GnuWin32/lib: Permission denied
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[2]: *** [lib\CMakeFiles\zip.dir\build.make:2129: lib/libzip.dll] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:216: lib/CMakeFiles/zip.dir/all] Error 2
mingw32-make.exe: *** [Makefile:145: all] Error 2That location does exist, and I do run the command line elevated. I have double checked the permissions, they seem ok to me.
@QtUser17456 Don't ever build stuff as a super user.
What does it look for in that folder ?
-
Should have recognized this error earlier. I pointed to the folder instead of to the lib.
With cmake-gui I now point to to the libfile: C:/Program Files (x86)/GnuWin32/lib/zlib.lib
Both for release and debug.This is version 1.2.3 of zlib, checked by the dll version.
Now the error is:
[ 0%] Linking C shared library libzip.dll
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_algorithm_deflate.c.obj):zip_algorithm_deflate.c:(.text+0x2b0): undefined reference todeflateInit2_' C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_algorithm_deflate.c.obj):zip_algorithm_deflate.c:(.text+0x2d7): undefined reference to
inflateInit2_'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_algorithm_deflate.c.obj):zip_algorithm_deflate.c:(.text+0x33c): undefined reference todeflateEnd' C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_algorithm_deflate.c.obj):zip_algorithm_deflate.c:(.text+0x351): undefined reference to
inflateEnd'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_algorithm_deflate.c.obj):zip_algorithm_deflate.c:(.text+0x4a8): undefined reference todeflate' C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_algorithm_deflate.c.obj):zip_algorithm_deflate.c:(.text+0x4c2): undefined reference to
inflate'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_dirent.c.obj):zip_dirent.c:(.text+0x38a): undefined reference tocrc32' C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_error_strerror.c.obj):zip_error_strerror.c:(.text+0x137): undefined reference to
zError'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_io_util.c.obj):zip_io_util.c:(.text+0x39d): undefined reference tocrc32' C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_pkware.c.obj):zip_pkware.c:(.text+0x29): undefined reference to
crc32'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_pkware.c.obj):zip_pkware.c:(.text+0x7f): undefined reference tocrc32' C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_source_crc.c.obj):zip_source_crc:(.text+0xaf): undefined reference to
crc32'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_source_crc.c.obj):zip_source_crc:(.text+0x31d): undefined reference tocrc32' C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_string.c.obj):zip_string.c:(.text+0x1d): more undefined references to
crc32' follow
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[2]: *** [lib\CMakeFiles\zip.dir\build.make:2129: lib/libzip.dll] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:216: lib/CMakeFiles/zip.dir/all] Error 2
mingw32-make.exe: *** [Makefile:145: all] Error 2What am I doing wrong? Can't I just get a precompiled package somewhere?
-
Should have recognized this error earlier. I pointed to the folder instead of to the lib.
With cmake-gui I now point to to the libfile: C:/Program Files (x86)/GnuWin32/lib/zlib.lib
Both for release and debug.This is version 1.2.3 of zlib, checked by the dll version.
Now the error is:
[ 0%] Linking C shared library libzip.dll
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_algorithm_deflate.c.obj):zip_algorithm_deflate.c:(.text+0x2b0): undefined reference todeflateInit2_' C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_algorithm_deflate.c.obj):zip_algorithm_deflate.c:(.text+0x2d7): undefined reference to
inflateInit2_'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_algorithm_deflate.c.obj):zip_algorithm_deflate.c:(.text+0x33c): undefined reference todeflateEnd' C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_algorithm_deflate.c.obj):zip_algorithm_deflate.c:(.text+0x351): undefined reference to
inflateEnd'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_algorithm_deflate.c.obj):zip_algorithm_deflate.c:(.text+0x4a8): undefined reference todeflate' C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_algorithm_deflate.c.obj):zip_algorithm_deflate.c:(.text+0x4c2): undefined reference to
inflate'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_dirent.c.obj):zip_dirent.c:(.text+0x38a): undefined reference tocrc32' C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_error_strerror.c.obj):zip_error_strerror.c:(.text+0x137): undefined reference to
zError'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_io_util.c.obj):zip_io_util.c:(.text+0x39d): undefined reference tocrc32' C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_pkware.c.obj):zip_pkware.c:(.text+0x29): undefined reference to
crc32'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_pkware.c.obj):zip_pkware.c:(.text+0x7f): undefined reference tocrc32' C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_source_crc.c.obj):zip_source_crc:(.text+0xaf): undefined reference to
crc32'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_source_crc.c.obj):zip_source_crc:(.text+0x31d): undefined reference tocrc32' C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\zip.dir/objects.a(zip_string.c.obj):zip_string.c:(.text+0x1d): more undefined references to
crc32' follow
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[2]: *** [lib\CMakeFiles\zip.dir\build.make:2129: lib/libzip.dll] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:216: lib/CMakeFiles/zip.dir/all] Error 2
mingw32-make.exe: *** [Makefile:145: all] Error 2What am I doing wrong? Can't I just get a precompiled package somewhere?
@QtUser17456 said in Inherited project with libzip.:
C:/Program Files (x86)/GnuWin32/lib/zlib.lib
Only a though/possibility.
Program Files (x86)
is usually for 32-bit stuff under Windows 64-bit, but the rest of your compilation is/might be for 64-bit? Is this a 32-/64-bit mismatch?