Some of QT examples are not working - c++

After building QT via my Visual Studio 2010 as described here I find out that most part of demos doesn't work. When I open qtdemo.exe and try to Launch some of them (for example Demonstrations->Browser, Demonstrations->Media Player, Qt Declarative Examples->TV Tennis, ...) the same error message "Could not launch the example. Ensure that it has been built." I get.

If you followed these configure flags from here, then obviously not all examples will work. These are the ones for a minimalistic Qt build:
configure.exe -release -no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools -no-qt3support -no-multimedia -no-ltcg
If you want all example to work (except webkit), then use this:
configure.exe -release -no-webkit -no-ltcg
If you want the to build everything (takes something like 17 GB of HDD space and half a day):
configure.exe

Related

QT Application Crash when mouse is over a push button

I will try to cut the story short as much as I can.
I statically compiled QT 5.11.2 to be able to compile a single executable under windows following this guide:
https://retifrav.github.io/blog/2018/02/17/build-qt-statically/
After many trials, compiling and such I was able to get in "release" mode a .exe of around 15MB.
I compiled it using different MinGW versions with the option "QTPLUGIN.imageformats = -" in the .pro project to avoid -ltiff error.
This is strange as my Application has no image handling opss...
My application is a basic and simple push button (no event associated).
The issue I am facing now is that when the mouse moves over the button and it should turn from grey to light blue the Windows wheel spins for a second before the application crashes with Segmentation fault.
Using dynamic compiling it works well and no crashes.
After many tries I found out that at least another QT objects crashes in the same way which is RadioBox. CheckBox and Tool Button are handled correctly the mouse over event.
I tried to change crashing object properties copying from working objects but still crashes!
I am desperate! After the nightmare of static compiling I landed to this issues and no googling helped me so far.
Tested Compilers are:
MinGW 4.9.2 g++
MinGW 5.3 g++
MinGW 7.3 g++
I also tried to remove the Debugger just in case.
Any help?
I am moving from Rad Studio to QT for its known issues finding more troubles than solutions.
I am posting this as an answer because its far too long for a comment...
I did a "from scratch" install of qt. I did this starting from the qt git hub repo. Once finished, I added it as a kit to my qtcreator and re-built some old GUI projects I had with push buttons. I then took the exe's (they where about 500mb because I used debug config) and ran them on a PC that has never seen Qt (a travel laptop) and the two programs I tested both ran fine with button presses and no crashes.
So, here is the list of instructions that I used (for windows 10), you can perhaps try this from the start to see if this helps:
1. Preparation
In no particular order:
install strawberry perl (required during compilation). Note normal perl does not seem to work very well.
from here: http://strawberryperl.com/
Get the qt source:
git clone https://github.com/qt/qt5.git qt5
git checkout 5.12.1 (specific build instead of 5.12 latest)
git submodule update --init --recursive
git submodule foreach --recursive "git clean -dfx" && git clean -dfx (ensure repo is clean)
Download and install mingw64 (32 bit) from: https://sourceforge.net/projects/mingw-w64/. I used options:
version 7.3.0
Arch i686
Threads posix
Exception dwarf
Build-rev 0
Windows 10 NTFS long path names
Get MediaCreationTool1809.exe from here https://www.microsoft.com/en-gb/software-download/windows10 and run it as admin.
https://superuser.com/questions/1119883/windows-10-enable-ntfs-long-paths-policy-option-missing
Once you installed step 1 (maybe reboot) then you should be able to do windows button "gpedit.msc" and see the open to open gpedit
Right click it, run as admin. Then: Local Computer Policy --> Computer Config --> Administrative Templates --> System --> FileSystem --> Enable Win32 Long Paths (double click)
In there click the enable tick box and ok.
Install Python (required during make install):
From here: https://www.python.org/downloads/
NOTE: in the mingw folder there should be a mingw-xx.bat file to open an cmd prompt environment for gcc. Run this for all cmd prompts to do the following actions.
NOTE: make sure you edit the paths so that strawberry perl .../bin is before any other perl's
So the dos env setup should look like:
set PATH=D:\install\StrawberryPerl\perl\bin;%PATH%
set PATH=D:\install\mingw-w64\i686-7.3.0-posix-dwarf\mingw32\bin;%PATH%
set PATH=D:\install\Qt\qt5\qtbase\bin;%PATH%
set PATH=D:\install\Qt\qt5\gnuwin32\bin;%PATH%
Where D:\install\Qt\qt5 is where my qt5 git repo is.
2. Configuration
2.1. Static Config
Create folder at the same level as ../qt5/ repo called ../qt5-static-build/ (for example) and cd into it, then run:
- ..\qt5\configure -debug -opensource -static -static-runtime -skip webengine -nomake examples -nomake tests -nomake tools -accessibility -no-sql-sqlite -no-opengl -platform win32-g++ -qt-zlib -qt-libpng -qt-libjpeg -confirm-license -prefix "C:\install\Qt\5.12.1-static"
2.2. Shared Lib Config
Create folder at the same level as ../qt5/ repo called ../qt5-build/ (for example) and cd into it, then run:
..\qt5\configure -debug -opensource -skip webengine -nomake examples -nomake tests -nomake tools -accessibility -no-sql-sqlite -no-opengl -platform win32-g++ -qt-zlib -qt-libpng -qt-libjpeg -confirm-license -prefix "C:\install\Qt\5.12.1-sharedlib"
3. Compile and installation
Either way you configured qt (static or not) this part is the same, basically run:
mingw32-make -j8
mingw32-make install -j8
Note: you can use whatever parallel number you want (-j<num-jobs>). Each stage takes a while depending on your CPU of course.
Once you have finished, the install path set in your config line (e.g. C:\install\Qt\5.12.1-static) will contain your qt install. You can then add this in qtcreator as a new qt version (if that is how you are building it).
Appendix - release static configuration
You may want the following configuration if you want release builds etc (but I did not test this yet):
..\qt5\configure with the following options:
-release -optimize-size -opengl desktop -no-pch -platform win32-g++ -opensource -static -static-runtime -skip webengine -nomake examples -nomake tests -nomake tools -accessibility -no-sql-sqlite -no-opengl -platform win32-g++ -qt-zlib -qt-libpng -qt-libjpeg -confirm-license -prefix "C:\install\Qt\5.12.1-static"
where I added:
-release - instead of debug
-optimize-size - make smallest size
-opengl desktop - opengl if you must have it
-no-pch - no pre-compiled headers, not sure you need this, but...
-platform win32-g++ - Again, this may help if you have build issues, but probably don't need it.

