Linker errors while static building Qt5 with mingw on Windows
-
Info: qt 5.14.0, mingw 730_64
To find out if Qt is our way to go, I am trying to set up a statically linked Qt installation on a Windows machine. I have followed the steps on https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW and have studied the powershell script to do it manually because the script failed.
We need a static build to create a static executable. If this succeeds, we will look into buying a license because I understand that we need it if we can't share the source code.
The building starts up (mingw32-make) and takes a long time until it stops with linker errors on libqtiff.a(tif_pixarlog.o). I didn't enable tiff in my configuration, but it still seems to build it. It seems to be missing zlib references.
./configure.bat -static -release -platform win32-g++ -prefix C:\Qt\Static\5.14.0\ -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -opensource -confirm-license -skip qtwebengine -make libs -nomake tools -nomake examples -nomake tests
C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_pixarlog.o):tif_pixarlog.c:(.text$PixarLogVSetField+0x4f): undefined reference to `deflateParams' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_pixarlog.o):tif_pixarlog.c:(.text$PixarLogCleanup+0xcf): undefined reference to `inflateEnd' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_pixarlog.o):tif_pixarlog.c:(.text$PixarLogCleanup+0xd6): undefined reference to `deflateEnd' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_pixarlog.o):tif_pixarlog.c:(.text$PixarLogPostEncode+0x2c): undefined reference to `deflate' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_pixarlog.o):tif_pixarlog.c:(.text$PixarLogEncode+0x101f): undefined reference to `deflate' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_pixarlog.o):tif_pixarlog.c:(.text$PixarLogDecode+0x122): undefined reference to `inflate' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_pixarlog.o):tif_pixarlog.c:(.text$PixarLogSetupEncode+0xee): undefined reference to `deflateInit_' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_pixarlog.o):tif_pixarlog.c:(.text$PixarLogSetupDecode+0x18b): undefined reference to `inflateInit_' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_pixarlog.o):tif_pixarlog.c:(.text$PixarLogPreEncode+0x76): undefined reference to `deflateReset' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_pixarlog.o):tif_pixarlog.c:(.text$PixarLogPreDecode+0x76): undefined reference to `inflateReset' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_zip.o):tif_zip.c:(.text$ZIPCleanup+0x64): undefined reference to `deflateEnd' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_zip.o):tif_zip.c:(.text$ZIPCleanup+0x76): undefined reference to `inflateEnd' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_zip.o):tif_zip.c:(.text$ZIPEncode+0x88): undefined reference to `deflate' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_zip.o):tif_zip.c:(.text$ZIPPostEncode+0x33): undefined reference to `deflate' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_zip.o):tif_zip.c:(.text$ZIPPreEncode+0x6f): undefined reference to `deflateReset' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_zip.o):tif_zip.c:(.text$ZIPSetupEncode+0x43): undefined reference to `inflateEnd' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_zip.o):tif_zip.c:(.text$ZIPSetupEncode+0x68): undefined reference to `deflateInit_' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_zip.o):tif_zip.c:(.text$ZIPDecode+0xb8): undefined reference to `inflate' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_zip.o):tif_zip.c:(.text$ZIPPreDecode+0x72): undefined reference to `inflateReset' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_zip.o):tif_zip.c:(.text$ZIPSetupDecode+0x40): undefined reference to `deflateEnd' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_zip.o):tif_zip.c:(.text$ZIPSetupDecode+0x6e): undefined reference to `inflateInit_' C:\Qt\Static\src\qt-everywhere-src-5.14.0\qtimageformats\plugins\imageformats\libqtiff.a(tif_zip.o):tif_zip.c:(.text$ZIPVSetField+0x3c): undefined reference to `deflateParams' collect2.exe: error: ld returned 1 exit status mingw32-make[3]: *** [Makefile:76: ../../bin/qml.exe] Error 1 mingw32-make[3]: Target 'first' not remade because of errors. mingw32-make[3]: Leaving directory 'C:/Qt/Static/src/qt-everywhere-src-5.14.0/qtdeclarative/tools/qml' mingw32-make[2]: *** [Makefile:158: sub-qml-make_first] Error 2 mingw32-make[2]: Target 'first' not remade because of errors. mingw32-make[2]: Leaving directory 'C:/Qt/Static/src/qt-everywhere-src-5.14.0/qtdeclarative/tools' mingw32-make[1]: *** [Makefile:78: sub-tools-make_first] Error 2 mingw32-make[1]: Target 'first' not remade because of errors. mingw32-make[1]: Leaving directory 'C:/Qt/Static/src/qt-everywhere-src-5.14.0/qtdeclarative' mingw32-make: *** [Makefile:342: module-qtdeclarative-make_first] Error 2 mingw32-make: Target 'first' not remade because of errors.
What am I doing wrong or how can I fix this?
Additional question: can anyone tell me how to make sure openssl is also included? Adding -openssl-linked to configure doesn't seem to work.