Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Building Qt 5.7 with MingW64
Qt 6.11 is out! See what's new in the release blog

Building Qt 5.7 with MingW64

Scheduled Pinned Locked Moved Unsolved General and Desktop
18 Posts 5 Posters 10.4k Views 1 Watching
  • 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.
  • SGaistS SGaist

    @Buckwheat, rather than using the forum for your guides, I'd recommend writing Wiki pages, they'll be easier to find and to link to from the forum.

    BuckwheatB Offline
    BuckwheatB Offline
    Buckwheat
    wrote on last edited by
    #7

    @SGaist Thanks! Can we access the current Wiki to change it? There is some writeup on alternate builds but they are not complete or actually very useful. I was thinking that building Qt is coming up so often that there should be forum topic or a Wiki dedicated just for building the libraries or downloading already completed toolkits.

    Dave Fileccia

    1 Reply Last reply
    0
    • BuckwheatB Buckwheat

      Hi! Welcome!

      It is amazing that this is a common post that keeps coming up. "Building Qt in MinGW64." I know I have posted about MSYS2 and its complete 32bit and 64bit devel kit for Qt (currently 5.61) and QtCreator (4.0.3) using the gcc MinGW64 toolchain (now at 6.1.0).

      I, myself, prefer to focus on using Qt and not building it. I let the pros at Qt or distro builders do that. You can download MSYS2 from https://sourceforge.net/projects/msys2/ and then using pacman, the package manager, can download and install the toolchains and Qt API. Generally takes about 30 minutes to one hour to download and install the complete toolchain and Qt development kit.

      I have other and more complete write-ups in the forum on this. Save some time, headaches, and get doing what you most want to do... create great code!

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #8

      @Buckwheat
      "I, myself, prefer to focus on using Qt and not building it. I let the pros at Qt or distro builders do that."

      So do I! I want to use Qt not build it, but pros at Qt made a silly decision to distribute Windows binaries without "-opengl desktop" option, perhaps their rationale was the fact that windows does not by default provide latest OpenGL drivers, so they wanted to make life of Qt OpenGL developers "better" by providing binaries using that ANGLE.

      However, pros building Qt failed to realize the fact that building the Qt is way more complicated than downloading the OpenGL drivers for your system.

      Hopefully the Qt people noticing this thread will try to fix it and redistribute binary installation of Qt for Windows with -opengl desktop option. Otherwise its just plain stupid

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #9

        @Buckwheat, yes you can. There are already some pages about building Qt e.g. from git.

        @r2com Since Qt 5.5 the backend selection on Windows is dynamic so it basically depends on what GPU/Driver combo you have on a machine. You can force loading the OpenGL backend though.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        ? 1 Reply Last reply
        0
        • SGaistS SGaist

          @Buckwheat, yes you can. There are already some pages about building Qt e.g. from git.

          @r2com Since Qt 5.5 the backend selection on Windows is dynamic so it basically depends on what GPU/Driver combo you have on a machine. You can force loading the OpenGL backend though.

          ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #10

          @SGaist can you expand more on that please?

          How can I force loading the OpenGL backend?

          (i.e. when I open the Boxes OpenGL example, i cant run/build it, because it tells me that for this example to run the Qt had to be compiled with -opengl desktop option)

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #11

            You can set the QT_OPENGL environment variable to desktop or set the application attribute Qt::AA_UseDesktopOpenGL before creating your application object.

            More information here.

            As for the example, you can try by commenting the OpenGL check in the .pro file and either set the environment variable or modify the main.cpp to set the application attribute.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            ? 1 Reply Last reply
            1
            • SGaistS SGaist

              You can set the QT_OPENGL environment variable to desktop or set the application attribute Qt::AA_UseDesktopOpenGL before creating your application object.

              More information here.

              As for the example, you can try by commenting the OpenGL check in the .pro file and either set the environment variable or modify the main.cpp to set the application attribute.

              ? Offline
              ? Offline
              A Former User
              wrote on last edited by A Former User
              #12

              @SGaist Looking into this now.

              Another question, is there any way to have Qt 5.7 use the Mingw64 compiler as well instead of Msvc64? Or in that case I definitely need to comnpile Qt myself?

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #13

                No you can't but that's nothing Qt specific. You can't mix and match compilers on Windows. Even the different version of MSVC are not compatible one with the other.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                ? 1 Reply Last reply
                0
                • SGaistS SGaist

                  No you can't but that's nothing Qt specific. You can't mix and match compilers on Windows. Even the different version of MSVC are not compatible one with the other.

                  ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #14

                  @SGaist Also, meanwhile I am trying now to build it with MSYS2, and here is an error I have encountered:

                  C:/Qt/qt5/qtbase/src/corelib/tools/qsimd.cpp:43:22: fatal error: QByteArray: No such file or directory
                   #include <QByteArray>
                                        ^
                  compilation terminated.
                  
                  

                  Any ideas what is going on?

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #15

                    I'd check whether the forwarded headers were created successfully.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #16

                      But isn't it not dependent on me? In other words, should I just start searching for the file name "QByteArray" and just correcting each source file to point to it? That rather sounds not good to me though...

                      And another question, now regarding those attributes, I opened that OpenGL Boxes example now in the Installed QtCreator, and put this line right before instantiating QApplication:

                      setAttribute(Qt::AA_UseDesktopOpenGL, true);
                      

                      And got the rrror:
                      ..\boxes\main.cpp(114): error C3861: 'setAttribute': identifier not found

                      What is the proper way of setting that attribute?

                      1 Reply Last reply
                      0
                      • ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by A Former User
                        #17

                        OK nevermind I had to set attribute this way:

                            QApplication app(argc, argv);
                            app.setAttribute(Qt::AA_UseDesktopOpenGL, true);
                        

                        However; now I get tons of LNK2019 errors, like:

                        glbuffers.obj:-1: error: LNK2019: unresolved external symbol __imp_glDisable referenced in function "public: virtual void __cdecl GLTexture2D::unbind(void)" (?unbind@GLTexture2D@@UEAAXXZ)
                        
                        File not found: glbuffers.obj
                        

                        Am I supposed to do something more than just setting the OpenGL related attribute?

                        1 Reply Last reply
                        0
                        • ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by
                          #18

                          Alright, I also added "LIBS += opengl32.lib" to the boxes.pro file, now it compiles and runs..so, I guess it worked.

                          In any case, building mingw64 with Qt is just straight out disaster, unless one is going to spend significant time on resolving things or be part of dev team...

                          The main download page for Qt has all kinds of pre-built versions, MSVC64 and MINGW32...but why not MINGW64..

                          1 Reply Last reply
                          0

                          • Login

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