How to improve Qt + MSVC compile times on Windows 7? - qt

The compile times on Windows 7 with Qt, using MSVC10 express and MS SDK 7.1 are longer than they were under Windows XP (still using MSVC10). What's more, when using MinGW my compile times are faster than either MSVC10 scenario.
The CPU seems to only spend 10% max and "Jom" is present.
Would anyone have an idea as to what might cause this? Is there anything I can do to speed up my compile times?

You mention that jom is present. Please set for the make-command the parameter "-j 8". Where 8 is just as example - not sure how many threads your machine can fed properly. Because your cpu-usage of ~10% indicates that just a single core is used.

Related

Qt application crash on Wayland

I've recently installed Ubuntu 22.04 LTS on my development laptop. Previously I was running 18.04 so this is my first experience of Wayland. I did a clean installation on a new disc. I had relatively few problems reinstalling gitkraken and cloning the repository of my source code from github but when I came to install the Qt libraries this is where my problems started. The on-line installer from the Qt website simply wouldn't run. It just exited silently. I eventually found an old version of the on-line installer executable in a backup of my downloads folder from Ubuntu 18.04 and was able to use this to download and install the same version of the Qt libraries that I was using previously (5.15.0). This is also the same version that I use on my other development machine which runs Windows 10. Keeping the two in step is useful and upgrading too many things at the same time seemed like asking for trouble. I installed the latest versions of Qt Creator (7.0.1) and g++ (11.2.0).
I was then able to build my application and, after a brief search of stack overflow I added "-platform wayland" to the command line arguments setting in Qt Creator but the application crashed almost immediately on start-up with the error "The Wayland connection experienced a fatal error: Protocol error".
Several things made me think this might be a bug in the Qt libraries rather than my application (none of them definitive!):
At the point of application exit, apart from main() there is none of my application code in the call-stack (see below)
My application has been stable for a long time and has survived several operating system, compiler and Qt version changes across two OS families
The fact that the latest Qt on-line installer (itself almost certainly a Qt application) wouldn't run
I downloaded Qt 5.15.12 (the latest Qt 5 version available) and rebuilt my application against that but the result was the same.
The next step is obviously to strip my application right down to something minimal that still shows the problem but before I do I was wondering whether this is something other people have come across when migrating a Qt5 application to Wayland and whether I need to take the bigger step of upgrading to Qt6? The Qt Wiki describes Qt 5.11 as being "stable" with Wayland.
The call stack at the time of the error looks like this:
qt_message_fatal
QMessageLogger::fatal
QtWaylandClient::QWaylandDisplay::checkError
QtWaylandClient::QWaylandDisplay::flushRequests
doActive
QMetaObject::activate
QSocketNotifier::activated
QSocketNotifier::event
QApplicationPrivate::notify_helper
QApplication::notify
QCoreApplication::notifyInternal2
QCoreApplication::sendEvent
socketNotifierSourceDispatch
g_main_context_dispatch
??
g_main_context_iteration
QEventDispatcherGlib::processEvents
QEventLoop::exec
QCoreApplication::exec
main
Many thanks.
It's something to do with QDialog::setMaximumSize. The call to setMaximumSize itself does not crash but if I remove all calls to it the application works fine. Some controls do subjectively seem bigger on Wayland so I wonder if Qt 5 on Wayland crashes if the size of the QDialog contents exceeds the maximum size specified. This certainly doesn't cause a crash in Qt 5 on Windows and didn't in Qt 5 on Ubuntu prior to the switch to Wayland. I think this is a Qt bug but of course it may well be fixed in a later version of Qt and there's an easy enough work-around now I know the cause.
I was using setMaximumSize to allow the dialog to expand dynamically as widgets were added but to prevent the user from making the window any bigger than it needed to be. layout()->setSizeConstraint(QLayout::SetFixedSize); achieves the same thing.

How to prevent Qt 6.0 Installer from crashing?

