Important: Please read the Qt Code of Conduct -

Build Qt 5.6 with system libs (problems with include order)

  • Hi,

    How to build Qt with -system-libs (zlib, libpng) etc.
    I tried to pass the install location using -I C:\qtinstall\include and -L C:\qtinstall\lib to configure, but then those passes are included before the qtmodule includes. Resulting in a build failure if an older qt build is present in this location.

    My configuration is:

    configure.bat -opensource -confirm-license -prefix s:\ -platform win32-g++ -plugin-sql-odbc -qt-style-windowsxp -qt-style-windowsvista -system-libpng -system-libjpeg -system-zlib -system-pcre -system-freetype -nomake examples -c++11 -opengl dynamic -force-debug-info -openssl-linked -plugin-sql-mysql -qdbus -dbus-linked -icu -ltcg -release -I s:\include -L s:\lib 

    -I and -L are then set in the qmodule.pri generated by qt.

     LIBS           += -Ls:/lib
     INCLUDEPATH    += s:/include

    I get similar results with mingw-w64 and msvc.

    When I don't try to use the system libs and I don't pass the -I and -L I have a similar issue when building qtmodules seperatly.
    For example if a module tries to use the builtin zlib the include to the installed qt base provided by QT_INSTALL_HEADERS is included before -Is:\include\QtZlib resulting in the wrong zconf.h being used.
    The result is that the code is looking for the zlib symbols without the z_ prefix which is used in the qt plugin.

    -IQ:\qtsvg\src\svg -I. -Is:\build\win32libs\icu\image-mingw-w64-RelWithDebInfo-55.1\include -I..\..\include -I..\..\include\QtSvg -I..\..\include\QtSvg\5.6.1 -I..\..\include\QtSvg\5.6.1\QtSvg -Itmp -Is:\include\QtWidgets\5.6.0 -Is:\include\QtWidgets\5.6.0\QtWidgets -Is:\include\QtGui\5.6.0 -Is:\include\QtGui\5.6.0\QtGui -Is:\include\QtCore\5.6.0 -Is:\include\QtCore\5.6.0\QtCore -Is:\include -Is:\include\QtWidgets -Is:\include\QtGui -Is:\include\QtANGLE -Is:\include\QtCore -Is:\include\QtZlib -Is:/include/QtZlib/5.6.0 -Is:/include/QtZlib/5.6.0/QtZlib -I.moc\release -Is:\mkspecs\win32-g++ -o .obj\release\moc_qsvgwidget.o .moc\release\moc_qsvgwidget.cpp

    Is there a way to change the include order or is it a Qt bug?

  • @The2Ring

    welcome to devnet forum

    I have not done a build of Qt libs myself for some time. Therefore, I am not completely sure, but the building scripts are typically not happy about the use of backslashs '\'. Those are certainly the main folder separators for windows, but may need escaping. The scripts of Qt are originally coming from linux. Therefore in a lot of places it is better to use the forward slash '/' instead.

    I have seen that you have used already the forward slash with LIBS and INCLUDEPATH. So you are aware of the issue. However, you have used with configure.bat back slashes.

    In my opinion it is certainly worth a try with forward slashes. This is sometimes as a miracle and solving issues which are hard to understand.