Building Qt 5.7 with MingW64
-
@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.
-
@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)
-
You can set the
QT_OPENGLenvironment variable to desktop or set the application attributeQt::AA_UseDesktopOpenGLbefore 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.
-
You can set the
QT_OPENGLenvironment variable to desktop or set the application attributeQt::AA_UseDesktopOpenGLbefore 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?
-
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.
-
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?
-
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 foundWhat 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.objAm 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..