Running example 'widgets\graphicsview\boxes' under windows7, needs '-opengl desktop' error
-
Hello everyone!
I have recently downloaded the newest Qt 5.12.3 through the online installer. It has been almost 10 years since i last did some programming (still have my 'I Qt everywhere' t-shirt =8) ). So i thought i tried some examples. The one that i was very interested in was the above mentioned 'boxes' example. Now, after having gotten the error message:":-1: Fehler: This example requires Qt to be configured with -opengl desktop", i tried to find some useful information on the internet to solev this problem. What i found said i would have to configure my Qt with "configure -opengl desktop". So i did that (i looked a little further and found that when i add -prefix and then a path, that i could then make the files in a specific location; i thought that sounded good). So after configure i used "mingw32-make" (i choose to not go with Visual Studio... the reasons fpr that shall remain in the dark... =;) ) and then after a while i typed "mingw32-make install". So now i have Qt with opengl desktop support... at least thats what i am assuming.
Now the question i have not been able to find an answer for is: how do i tell the example and Qt Creator 4.9.1 (Opensource) to go take that specifc Qt which i had just created with the opengldesktop support and run that example with it?Please bear with me... i am older and it has been a while =;)
-
Hi and welcome to devnet,
Take a look at the related chapter in the Qt Creator documentation.
One thing you can also try is to force the use of the desktop OpenGL backend when starting your application. See the dedicated paragraph in Qt for Windows - Requirements in Qt's documentation.
-
Thanks for the tips.
The first one, i thought, might be what i was looking for, however, i did not get a qmake.exe in the folder after mingw32-make install. The folder does have a subfolder "mkspecs" which i believe usualy would have a qmake.exe, but the folder is empty except for one subfolder by the name "modules". I am guessing that something went wrong with me configuring and making Qt from source.Here are the steps i took to configure and subsequently build:
configure -prefix path_to_folder -opengl desktop
mingw32-make
mingw32-make install
I am guessing i should have added something else to configure to get a more complete folder "mkspecs" (which may or may not be short for 'make specifications'?).
I have not investigated your second suggestion yet @SGaist.
-
The main thing you forgot is to add
-no-make tests -no-make examples
(it would have saved you time and disk space).The binaries (qmake and friends) are found in the bin folder.
mkspecs
are the configurations for the different platforms/devices. -
What I meant is that without that switch, it would compile all examples which is not what you want.
-
I do not think i follow you there SGaist. Are you saying, that if i used 'configure' without '-no-make examples' i would then be able to compile Qt with ALL examples?
I thought i specifically said i want to run the exmaple 'boxes', but cannot, because Qt was not configured with opengl desktop. And i am trying to get around that error.
I have now downloaded the newest version of Qt 5.12.3. This is what i have on my drive:
So now, i would open a command line console, go into the 'Src' folder and start the process of configuring and subsequently building Qt, righ?
All because i would like to be able to run the example 'boxes' which needs a Qt version configured to run opengl desktop. I also would like to use mingw instead of msvc.
So what would my configure command have to look like?
Here is my guess:
configure.bat -prefix 'path_to_folder' -opengl desktop -platform win32-g++
Am i missing something, or should i then be able to open the exmaple 'boxes' in Qt creator, select a kit and run the example?
Right now i am not concerned about saving time or diskspace. I am just not at the point where i understand the process enough to make meaningful decisions about streamlining the process.
-
The "-no-make example" just avoids the build system to build all examples as part of the build. They are still there, just not built.
One thing you should do is out of source builds. This will allow you to just nuke the build folder if something goes awry.
Your guess is correct, but at least add
-no-make tests
.Did you try my suggestion of forcing the backend selection ?
-
@SGaist first off: no, i did not try your second suggestion. I might get back to that later. I basically just redownloaded anew (thats what you see in the filetree; thats whats on my drive after having downloaded only Qt source and the tools you see).
Now i tried to configure, mingw32-make.This was the result (the last command is the 'configure' i used):
-
i just reran mingw32-make and i got a different error:
g++ -c -include .pch\debug\lib_pch.h -fno-keep-inline-dllexport -g -Og -std=c++1y -fno-exceptions -Wall -W -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQDESIGNER_SDK_LIBRARY -DQDESIGNER_EXTENSION_LIBRARY -DQDESIGNER_UILIB_LIBRARY -DQDESIGNER_SHARED_LIBRARY -DQT_DESIGNER -DQT_USE_QSTRINGBUILDER -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_DESIGNER_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_NO_EXCEPTIONS -DQT_UIPLUGIN_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_UIPLUGIN_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -Iextension -Isdk -Ishared -I......\shared\qtpropertybrowser -I......\shared\deviceskin -I......\shared\findwidget -I......\shared\qtgradienteditor -Iuilib -I........\include -I........\include\QtDesigner -I........\include\QtDesigner\5.12.3 -I........\include\QtDesigner\5.12.3\QtDesigner -Itmp -ID:\Qt\5.12.3_online_installer\5.12.3\Src\qtbase\include\QtWidgets\5.12.3 -ID:\Qt\5.12.3_online_installer\5.12.3\Src\qtbase\include\QtWidgets\5.12.3\QtWidgets -ID:\Qt\5.12.3_online_installer\5.12.3\Src\qtbase\include\QtGui\5.12.3 -ID:\Qt\5.12.3_online_installer\5.12.3\Src\qtbase\include\QtGui\5.12.3\QtGui -ID:\Qt\5.12.3_online_installer\5.12.3\Src\qtbase\include\QtCore\5.12.3 -ID:\Qt\5.12.3_online_installer\5.12.3\Src\qtbase\include\QtCore\5.12.3\QtCore -I........\include\QtUiPlugin -ID:\Qt\5.12.3_online_installer\5.12.3\Src\qtbase\include -ID:\Qt\5.12.3_online_installer\5.12.3\Src\qtbase\include\QtWidgets -ID:\Qt\5.12.3_online_installer\5.12.3\Src\qtbase\include\QtGui -ID:\Qt\5.12.3_online_installer\5.12.3\Src\qtbase\include\QtXml -ID:\Qt\5.12.3_online_installer\5.12.3\Src\qtbase\include\QtCore -I.moc\debug -I.uic -ID:\Qt\5.12.3_online_installer\5.12.3\Src\qtbase\mkspecs\win32-g++ -o .obj\debug\qtgradientstopscontroller.o ......\shared\qtgradienteditor\qtgradientstopscontroller.cpp
......\shared\qtgradienteditor\qtgradientstopscontroller.cpp: In member function 'void QtGradientStopsControllerPrivate::enableCurrent(bool)':
......\shared\qtgradienteditor\qtgradientstopscontroller.cpp:99:9: error: invalid use of incomplete type 'class Ui::QtGradientEditor'
m_ui->positionLabel->setEnabled(enable);
^~
In file included from ......\shared\qtgradienteditor\qtgradientstopscontroller.cpp:40:0:
......\shared\qtgradienteditor\qtgradientstopscontroller.h:48:11: note: forward declaration of 'class Ui::QtGradientEditor'
class QtGradientEditor;
^~~~~~~~~~~~~~~~
......\shared\qtgradienteditor\qtgradientstopscontroller.cpp:100:9: error: invalid use of incomplete type 'class Ui::QtGradientEditor'
m_ui->colorLabel->setEnabled(enable);
^~
In file included from ......\shared\qtgradienteditor\qtgradientstopscontroller.cpp:40:0:
......\shared\qtgradienteditor\qtgradientstopscontroller.h:48:11: note: forward declaration of 'class Ui::QtGradientEditor'
class QtGradientEditor;
^~~~~~~~~~~~~~~~
......\shared\qtgradienteditor\qtgradientstopscontroller.cpp:101:9: error: invalid use of incomplete type 'class Ui::QtGradientEditor'
m_ui->hLabel->setEnabled(enable);
^~
In file included from ......\shared\qtgradienteditor\qtgradientstopscontroller.cpp:40:0:
......\shared\qtgradienteditor\qtgradientstopscontroller.h:48:11: note: forward declaration of 'class Ui::QtGradientEditor'
class QtGradientEditor;
^~~~~~~~~~~~~~~~
......\shared\qtgradienteditor\qtgradientstopscontroller.cpp:102:9: error: invalid use of incomplete type 'class Ui::QtGradientEditor'
m_ui->sLabel->setEnabled(enable);
^~
In file included from ......\shared\qtgradienteditor\qtgradientstopscontroller.cpp:40:0:
......\shared\qtgradienteditor\qtgradientstopscontroller.h:48:11: note: forward declaration of 'class Ui::QtGradientEditor'
class QtGradientEditor;
^~~~~~~~~~~~~~~~
......\shared\qtgradienteditor\qtgradientstopscontroller.cpp:103:9: error: invalid use of incomplete type 'class Ui::QtGradientEditor'
m_ui->vLabel->setEnabled(enable);
^~
In file included from ......\shared\qtgradienteditor\qtgradientstopscontroller.cpp:40:0:
......\shared\qtgradienteditor\qtgradientstopscontroller.h:48:11: note: forward declaration of 'class Ui::QtGradientEditor'
class QtGradientEditor;
^~~~~~~~~~~~~~~~
......\shared\qtgradienteditor\qtgradientstopscontroller.cpp:104:9: error: invalid use of incomplete type 'class Ui::QtGradientEditor'
m_ui->aLabel->setEnabled(enable);and it goes on for quite a while until
Makefile.Debug:28987: recipe for target '.obj/debug/qtgradientstopscontroller.o' failed
mingw32-make[6]: *** [.obj/debug/qtgradientstopscontroller.o] Error 1
mingw32-make[6]: Leaving directory 'D:/Qt/5.12.3_online_installer/5.12.3/Src/qttools/src/designer/src/lib'
Makefile:42: recipe for target 'debug-all' failed
mingw32-make[5]: *** [debug-all] Error 2
mingw32-make[5]: Leaving directory 'D:/Qt/5.12.3_online_installer/5.12.3/Src/qttools/src/designer/src/lib'
Makefile:97: recipe for target 'sub-lib-make_first' failed
mingw32-make[4]: *** [sub-lib-make_first] Error 2
mingw32-make[4]: Leaving directory 'D:/Qt/5.12.3_online_installer/5.12.3/Src/qttools/src/designer/src'
Makefile:42: recipe for target 'sub-src-make_first' failed
mingw32-make[3]: *** [sub-src-make_first] Error 2
mingw32-make[3]: Leaving directory 'D:/Qt/5.12.3_online_installer/5.12.3/Src/qttools/src/designer'
Makefile:77: recipe for target 'sub-designer-make_first' failed
mingw32-make[2]: *** [sub-designer-make_first] Error 2
mingw32-make[2]: Leaving directory 'D:/Qt/5.12.3_online_installer/5.12.3/Src/qttools/src'
Makefile:44: recipe for target 'sub-src-make_first' failed
mingw32-make[1]: *** [sub-src-make_first] Error 2
mingw32-make[1]: Leaving directory 'D:/Qt/5.12.3_online_installer/5.12.3/Src/qttools'
Makefile:971: recipe for target 'module-qttools-make_first' failed
mingw32-make: *** [module-qttools-make_first] Error 2I was unaware, that building Qt from source would pose such a big problem...
-
These are parts of the tests. I currently don't know why it's failing like that however, you really should add
-no-make tests
to your configure options. AFAIK, you are not going to hack on Qt so it makes little sense to build all Qt's tests to get the build you are looking for. -
-
@TopDoozer said in Running example 'widgets\graphicsview\boxes' under windows7, needs '-opengl desktop' error:
Do i need to revert anything before i run configure and mingw32-make again?
You should start from clean state. Best is to use out of source builds.
-
OK. So i now created a 'build' folder. Opened a console in that folder and called configure.bat from there. This is the configure.log file:
Command line: -prefix d:\Qt\Qt5.12.3\build -opengl desktop -nomake tests
I do have a configure.log file.... but i cannot upload it and its toolong to post in toto.
There are a couple of configure tests that fail:executing config test alloca_h
- cd /d D:\Qt\Qt5.12.3\build\config.tests\alloca_h && D:\Qt\Qt5.12.3\build\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" D:/Qt/Qt5.12.3/build/config.tests/alloca_h
- cd /d D:\Qt\Qt5.12.3\build\config.tests\alloca_h && set MAKEFLAGS=& mingw32-make
g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -I. -ID:\Qt\Qt5.12.3\5.12.3\Src\qtbase\mkspecs\win32-g++ -o main.o main.cpp
main.cpp:2:20: fatal error: alloca.h: No such file or directory
#include <alloca.h>
^
compilation terminated.
Makefile:165: recipe for target 'main.o' failed
mingw32-make: *** [main.o] Error 1
test config.qtbase.tests.alloca_h FAILEDis the first one...
-
@TopDoozer Failing tests are normal. The question is: is any feature you need disabled because of failing tests? If not then just build.
-
@TopDoozer No, it should not fail, but some features will not be built.