Unable to build qt from the source (for the OpenCV) - c++

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.

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.

Qt Application becomes windows-old styled after build on a buildbot

I started the migration from Qt 5.6 to 5.10.1 and faced with this problem. On 5.6 ver the style was "windowsvista" and all works well. Now it looks like Qt can't detect this one and use "windows" style.
Moreover, on my PC, the build of 5.10.1 looks good. It works on Windows 10 x64, same as buildbot.
Configuration line:
-release -prefix C:\repository\x64\qt5 -force-debug-info -platform win32-msvc2013 -nomake examples -no-compile-examples -nomake tests -opengl dynamic -opensource -confirm-license -mp -no-strip
I build Qt without Ruby and Perl libs, because it's unnecessary for my project.
Maybe the problem in configuration, because in 5.6 there was configureapp.exe in /qtbase and now I can't see it. But I do not understand the reason.
I found a problem. After Qt5.10.1 the "windowsvista" style becomes a plugin. So in the final deploy file windowsvistastyle.dll schould exists. I add a folder "/styles" with this .dll and a problem is gone.

configure:file not found while static linking Qt 5.4 project in linux

I have an application which i want to deploy using static linking.I am using Qt 5.4 and ubuntu.I learnt that to deploy my application i have to bulid qt statically using the following code
cd /path/to/Qt
./configure -static -prefix /path/to/Qt <other parameters>
make sub-src
i have Qt installed in home/Qt5.4.0
When i run the above code it says that
configure:no such file
When i check the Qt directory there is indeed no configure file.I could only find
configure.prf
in Qt5.4.0/5.4/gcc_64/mkspecs/features/
this may be novice but how should i deploy my application now?
I can describe steps I did for Windows.
Configure Qt static build. For this download source code and in e.g. d:\Qt\5.4\Src\qtbase\mkspecs\win32-g++\qmake.conf change line QMAKE_LFLAGS = to QMAKE_LFLAGS = -static -static-libgcc. Then save and exit.
Make Qt. In console (preferably one from Qt folder like Qt 5.4 for Desktop (MinGW 4.9 32 bit) go to d:\Qt\5.4\Src\qtbase, change environment variables
set LIB=
set INCLUDE=
SET QTDIR=D:\Qt\5.4\Src\qtbase
SET QMAKESPEC=win32-g++
SET PATH=C:\Python34;c:\Strawberry\perl\bin;d:\Qt\Tools\mingw491_32\bin;d:\Qt\5.4\Src\qtbase\bin;%PATH%
Start configuration (accept license) and make.
configure.exe -debug-and-release -opensource -c++11 -static -opengl desktop -no-angle -no-vcproj -nomake examples -nomake demos
mingw32-make.exe (This can take time)
Add kit in Qt Options (Build & Run tab)
Chose new kit for the project. Should work.

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.

Creating Qt 5.1 apps for iOS

The new Qt 5.1 has (partial) support for iOS as mentioned in the release announcement, but how do I actually build and deploy a Qt project to a iOS device? Or in other words, how do I end up with a iOS XCode project?
This shows how to compile qt5 for the iOS simulator.
Based on qt build instructions for iOS.
If you want to build for an iOS device, you have to check out the qt5 sources a second time to a second directory and use the alternate configure command as shown below.
This uses qt 5.2 beta 1. Check for newer versions with git tag.
git clone git://gitorious.org/qt/qt5.git qt5-ios-simulator.git
cd qt5-ios-simulator.git
git tag
git reset --hard v5.2.0-beta1
Initialize qt but do not use webkit because it takes too long to compile
perl init-repository --no-webkit
Configure qt to use open source version with simulator, skipping examples and test
./configure -xplatform macx-ios-clang -developer-build -opensource -release -nomake examples -nomake tests -sdk iphonesimulator
Alternatively, use this configure command in a separate git checkout to build for iOS devices
./configure -xplatform macx-ios-clang -developer-build -opensource -release -nomake examples -nomake tests
Run make. Uses 4 jobs in parallel for faster compilation.
make -j 4
cd ..
Done.
You may test if everything works by building an example project
git clone https://github.com/msorvig/qt-ios-demo.git
cd qt-ios-demo
../qt5-ios-simulator.git/qtbase/bin/qmake
open qt-ios-demo.xcodeproj
I have not tried it myself yet but I would guess have to install XCode and Qt Creator on your OSX. As I know the Qt guys its probably like the Android version. Just try to install the Qt SDK with the online installer and select the iOS version. The rest should be possible in QtCreator. I would be interested to know if it worked.