Here’s what happens
I open the installer, choose the packages I want(I choose to install some 1.7 GB of components), everything goes well.
But then when I click on the Install button, and Qt installer crashes! And by crashes I mean it crashes, Windows DOES NOT tell me it is not responding. The window just gets invisible from the taskbar.
There also is no possibility that it is installing in the background, as I waited for approx. 5 mins, and when I checked in the folder where I was going to install it, I didn’t find a SINGLE component installed!
How to solve that?
I asked some questions earlier because a person needs more information. It also depends on what compiler you have. There are many many known issues with Qt 6.x.
The default kit doesn't work with MSVC2019
https://forum.qt.io/topic/120357/wrong-kit-for-qt-6-0-0-msvc2019-64bit/5
Qt 6.0 has install issues with GLib 6
https://youtu.be/IZy6FMQlaNg
There also appears to be significant problems with OpenGL.
https://github.com/opencv/opencv/issues/20499
People seem to still be able to get off-line installers, and, as this French typing person found out, you have to be careful because it appears there are some 32-bit Windows kits.
https://forum.qt.io/topic/123027/installation-qt6-on-windows/7
If you try running them on a 64-bit Windows 10, they crash.
If this doesn't answer your question, you need to supply
Which Windows Version
32 or 64-bit
off-line or on-line installer?

Deployment size for Linux vs Windows

I'm deploying an app developed by Qt for both Windows and Linux:
On Windows I'm using built-in Qt windeployqt tool:
windeployqt.exe app.exe --qmldir %NS_REPO_DIR%\qml\
On Linux I'm using linuxdeployqt:
linuxdeployqt_EXE="${NS_REPO_DIR}/scripts/linuxdeployqt/linuxdeployqt-7-x86_64.AppImage"
${linuxdeployqt_EXE} app -qmake=${NS_QT_QMAKE_EXE} -qmldir=${NS_REPO_DIR}/qml/
The deployment size for Windows is around 70 MB and for Linux is around 300 MB. Is it normal? Is there anything I might be missing?
Thanks!
Update
This is my deployment on Linux whose content is sorted by size. The Qt files don't look like to be debug mode. Also, there is a huge libQt5WebEngineCore.so.5.12.7 file of 111 MB:
We would have to blame here to all the GNU/Linux distributions makers for changing so many things.
Unlike Windows that there are only few version Windows 7,8, 10 and that is it. In GNU/Linux we have so many versions and variants that we have to include "almost" everything that an application needs to ensure it will run on the majority of the existent system variants.
Said that, you can manually check the files deployed in your AppDir manually and remove those you know that your application will not require.
Side note: While linuxdeployqt is still functional there are other tools that do a better job. Consider checking https://github.com/linuxdeploy/ and https://github.com/AppImageCrafters/appimage-builder

Qt/MinGW32 memory usage limitation?

I wrote an application with Qt 4.8.1 and MinGW32 (Nokia Qt SDK). I try to load a large file with this app, but the app always crash when memory usage reach 1,868 MB. If I reduce the size of input file the app works fine. Is there any memory limitations on Qt apps or MinGW32? What should I do if I really want my app to use more memory? My windows is 64 bit.
p.s. Adding "QMAKE_LFLAGS_WINDOWS += -Wl,--stack,32000000" to .pro file won't work
Thanks very much!
p.p.s. I saw many software are capable of using 10+ GB, e.g. Matlab, how to do that on Qt apps?
Your copy of windows may be 64 bit, but MingW32 is a 32 bit compiler, so any app written with that compiler has all the standard limits inherent to 32 bit Windows. Effectively, you won't be able to get more than around 2G of memory for your app to use.
There's a method to get that up to 3G, but beyond that you need a 64 bit compiler.
2GB is limit is for process only.
You can spread your application along N processes (32-bit) to allocate N x 2GB. Operating system must still be 64-bit.

Compile Qt Project on Windows for Linux / Mac

Is it possible to compile a Qt Project on Windows for Linux / Mac?
I am using Qt 5.0.2 with MinGW and Qt Creator.
i'm not saying it is impossible but it would be really hard. g++ could be tricked into generating object files but there are many linux libraries and headers that just don't exist on mingw. Linux apps are best built on linux itself.
For QT 4.* answer is YES, that's possible, I did that ones mainly for 'research purposes' and would not do it again ever.. It takes a lot of time, a lot of hacking bit's and pieces in makefiles, configurations.. There is no ANY practical sense in doing that. It takes 40 minutes to install Linux of your taste on a virtual machine (whatever you prefer) and get proper binaries.
Same applied for MacOSX.. never did it but again I believe it can be done by building a full tool-chain only question what for =))
In our organization we have 1 server with 3 virtual machines that are responsable for cross-platform building. I think that cross-compiling on one real OS may be used only for some kind of learning process, but not for real tasks.
I finally did it with compiling and building it on each OS. It is too much effort doing it on Widnows.

Resources