Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Unable to compile Qt5.8 with MingW 64 bit compiler
QtWS25 Last Chance

Unable to compile Qt5.8 with MingW 64 bit compiler

Scheduled Pinned Locked Moved Solved Installation and Deployment
16 Posts 7 Posters 10.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A ambershark
    13 Feb 2017, 19:06

    @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. ;)

    S Offline
    S Offline
    Srinivasan.B
    wrote on 14 Feb 2017, 04:48 last edited by
    #4

    @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.

    A 1 Reply Last reply 14 Feb 2017, 06:03
    0
    • S Srinivasan.B
      14 Feb 2017, 04:48

      @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.

      A Offline
      A Offline
      ambershark
      wrote on 14 Feb 2017, 06:03 last edited by
      #5

      @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.

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Monktobia
        wrote on 14 Feb 2017, 21:13 last edited by
        #6

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

        1 Reply Last reply
        0
        • _ Offline
          _ Offline
          _PIB
          wrote on 17 Feb 2017, 10:40 last edited by _PIB
          #7

          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
          
          S 1 Reply Last reply 18 Feb 2017, 14:22
          1
          • _ _PIB
            17 Feb 2017, 10:40

            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
            
            S Offline
            S Offline
            Srinivasan.B
            wrote on 18 Feb 2017, 14:22 last edited by
            #8

            @_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.

            1 Reply Last reply
            0
            • _ Offline
              _ Offline
              _PIB
              wrote on 18 Feb 2017, 14:34 last edited by _PIB
              #9

              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.

              S 1 Reply Last reply 19 Feb 2017, 04:22
              2
              • _ _PIB
                18 Feb 2017, 14:34

                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.

                S Offline
                S Offline
                Srinivasan.B
                wrote on 19 Feb 2017, 04:22 last edited by
                #10

                @_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.

                R 1 Reply Last reply 2 May 2017, 03:46
                0
                • _ Offline
                  _ Offline
                  _PIB
                  wrote on 19 Feb 2017, 05:35 last edited by
                  #11

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

                  Mark it as solved then.

                  1 Reply Last reply
                  0
                  • S Srinivasan.B
                    19 Feb 2017, 04:22

                    @_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.

                    R Offline
                    R Offline
                    Rapidrain
                    wrote on 2 May 2017, 03:46 last edited by Rapidrain 5 Feb 2017, 03:47
                    #12

                    @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?

                    A 1 Reply Last reply 2 May 2017, 04:02
                    0
                    • R Rapidrain
                      2 May 2017, 03:46

                      @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?

                      A Offline
                      A Offline
                      ambershark
                      wrote on 2 May 2017, 04:02 last edited by
                      #13

                      @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.

                      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                      R 1 Reply Last reply 2 May 2017, 04:09
                      0
                      • A ambershark
                        2 May 2017, 04:02

                        @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.

                        R Offline
                        R Offline
                        Rapidrain
                        wrote on 2 May 2017, 04:09 last edited by
                        #14

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

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          Andrej Debenjak
                          wrote on 22 Feb 2018, 23:20 last edited by
                          #15

                          A bit dirty, yet effective solution:

                          sed -i ‘/^ *# *define *HAS_UI_VIEW_SETTINGS_INTEROP *$/d‘ qtbase/src/plugins/platforms/windows/qwin10helpers.cpp

                          _ 1 Reply Last reply 13 Mar 2018, 19:55
                          -1
                          • A Andrej Debenjak
                            22 Feb 2018, 23:20

                            A bit dirty, yet effective solution:

                            sed -i ‘/^ *# *define *HAS_UI_VIEW_SETTINGS_INTEROP *$/d‘ qtbase/src/plugins/platforms/windows/qwin10helpers.cpp

                            _ Offline
                            _ Offline
                            _PIB
                            wrote on 13 Mar 2018, 19:55 last edited by
                            #16

                            @Andrej-Debenjak it's not solution even in the slightest sense.

                            1 Reply Last reply
                            1

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved