Qt5.7 build and -no-feature- option not existing - c++

I want to do a light build of Qt by disabling some of the features I don't need following the doc at this address http://doc.qt.io/qt-5.7/configure-options.html
As stated
The -feature- and -no-feature- options include and exclude specific features, respectively, where is listed in the file qtbase/src/corelib/global/qfeatures.txt.
Though when trying to use it, it doesn't seem to recognize that option
Unknown option -no-feature-accessibility
I've tried with other features but doesn't seem to be implemented in Qt5.7
As well, the configure -h doesn't do any mention of this option.
Does this was stripped on recent version of Qt and the doc wasn't updated, or has this option name changed. Is there still a way with Qt5.7 to disable features ?

It is no the only option listed in the config but actually missing. For accessibility in particular you should configure with:
-no-accessibility
But be advised, there are Qt modules which depend on accessibility, and will not be built if you remove it in the configuration. For example - QtQuick.Controls and QtQuick.Dialogs. There might be more...
Here are some options I use to streamline my builds by removing features I don't need. Just exclude things that you actually need:
-no-compile-examples -no-icu -opengl desktop -skip qtscript -nomake examples -nomake tests -skip qtwebengine -skip qtvirtualkeyboard -skip qtcharts -skip qtwebchannel -skip qtpurchasing -skip qtwayland -skip qtwebview -no-qml-debug

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.

Qt5.10.1 Cross-Compiled to Raspberry Pi Zero W uses EGLFS instead of XCB

I have been trying to create a GUI application using Qt5 on Raspbian Stretch, but the application doesn't launch correctly unless I specifically tell it to run as XCB. This is fine, as I don't need it running in EGLFS mode, so I went back and configured Qt5 with no EGLFS support, but it still does the same thing.
Configure:
/qt-everywhere-src-5.10.1/configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot /home/bast/cross-compile-rpi/sysroot -prefix /usr/local/qt5pi -opensource -confirm-license -skip qtwebengine -skip qtscript -nomake examples -make libs -no-icu -xcb -no-eglfs -nomake tests -nomake examples -v
When I run make and make install, then rsync the files to my Pi it still defaults to EGLFS mode and the application freezes with this output:
[9;0]Unable to query physical screen size, defaulting to 100 dpi.
To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
Everything works perfectly if I run it as XCB, and I need the application to run along-side other windows, it isn't meant to be run as the primary window for the Pi.
Substitute the -opengl es2 option with -no-opengl and try again
Maybe you need to setting environment on your raspberry pi
export QT_QPA_PLATFORM=xcb

Jetson TX1 Qt Invalid opcode

I have compiled (make -j4) and installed (sudo make install) Qt 5.9.1 on Jetson TX1 Board from NVIDIA with following configure command
./configure
-opensource
-confirm-license
-release
-linuxfb
-no-tslib
-no-sql-sqlite
-qt-libpng
-qt-libjpeg
-qt-freetype
-qt-xkbcommon-x11
-skip multimedia
-skip wayland
-skip winextras
-skip webchannel
-skip webengine
-skip websockets
-skip webkit
-skip webview
-skip webkit-examples
-nomake examples
-nomake tests
-nomake tools
-prefix /usr
-opengl es2
Everything compiled fine and my QtQuick Project also compiled fine.
The trouble started, when i executed the program.
In release mode the program would run for half a minute and then crash without any message. In debug mode the program crashes at startup. I used Callgrind to pinpoint the crash reason and got the following messages:
Since I have compiled Qt with provided gcc/g++ compiler i don't get why an invalid opcode can be found in the libraries.
Any idea what the problem could be?
I also got some troubles on Jetson TX2 when using Qt (OS: Ubuntu 16.04, x64). I used this tutorial:
Install Jetson
It´s working for me so perhaps you can try it with mentioned dependences.
So I think after tedious debugging I got to the origin of the problem.
Apparently the usage of QCharts in QML on aarch64 Systems doesn't really work, at least it produces the crashes. When removing all QCharts from my QML files the program started working, though I now got a memory leak, that might be originating from the QML Image class (even though caching is disabled), so I'm thinking about replacing it with my own renderalgorithm.

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.