Unable to compile Qt5.8 with MingW 64 bit compiler



  • I am trying to compile Qt 5.8 with MingW 64 bit compiler (TDM GCC 5.1.0). I got the following error.

    qwin10helpers.cpp:60:37: fatal error: UIViewSettingsInterop.h: No such file or directory. I use the following configuration option
    configure -prefix “D:\Qt\Qt580” -debug-and-release -opensource -shared -opengl desktop -nomake examples -nomake tests -skip qtwebengine.

    In order to overcome this I installed Win 10 SDK version 10.0.14393.0 and tried to compile it, but I still get the same error. Based on some suggestions I tried the following.

    1. I created a file named include.flags with the following content

    -I"C:/Program Files (x86)/Windows Kits/10/Include/10.0.14393.0/shared"
    -I"C:/Program Files (x86)/Windows Kits/10/Include/10.0.14393.0/um"
    -I"C:/Program Files (x86)/Windows Kits/10/Include/10.0.14393.0/ucrt"
    -I"C:/Program Files (x86)/Windows Kits/10/Include/10.0.14393.0/winrt"

    and re-run the configure step as follows

    D:\Qt\qt580-Src\configure -prefix "D:\Qt\Qt580" -debug-and-release -opensource -shared -opengl desktop -nomake examples -nomake tests -I @D:\Qt\include.flags

    Now when I run mingw32-make command I get the following error

    In file included from C:/Program Files (x86)/Windows Kits/10/Include/10.0.14393.0/ucrt/stddef.h:11:0,
    from D:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cstddef:45,
    from D:/Qt/qt580-Src/qtbase/src/corelib/global/qglobal.h:46,
    from D:\Qt\qt580-Src\qtbase\include/QtCore/qglobal.h:1,
    from D:\Qt\qt580-Src\qtbase\include/QtCore/QtGlobal:1,
    from D:\Qt\qt580-Src\qtbase\src\plugins\platforms\windows\qwin10helpers.h:43,
    from D:\Qt\qt580-Src\qtbase\src\plugins\platforms\windows\qwin10helpers.cpp:40:
    C:/Program Files (x86)/Windows Kits/10/Include/10.0.14393.0/ucrt/corecrt.h:10:23: fatal error: vcruntime.h: No such file or directory.

    Can someone help me in resolving this issue. I do not have VS tools installed in my machine. The OS is Windows 10.
    Any help will be highly appreciated.


  • Moderators

    @Srinivasan.B Do you really need to build Qt by yourself?



  • @Srinivasan.B In the past I have built Qt for windows a lot. I have not done this recently as it really is too much of a painful experience.

    Trying to get Qt building with mingw64 is very difficult. And I mean very. Expect that you will run into many many problems getting things working. You have to ask yourself if it is worth it to build yourself or if you should just grab the prebuilt binaries.

    If you insist on proceeding here are some tips I've learned:

    1. Qt requires pretty specific versions on mingw. Just any old mingw will rarely work without tweaks to Qt's code. Find out what version you should use on Qt 5.8.
    2. Not all mingw64 compilers are ready to build the majority of windows code yet. This may not be true any more as I haven't tried this in about 2-3 years but back then there was a lot of missing functionality.
    3. Mixing visual c++ and mingw stuff will never work. The fact you installed the win10 sdk and are trying to use that with mingw stuff probably means your build will never work. Unless, again my knowledge here is outdated, mingw has been designed to work with that windows 10 kit.
    4. Be very careful what you have in your PATH when you try to build using mingw. Also be careful with what you try to include/add as libs. People love to try to mix binary formats and of course this will fail.
    5. And finally, expect to have to make some tweaks to the build process or to the Qt code itself to get it to work with your 64-bit mingw. I have never successfully built it on a windows machine without doing this. The build process doesn't seem very fleshed out for windows/mingw64.

    Good luck! My advice is use the binaries unless you have a specific reason not to. This is coming from someone that builds all Qts from source, except windows 64-bit. ;)



  • @ambershark I would like to use the pre-compiled binary but I do not have the binaries compiled for gcc 64bit compiler. I also want to get away from using Visual Studio compiler. I have compiled Qt earlier as well and I did not face any issues. This is the first time I am having some issues compiling Qt.

    I agree that mixing VC++ and mingw will not work, but Windows 10 SDK is given as a pre-requisite and the compilitation was failing in qwin10helpers.cpp:60:37 ( fatal error: UIViewSettingsInterop.h not found). To resolve this it was suggested to install windows 10 SDK in Qt Blog.

    Other than windows 10 SDK I do have have VC++ installed in my machine. I have also crosschecked all the PATH and LIB variables so as not to mix VC++ libraries and mingw libraries.



  • @Srinivasan.B I don't think you'll be able to get it building with mingw64. Even the Qt devs don't build it for that.

    As I mentioned above, last I checked mingw64 is just too incomplete and missing too many things to successfully build Qt. If you have to have 64-bit using Qt you'll want to use VS unfortunately.

    You mentioned gcc64 which you can't do on windows, unless you are talking about using cygwin for gcc. But I'm 90% sure you can't build Qt with that gcc.

    You're pretty much stuck using VS for 64-bit Qt in windows.



  • I ran into the same problem. Using Win 7, mingw.



  • I have successfully compiled QT5.8.0 with MinGW w64 x64 5.4.0. recently. Be sure to check out all following links if you run into problems:

    https://wiki.qt.io/Building_Qt_5_from_Git
    http://doc.qt.io/qt-5/build-sources.html
    https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW
    https://wiki.qt.io/MinGW
    https://wiki.qt.io/Mingw-64-bit
    http://doc.qt.io/qt-5/windows-requirements.html#gcc-mingw-builds
    http://doc.qt.io/qt-5/supported-platforms-and-configurations.html
    http://doc.qt.io/qt-5/windows-building.html
    https://wiki.qt.io/Building_Qt_Desktop_for_Windows_with_MinGW

    It was only difficult for me because I did not read all that information beforehand. I used OpenSSL 1.0.2k and ICU 57.1 (it is optional, you need MSYS for both of them).

    This is a direct link to the toolchain which I used: https://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win64/Personal Builds/mingw-builds/5.4.0/threads-posix/seh/

    Make sure that it suits you, I remeber that GCC's C++ ABI changed at some 5.x version.

    If you still want to try building it with your version try searching for this header in all files of your toolchain - it is required for MinGW build. By the way, the toolchain which I have has this include file inside, no SDK required.

    #if defined(Q_CC_MINGW)
    #  define HAS_UI_VIEW_SETTINGS_INTEROP
    


  • @_PIB

    Thanks for your input. I could overcome this problem with UIViewSettingsInterop.h. This was because the TDM-gcc 5.1 version doesn't have this file in the include directory. Hence I tried using mingw-gcc version 5.4 from the link which you have provided.

    Now I have another peculiar problem while compiling q3D module. I am pasting the error message below.

    g++ -c -pipe -fno-keep-inline-dllexport -g -std=c++1z -Wall -Wextra -Wno-ignored-qualifiers -Wno-unused-parameter -Wno-unused-variable -Wno-deprecated-declarations -Wno-unused-function -Wno-reorder -Wvla -Wdate-time -frtti -fexceptions -mthreads -DUNICODE -D_DEBUG -D_CRT_SECURE_NO_WARNINGS -DASSIMP_BUILD_NO_OWN_ZLIB -DASSIMP_BUILD_NO_COMPRESSED_IFC -DASSIMP_BUILD_NO_Q3BSP_IMPORTER -DQT_NO_FOREACH -DQT_PLUGIN -DQT_3DEXTRAS_LIB -DQT_3DRENDER_LIB -DQT_3DINPUT_LIB -DQT_3DLOGIC_LIB -DQT_3DCORE_LIB -DQT_GAMEPAD_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -IC:\Qt\qt580-Src\qt3d\src\plugins\sceneparsers\assimp -I. -IC:\Qt\qt580-Src\qt3d\src\3rdparty\assimp -IC:\Qt\qt580-Src\qt3d\src\3rdparty\assimp\code -IC:\Qt\qt580-Src\qt3d\src\3rdparty\assimp\code\BoostWorkaround -IC:\Qt\qt580-Src\qt3d\src\3rdparty\assimp\include -IC:\Qt\qt580-Src\qt3d\src\3rdparty\assimp\include\assimp\Compiler -IC:\Qt\qt580-Src\qt3d\src\3rdparty\assimp\contrib\ConvertUTF -IC:\Qt\qt580-Src\qt3d\src\3rdparty\assimp\contrib\irrXML -IC:\Qt\qt580-Src\qt3d\src\3rdparty\assimp\contrib\poly2tri\poly2tri -IC:\Qt\qt580-Src\qt3d\src\3rdparty\assimp\contrib\clipper -IC:\Qt\qt580-Src\qt3d\src\3rdparty\assimp\contrib\unzip -IC:\Qt\qt580-Src\qt3d\include\Qt3DRender\5.8.0 -IC:\Qt\qt580-Src\qt3d\include\Qt3DRender\5.8.0\Qt3DRender -IC:\Qt\qt580-Src\qt3d\include\Qt3DCore\5.8.0 -IC:\Qt\qt580-Src\qt3d\include\Qt3DCore\5.8.0\Qt3DCore -I........\include\Qt3DCore\5.8.0 -I........\include\Qt3DCore\5.8.0\Qt3DCore -IC:\Qt\qt580-Src\qt3d\include -IC:\Qt\qt580-Src\qt3d\include\Qt3DExtras -I........\include -I........\include\Qt3DExtras -IC:\Qt\qt580-Src\qt3d\include\Qt3DRender -I........\include\Qt3DRender -IC:\Qt\qt580-Src\qt3d\include\Qt3DInput -I........\include\Qt3DInput -IC:\Qt\qt580-Src\qt3d\include\Qt3DLogic -I........\include\Qt3DLogic -IC:\Qt\qt580-Src\qt3d\include\Qt3DCore -I........\include\Qt3DCore -IC:\Qt\qt580-Src\qtbase\include\QtGui\5.8.0 -IC:\Qt\qt580-Src\qtbase\include\QtGui\5.8.0\QtGui -IC:\Qt\build-mingw64\qtbase\include\QtGui\5.8.0 -IC:\Qt\build-mingw64\qtbase\include\QtGui\5.8.0\QtGui -IC:\Qt\qt580-Src\qtgamepad\include -IC:\Qt\qt580-Src\qtgamepad\include\QtGamepad -IC:\Qt\build-mingw64\qtgamepad\include -IC:\Qt\build-mingw64\qtgamepad\include\QtGamepad -IC:\Qt\qt580-Src\qtbase\include -IC:\Qt\qt580-Src\qtbase\include\QtGui -IC:\Qt\build-mingw64\qtbase\include -IC:\Qt\build-mingw64\qtbase\include\QtGui -IC:\Qt\qt580-Src\qtbase\include\QtCore\5.8.0 -IC:\Qt\qt580-Src\qtbase\include\QtCore\5.8.0\QtCore -IC:\Qt\build-mingw64\qtbase\include\QtCore\5.8.0 -IC:\Qt\build-mingw64\qtbase\include\QtCore\5.8.0\QtCore -IC:\Qt\qt580-Src\qtbase\include\QtNetwork -IC:\Qt\build-mingw64\qtbase\include\QtNetwork -IC:\Qt\qt580-Src\qtbase\include\QtConcurrent -IC:\Qt\build-mingw64\qtbase\include\QtConcurrent -IC:\Qt\qt580-Src\qtbase\include\QtCore -IC:\Qt\build-mingw64\qtbase\include\QtCore -I.moc\debug -IC:\Qt\qt580-Src\qtbase\mkspecs\win32-g++ -o .obj\debug\IFCReaderGen1.o C:\Qt\qt580-Src\qt3d\src\3rdparty\assimp\code\IFCReaderGen1.cpp
    C:/mingw64-w64/bin/../lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/bin/as.exe: .obj\debug\IFCReaderGen1.o: too many sections (40549)

    Can someone help me in resolving this error? Thanks in advance.



  • Oh, sorry for forgetting to mention that!

    This needs a workaround because the output object for this specific source is too big/complex. You need to add -Wa,-mbig-obj to the compiler options to overcome that and since Qt does not give any way to feed custom options to compiler I hacked win32-g++ mkspec to fix this: https://filebin.net/wt5xm89nqulsjtm0 . Overwrite qtbase\mkspecs\qin32-g++\qmake.conf with this.

    There is probably a better solution to add this to compiler arguments which I am unaware of. I only know that configure script does not have a documented way of doing this.

    I do not know whether you will need to reconfigure after doing this, you probably do.



  • @_PIB

    Thanks for your help. Finally I was able to compile Qt5.8 for MingW compiler. I did not make any changes in the spec file, rather I passed the additional options during the configure step as follows

    C:\Qt\qt580-Src\configure -prefix "C:\Qt\Qt580" -debug -opensource -shared -opengl desktop -nomake examples -nomake tests -skip qtwebengine -qt-zlib -D ASSIMP_BUILD_NO_OWN_ZLIB -Wa,-mbig-obj

    I also had to pass additional define -D ASSIMP_BUILD_NO_OWN_ZLIB so that q3d module could be built successfully.



  • I never saw -W being mentioned anywhere while I was searching. This post will be first to do it.

    Mark it as solved then.



  • @Srinivasan.B

    Very interesting what you did here. I'm having the same problem now.

    Can you explain to an amateur like me what you mean by "I also had to pass additional define -D ASSIMP_BUILD_NO_OWN_ZLIB so that q3d module could be built successfully."

    Where exactly do you put this line of text? Where is this define written?



  • @Rapidrain He shows the line needed right here:

    C:\Qt\qt580-Src\configure -prefix "C:\Qt\Qt580" -debug -opensource -shared -opengl desktop -nomake examples -nomake tests -skip qtwebengine -qt-zlib -D ASSIMP_BUILD_NO_OWN_ZLIB -Wa,-mbig-obj

    So you pass it to the configure for Qt.



  • @ambershark Thank you muchly. I see now it was a configure option.


Log in to reply