Qt 4.8.5 configure.exe just shows the options - c++

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.

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.

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.

How to compile Qt 5 under Windows or Linux, 32 or 64 bit, static or dynamic on Visual Studio or g++

Just a post to help those guys trying to do that, since I don't have a blog.
This works for linux too. Feel free to edit it and improve it.
Note: There's also another article I wrote to compile from GIT source here with an automated script on Windows. You may modify it for Linux as the difference is shown in this post.
This article is continuously being updated. If this helps you, please give it a "thumbs up" so that I could know that it's helping people and not being useless.
If you have any comments or you found typos, please let me know so that I can fix them.
First thing, it doesn't matter whether you want to compile 32 or 64 bit version. The only difference is the command prompt shortcut that you have to choose from Visual Studio, which will initialize different environment variables.
Let's begin with this:
Download and install Perl: Download link
Download and install Python: Download link
Download and install Windows SDK (probably not necessary, but recommended)
I use Windows 8, so this is the version I used: Download link
,Otherwise find the proper version for your Windows.
Download and install DirectX SDK (probably necessary if you wanna compile with OpenGL)
Download link
Download and extract jom to some folder (not needed for linux) (jom is a tool for compiling stuff with VS in parallel, there's a way to do this with nmake, but I'm not familiar with it) Download link
Download Qt Opensource, and extract it, say to C:\Qt\Qt5.6, so now the folder qtbase can be found in C:\Qt\Qt5.6\qtbase .
Only for Windows: DO YOU REALLY WANT IT TOTALLY STATIC?
Usually, even if you choose the compilation to be static, the compiler itself will still not merge its libraries statically. If you want your compiled source to be fully static with respect to the compiler (Visual Studio), you have to do this tweak in the QMAKE files of Qt.
Go to the file (starting from your Qt source directory), for versions higher than 2012, just use the right version everywhere (such as win32-msvc2015):
a. For VS2012: qtbase\mkspecs\win32-msvc2012\qmake.conf
b. For VS2010: qtbase\mkspecs\win32-msvc2010\qmake.conf
c. For Qt 5.5.0 and later (with any VS version): qtbase\mkspecs\common\msvc-desktop.conf
and edit the following lines
QMAKE_CFLAGS_RELEASE = -O2 -MD
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi
QMAKE_CFLAGS_DEBUG = -Zi -MDd
to
QMAKE_CFLAGS_RELEASE = -O2 -MT
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
QMAKE_CFLAGS_DEBUG = -Zi -MTd
Note: Qt 5.6+ have a configure parameter -static-runtime that will do this for you. You may not need to do this manually anymore for new versions of Qt.
Start the terminal in linux, or in Windows, start the terminals of Visual Studio (which have the correct environment variables set, or alternatively use vcvarsall.bat). To start the command prompt and let it do this automatically for you, go to Start, All Programs:
For Windows versions prior to 8: Find the Microsoft Visual Studio 201x folder, and launch the command prompt (either x86 for 32 bit or x64 for 64 bit).
For Windows 8: go to Start, type "cmd" and all versions available for command prompt will show up. Choose the Visual Studio version appropriate (x86 for 32 bit or x64 for 64 bit).
Following is a screenshot of how it may look like. Always tend to select "Native" if it exists.
9.
For VS2012: Execute the following commands for VS2012
set QMAKESPEC=win32-msvc2012
set QTDIR=C:\Qt\Qt5.7\qtbase
set PATH=C:\Qt\Qt5.7\qtbase\bin;%PATH%
Note: Setting QMAKESPEC environment variable is considered wrong for Qt versions 5.8+. Don't do it for the new versions.
For dynamic linking (needs 8 GBs)
configure -debug-and-release -opensource -platform win32-msvc2012 -opengl desktop
For dynamic linking with no examples (needs 2 GB)
configure -debug-and-release -opensource -platform win32-msvc2012 -opengl desktop -nomake examples -nomake tests
Now the last command depends on what you want to compile. Just type configure -help and see what the available command-line parameters are.
For static linking (needs 70 GBs, yes it's crazy, it's more reasonable not to make the examples and demos).
configure -debug-and-release -opensource -platform win32-msvc2012 -opengl desktop -static
For static linking with no examples (needs 4 GBs, makes more sense).
configure -debug-and-release -opensource -platform win32-msvc2012 -opengl desktop -static -nomake examples -nomake tests
Now this will take a minute or two, then use jom as follows (assuming it's extracted in C:\Qt\jom):
C:\Qt\jom\jom.exe -j 50
50 represents the number of cores you want to use. I use 50 because I have 8 threads and using only 8 will not occupy all cores completely, so more is better, but don't get too greedy as it could make your system not responsive.
For VS2010: Execute the following commands for VS2010
set QMAKESPEC=win32-msvc2010
set QTDIR=C:\Qt\Qt5.7\qtbase
set PATH=C:\Qt\Qt5.7\qtbase\bin;%PATH%
Note: Setting QMAKESPEC environment variable is considered wrong for Qt versions 5.8+. Don't do it for the new versions.
For dynamic linking (needs 8 GBs)
configure -debug-and-release -opensource -platform win32-msvc2010 -opengl desktop
For dynamic linking with no examples (needs 2 GB)
configure -debug-and-release -opensource -platform win32-msvc2010 -opengl desktop -nomake examples -nomake tests
The last command depends on what you want to compile. Just type configure -help and see what the available command-line parameters are.
For static linking (needs 70 GBs, yes it's crazy, it's more reasonable not to make the examples and demos).
configure -debug-and-release -opensource -platform win32-msvc2010 -opengl desktop -static
For static linking with no examples (needs 4 GBs, makes more sense).
configure -debug-and-release -opensource -platform win32-msvc2010 -opengl desktop -static -nomake examples -nomake tests
Now this will take a minute or two, then use jom as follows (assuming it's extracted in C:\Qt\jom):
C:\Qt\jom\jom.exe -j 50
50 represents the number of cores you want to use. I use 50 because I have 8 threads and using only 8 will not occupy all cores completely, so more is better, but don't get too greedy as it could make your system not responsive.
For linux:
There's one small difference for Linux over Windows. It's recommended in linux to install after compiling. Honestly this is the only way it works for me without problems.
Execute the following commands for Linux. Don't forget to replace the paths with the correct paths of your Qt source
export QMAKESPEC=linux-g++
export QTDIR=/home/username/Qt5.7/qtbase
export PATH=/home/username/Qt5.7/qtbase/bin:$PATH
Note: Setting QMAKESPEC environment variable is considered wrong for Qt versions 5.8+. Don't do it for the new versions.
Let's say you want to install the compiled source to the directory /home/username/Qt5.7-install. In this case, add the following to any of the configure commands below:
-prefix /home/username/Qt5.7-install
Warning: DO NOT install to the same source directory. That's plain wrong!
If -prefix is not set, the default path will be chosen, which is /usr/local/ I guess. I don't like to install anything using root. I always prefer installing in my user folder, so that reversibility and upgrades are not a problem.
The following are different possible configure commands depending on what you want to do.
For dynamic linking (needs 8 GBs)
./configure -debug-and-release -opensource -platform linux-g++ -opengl desktop
For dynamic linking with no examples (needs 2 GB)
./configure -debug-and-release -opensource -platform linux-g++ -opengl desktop -nomake examples -nomake tests
Now the last command depends on what you want to compile. Just type ./configure -help and see what the available command-line parameters are.
For static linking (needs 70 GBs, yes it's crazy, it's more reasonable not to make the examples and tests).
./configure -debug-and-release -opensource -platform linux-g++ -opengl desktop -static
For static linking with no examples (needs 4 GBs, makes more sense).
./configure -debug-and-release -opensource -platform linux-g++ -opengl desktop -static -nomake examples -nomake tests
After making is done, run make command
make -j 50
50 represents the number of cores you want to use. I use 50 because I have 8 threads and using only 8 will not occupy all cores completely, so more is better, but don't get too greedy as it could make your system not responsive.
Wait 2+ hours till the compilation is complete.
Clean up! You can save a lot of space using this command for Windows: C:\Qt\jom\jom.exe clean And this command for linux: make clean
You can reduce the size of your compiled folder from 8 GB to 2.5 GB (for dynamic linking) and from 70 GB to 35 GB (for static linking).
In order to use this compiled version in Qt Creator:
Start Qt Creator
Go to Tools, Options
Select Build and Run from the list on the left.
Go to "Qt Versions" tab
Click on "Add" and select qmake from the folder where your bin in
qtbase is, so from above:
C:\Qt\Qt5.7\qtbase\bin\qmake.exe
(or for Linux choose the path where you installed the compiled Qt source, which is equivalent to /home/username/Qt5.7-install/qtbase/bin/qmake in this tutorial)
Click "Apply"
Go to "Kits" tab
Click "Add"
Give it a name, choose the appropriate compiler (FOR VISUAL STUDIO
EXPRESS DO NOT SELECT amd64 FOR 64-BIT , IT WON'T WORK, CHOOSE
x86_amd64 INSTEAD)
Click OK.
Now just open a project and you'll find it asking you to choose the kit you added.
Enjoy :)

Some of QT examples are not working

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