Static build of Qt fails



  • Hello ,
    I try to configure Qt Static with OpenSSL in windows and it Fails to configure Any help ?

    D:\Downloads\qt-everywhere-opensource-src-5.8.0>configure.bat -static -opensource -confirm-license -debug-and-release -platform win32-msvc2017 -sql-sqlite -sql-odbc -ssl -openssl-linked -opengl desktop  -no-compile-examples -nomake examples -make libs -nomake tools -nomake tests  -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -no-warnings-are-errors -no-qml-debug -strip -skip qtconnectivity OPENSSL_LIBS="-lssleay32 -llibeay32" -L C:\OpenSSL-win32\lib -L "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x86" -l Gdi32 -l User32 -I C:\OpenSSL-win32\include -prefix C:\Qt\Static\5.8.0
    + cd qtbase
    + D:\Downloads\qt-everywhere-opensource-src-5.8.0\qtbase\configure.bat -top-level -static -opensource -confirm-license -debug-and-release -platform win32-msvc2017 -sql-sqlite -sql-odbc -ssl -openssl-linked -opengl desktop  -no-compile-examples -nomake examples -make libs -nomake tools -nomake tests  -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -no-warnings-are-errors -no-qml-debug -strip -skip qtconnectivity OPENSSL_LIBS="-lssleay32 -llibeay32" -L C:\OpenSSL-win32\lib -L "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x86" -l Gdi32 -l User32 -I C:\OpenSSL-win32\include -prefix C:\Qt\Static\5.8.0
    Please wait while bootstrapping configure ...
    <srcbase> = D:/Downloads/qt-everywhere-opensource-src-5.8.0/qtbase
    <outbase> = D:/Downloads/qt-everywhere-opensource-src-5.8.0/qtbase
    
    jom 1.1.2 - empower your cores
    
    
    This is the Qt for Windows Open Source Edition.
    
    You have already accepted the terms of the license.
    
    Creating qmake...
    
    Microsoft (R) Program Maintenance Utility Version 14.10.25017.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    
    ERROR: Unknown command line option '-l'.
    
    Qmake failed, return code 3
    
    

  • Lifetime Qt Champion

    Hi,

    Like the error message states: configure doesn't support the -l switch. Remove them from your options.



  • this command argument "-l" was used with 5.6.2 & 5.7.0 and it worked
    If I dont add it Compile will fail ?


  • Lifetime Qt Champion

    Since Qt 5.8, the build system is being modified thus I'd guess that it might have become more sensible to that kind of things.

    In any case, the best thing to do is just try. I never had to tell configure to specifically link to Gdi32 nor User32.



  • I have tried and it fails with this error

    configure.bat -static -opensource -confirm-license -debug-and-release -platform win32-msvc2017 -sql-sqlite -sql-odbc -ssl -openssl-linked -opengl desktop  -no-compile-examples -nomake examples -make libs -nomake tools -nomake tests  -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -no-warnings-are-errors -no-qml-debug -strip -skip qtconnectivity OPENSSL_LIBS="-lssleay32 -llibeay32" -L C:\OpenSSL-win32\lib -L "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x86" -I C:\OpenSSL-win32\include -prefix C:\Qt\Static\5.8.0
    
    link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:..\..\bin\xmlpatterns.exe @D:\UserTemp\Temp\xmlpatterns.exe.12348.2532.jom
    libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__CreateCompatibleBitmap@12 referenced in function _readscreen
    libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__DeleteObject@4 referenced in function _readscreen
    libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__GetDeviceCaps@8 referenced in function _readscreen
    libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__GetDIBits@28 referenced in function _readscreen
    libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__GetObjectA@12 referenced in function _readscreen
    ..\..\bin\xmlpatterns.exe : fatal error LNK1120: 5 unresolved externals
    jom: D:\Downloads\qt-everywhere-opensource-src-5.8.0\build\qtxmlpatterns\tools\xmlpatterns\Makefile.Release [..\..\bin\xmlpatterns.exe] Error 1120
    jom: D:\Downloads\qt-everywhere-opensource-src-5.8.0\build\qtxmlpatterns\tools\xmlpatterns\Makefile [release] Error 2
            cd xmlpatternsvalidator\ && ( if not exist Makefile D:\Downloads\qt-everywhere-opensource-src-5.8.0\build\qtbase\bin\qmake.exe -o Makefile D:\Downloads\qt-everywhere-opensource-src-5.8.0\qtxmlpatterns\tools\xmlpatternsvalidator\xmlpatternsvalidator.pro -- -static -opensource -confirm-license -debug-and-release -platform win32-msvc2017 -sql-sqlite -sql-odbc -ssl -openssl-linked -opengl desktop -no-compile-examples -nomake examples -make libs -nomake tools -nomake tests -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -no-warnings-are-errors -no-qml-debug -strip -skip qtconnectivity "OPENSSL_LIBS=-lssleay32 -llibeay32" -L C:\OpenSSL-win32\lib -L "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x86" -I C:\OpenSSL-win32\include -prefix C:\Qt\Static\5.8.0 ) && C:\Qt\Qt5.8.0\Tools\QtCreator\bin\jom.exe -f Makefile
    jom: D:\Downloads\qt-everywhere-opensource-src-5.8.0\build\qtxmlpatterns\tools\xmlpatternsvalidator\Makefile.Release [..\..\bin\xmlpatternsvalidator.exe] Error 1120
            C:\Qt\Qt5.8.0\Tools\QtCreator\bin\jom.exe -f Makefile.Release
            cl -c -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -O2 -MT -D_HAS_EXCEPTIONS=0 -GR -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -DUNICODE -DWIN32 -DQT_NO_FOREACH -DQT_USE_QSTRINGBUILDER -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_XMLPATTERNS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DNDEBUG -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\qtxmlpatterns\tools\xmlpatternsvalidator -I. -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\qtxmlpatterns\include -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\qtxmlpatterns\include\QtXmlPatterns -I..\..\include -I..\..\include\QtXmlPatterns -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\qtbase\include -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\qtbase\include\QtNetwork -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\build\qtbase\include -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\build\qtbase\include\QtNetwork -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\qtbase\include\QtCore -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\build\qtbase\include\QtCore -I.moc\release -IC:\OpenSSL-win32\include -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\qtbase\mkspecs\win32-msvc2017 -Fo.obj\release\ @D:\UserTemp\Temp\main.obj.7648.0.jom
    main.cpp
            cl -c -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -O2 -MT -D_HAS_EXCEPTIONS=0 -GR -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -DUNICODE -DWIN32 -DQT_NO_FOREACH -DQT_USE_QSTRINGBUILDER -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_XMLPATTERNS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DNDEBUG -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\qtxmlpatterns\tools\xmlpatternsvalidator -I. -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\qtxmlpatterns\include -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\qtxmlpatterns\include\QtXmlPatterns -I..\..\include -I..\..\include\QtXmlPatterns -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\qtbase\include -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\qtbase\include\QtNetwork -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\build\qtbase\include -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\build\qtbase\include\QtNetwork -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\qtbase\include\QtCore -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\build\qtbase\include\QtCore -I.moc\release -IC:\OpenSSL-win32\include -ID:\Downloads\qt-everywhere-opensource-src-5.8.0\qtbase\mkspecs\win32-msvc2017 -Fo.obj\release\ @D:\UserTemp\Temp\xmlpatternsvalidator_plugin_import.obj.7648.0.jom
    xmlpatternsvalidator_plugin_import.cpp
            link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:..\..\bin\xmlpatternsvalidator.exe @D:\UserTemp\Temp\xmlpatternsvalidator.exe.7648.2062.jom
    libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__CreateCompatibleBitmap@12 referenced in function _readscreen
    libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__DeleteObject@4 referenced in function _readscreen
    libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__GetDeviceCaps@8 referenced in function _readscreen
    libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__GetDIBits@28 referenced in function _readscreen
    libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__GetObjectA@12 referenced in function _readscreen
    ..\..\bin\xmlpatternsvalidator.exe : fatal error LNK1120: 5 unresolved externals
    jom: D:\Downloads\qt-everywhere-opensource-src-5.8.0\build\qtxmlpatterns\tools\xmlpatternsvalidator\Makefile [release] Error 2
    jom: D:\Downloads\qt-everywhere-opensource-src-5.8.0\build\qtxmlpatterns\tools\Makefile [sub-xmlpatterns-make_first] Error 2
    jom: D:\Downloads\qt-everywhere-opensource-src-5.8.0\build\qtxmlpatterns\tools\Makefile [sub-xmlpatternsvalidator-make_first] Error 2
    jom: D:\Downloads\qt-everywhere-opensource-src-5.8.0\build\qtxmlpatterns\Makefile [sub-tools-make_first] Error 2
    jom: D:\Downloads\qt-everywhere-opensource-src-5.8.0\build\Makefile [module-qtxmlpatterns-make_first] Error 2
    

  • Lifetime Qt Champion

    Those are dependencies of OpenSSL, then add these libraries to your OpenSSL specific parameters.



  • Like this ?

    configure.bat -static -opensource -confirm-license -debug-and-release -platform win32-msvc2017 -sql-sqlite -sql-odbc -ssl -openssl-linked -opengl desktop  -no-compile-examples -nomake examples -make libs -nomake tools -nomake tests  -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -no-warnings-are-errors -no-qml-debug -strip -skip qtconnectivity OPENSSL_LIBS="-lssleay32 -llibeay32 gdi32.lib User32.lib" -L C:\OpenSSL-win32\lib -L "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x86" -I C:\OpenSSL-win32\include -prefix C:\Qt\Static\5.8.0
    

  • Lifetime Qt Champion

    No, add the -lGdi32 -lUser32 in place of your gdi32.lib User32.lib



  • @SGaist said in Static build of Qt fails:

    No, add the -lGdi32 -lUser32 in place of your gdi32.lib User32.lib

    Thanks
    honstly I have tried both and both works
    :)
    but now is there any link for dev version of Qt VS tools for VS 2017 ?
    and is it possible to compile Qt static without QML ?


  • Lifetime Qt Champion

    There's an initial release of the VS-AddIn here

    Sure there is, just build qtbase statically then build only the modules you want by hand or exclude all the modules you don't want when calling configure.