Building Qt 5.7 with MingW64



  • I am building the Qt 5.7 with MingW64, I have the following errors:

    ar -M < object_script.libQt5PlatformSupport.Release
    mingw32-make[4]: Leaving directory 'C:/Qt/Qt57_build/qtbase/src/platformsupport'
    ar -M < object_script.libQt5PlatformSupportd.Debug
    mingw32-make[4]: Leaving directory 'C:/Qt/Qt57_build/qtbase/src/platformsupport'
    mingw32-make[3]: Leaving directory 'C:/Qt/Qt57_build/qtbase/src/platformsupport'
    mingw32-make[2]: Leaving directory 'C:/Qt/Qt57_build/qtbase/src'
    Makefile:41: recipe for target 'sub-src-make_first' failed
    mingw32-make[1]: *** [sub-src-make_first] Error 2
    mingw32-make[1]: Leaving directory 'C:/Qt/Qt57_build/qtbase'
    Makefile:73: recipe for target 'module-qtbase-make_first' failed
    mingw32-make: *** [module-qtbase-make_first] Error 2
    

    I know that it is not full description of errors, but where do I find their full description? I skimmed through folders and did not find any log files or something like that. Any ideas?



  • Hi & welcome,

    The part of the compiler output that you posted is the end when all jobs are being terminated. It doesn't show the actual error. The errors would likely be shown somewhere above that.
    Can you please paste the entire compilation output?




  • Moderators

    @r2com It looks like Qt5Core was not built. How and from where did you call configure and make?
    C:/Qt/Qt57_build/qtbase/bin/uic.exe: error while loading shared libraries: Qt5Core.dll: cannot open shared object file: No such file or directory



  • 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!


  • Lifetime Qt Champion

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



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



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


  • Lifetime Qt Champion

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



  • @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)


  • Lifetime Qt Champion

    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.



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


  • Lifetime Qt Champion

    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.



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


  • Lifetime Qt Champion

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



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



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



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.