Unable to build qt from the source (for the OpenCV)

I am trying to install OpenCV on my Windows 10 following this guide. In order to install it with my own-build libraries, I need to build qt from the source. I downloaded the latest sources from the qt page (5.6.0, I didn't find any other sources availible), but after typing
configure -release -no-webkit -no-phonon -no-phonon-backend -no-script - no-scripttools
-no-qt3support -no-multimedia -no-ltcg
In VS2013/VS2015 command promt, I got an error:
Unknown option -no-webkit
Unable to detect the platform from environment. Use -platform command line
argument or set the QMAKESPEC environment variable and run configure again.
I have an option just to make everything. But I have to specify the platform. I didn't find how to do it.
Can anyone give me a hint, how to install qt correctly? I have VS 2013 and 2015. I am going to use VS2013, since VS2015 is not supported by CUDA toolkit 7.5.
Thanks,
Mikhail
Update: I was able to begin the installation process by typing configure -platform win32-msvc2013 -mp -release (although I have win64), but after accepting the licence, I got an error: execute: File or path was not found(nmake). Screenshot is attached
have you tried with the MSVC2013 command prompt:
configure -platform win32-msvc2013 -mp -release -no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools -no-qt3support -no-multimedia -no-ltcg
then type:
nmake
Update:
Also, before that, try adding the path to your Qt source code, with the bin folder, to the PATH variable of windows.
For instance, if your PATH variable is currently set to %SystemRoot%\system32;%SystemRoot%; and your Qt source code is at C:\dev\Qt-5.6\
then set your PATH variable to %SystemRoot%\system32;%SystemRoot%;C:\dev\Qt-5.6;C:\dev\Qt-5.6\bin
This website explains how to change the PATH variable on Windows, in case you're not familiar with it: http://www.computerhope.com/issues/ch000549.htm
Then restart the MSVC2013 Command Prompt, or Windows. I believe that should help the compilation. Let me know if it solves your problem.
What about this:
-skip qtwebkit
Excluding a Qt Submodule
Configure's -skip option allows certain Qt submodules to be excluded from the Qt build. These submodules correspond to the Git submodules in the standard Qt 5 repository. Note that many packages contain multiple Qt modules. For example, to exclude Qt NFC and Qt Bluetooth from the Qt build, provide -skip qtconnectivity as the argument to configure.

Qt 4.8.5 configure.exe just shows the options

When trying to create a makefile for Qt 4.8.5 with the provided configure.exe, it just shows me the list of options but doesn't configure anything.
What I did:
Downloaded the sourcecode from here http://qt-project.org/downloads
Extracted it to C:/Qt/
Opened the VS2012 Native Tools Command Prompt (tested with x86 and x64)
configure.exe -prefix C:\Qt\4.8.5 -release -qt-sql-sqlite -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-declarative -mp -nomake examples -nomake demos -nomake docs
After this, nothing happens except the output of all possible options.
Does anyone know how to fix this?
EDIT: I couldn't see the errors because the command prompt cut them off. I saved the output with CMD > command.txt and know now, that this is a compiler configuration issue. Thank you, commenters.
These are valid options and work for me.
Do not forget to set up your compiler properly, and also press 'o' for open source for example.

Application crash on exit

i have the following problem: I am programming a little modding tool for a game, and everything works just fine. But when i'm compiling it static, with Qt built static, it crashes when im closing the application. This does not happen when im compiling it with the standard Qt dynamic libraries.
So what am i doing wrong? Here is the output of the gdb, im having:
I would appreciate any help. If you need any part of my code, just say it. I'm actually not sure here, which part of my code i should post!
Thanks
Edit: It appears that the problem is in the buildchain. I built the libraries with the same configuration except the -static. Is my error somewhere in there?
configure -release -nomake examples -nomake demos -no-qt3support -no-scripttools -no-openssl -no-opengl -no-webkit -no-phonon -no-style-motif -no-style-cde -no-style-cleanlooks -no-style-plastique -no-sql-sqlite

Building Qt 4.8 on Windows 8 With VS2010 Pro

I've installed VS2010 Pro on Windows 8 Consumer Preview (x64) for making desktop apps. (no Metro). I have downloaded the Qt 4.8 source and tried to configure it like this:
C:\Libraries\Qt4.8\qt-everywhere-opensource-src-4.8.0>configure -debug-and-relea
se -no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools -no-qt3su
pport
I get this error:
Qt: Untested Windows version 6.2 detected!
Unable to detect the platform from environment. Use -platform command lineargume
nt or set the QMAKESPEC environment variable and run configure again
See the README file for a list of supported operating systems and compilers.
What option/s do I need to set to make it compile?
EDIT: this works:
configure -debug-and-release -no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools -no-qt3support -platform win32-msvc2010
Try adding -platform win32-msvc2010 as an option to configure.