What are the different platforms for Qt's configure - qt

I'm trying to build Qt on Windows with the following command:
configure -static -opensource -no-webkit -no-qt3support -no-audio-backend -no-exceptions -no-opengl -no-phonon -phonon-backend
and I get this error:
Unable to detect the platform from environment. Use -platform command lineargument
However I don't know what are the different possible values for the "-platform" argument. I tried "win32" and "windows" but none of them are right. I can't find any reference that would list the possible values. Does anybody know what I need to put for Windows 7 (developing with Qt Creator)?

Open mkspecs folder inside qt dir. There you can see multiple folders. Names of this folders are values for -platform switch.
For example, you can use win32-msvc. msvc means using MS visual studio compiler for buiding qt.

Answer found on this topic in russian language.
You should try -platform with those arguments:
win32-g++ (for mingw)
win32-icc (for intel)
win32-msvc (for visual studio)

Related

Qt static application fails to run on deployed system

After successfully building static QT and my application binary on Linux I moved to Windows to try out the same.
..\qt-everywhere-src-5.12.8\configure.bat -opensource -confirm-license -release -static -static-runtime -no-pch -optimize-size -opengl desktop -platform win32-g++ -prefix "C:\Qt\Static" -skip webengine -nomake tools -nomake tests -nomake examples
mingw32-make -j4 && mingw32-make install
My development environment is Windows 10 x64, MinGW 7.3.0, QT 5.12.8 Static (Built with above cmdline). Now my problem with deployment is:
Strangely the binary is running on a fresh copy of Windows 10, but not on Windows 7. More surprisingly I tried to run the binary on Linux Wine, and voila it worked there as well.
Another problem is related to custom font loading, i.e. QFontDatabase::addApplicationFont also fails on Windows static build. Whereas same code works well on Linux static build or Windows dynamic QT linking. I tried Q_INIT_RESOURCE based on some stackoverflow post but that didn't help.
I tried reading several qt wiki articles but nothing has helped so far for both of the above problems.
Edit #1
Here is the font loading code which is failing on static build:
Q_INIT_RESOURCE(qml);
int idFont = QFontDatabase::addApplicationFont(":/fonts/Comfortaa-Bold.ttf");
if (idFont == -1)
{
qDebug() <<"Failed to load font from resource";
....
Edit #2
There is a new hope. I have just tried building a simple widget application and build that statically with same Qt version. Now it works on fresh Windows 7. So I need to figure out why QML application is not working. Do I need to do anything specific for qml modules or plugin during Qt static build?
Edit #3
Fixed Windows 7 execution issue by changing VM settings.
Fixed the font loading issue by rebuilding Qt. This time I used Qt 5.15.0 and command line was:
configure.bat -opensource -confirm-license -prefix "C:\Qt\5.15.0-Static" -release -static -static-runtime -opengl desktop -platform win32-g++ -make libs -qt-libpng -qt-libjpeg -qt-freetype -qt-zlib -nomake tools -nomake examples -nomake tests -skip qttools
The problem was with VirtualBox display driver which by default doesn't support OpenGL. When I turned on the 3D acceleration in VirtualBox settings the Qt Qml static application worked. This also justifies why my statically linked application worked on Windows 10 as those were installed on direct hardware, not on VM, thus was using proper underlying driver and opengl.
So this implies when you use -opengl desktop flag it uses underlying operating system's opengl library and even though mingw links with -lopenglw32 it still depends on system's opengl.

Build Qt (static linking) for Visual Studio 2017 32bits

On my Windows 7 SP1 machine I would like to use Qt in Visual Studio and compile Qt projects with Visual Studip with static linking,to be able to share my projects in a single .exe file.
Since there are no precompiled libraries for Visual Studio 2017 32bits (although they exists for x64),i'm going to compile Qt from sources.
Following Qt's documentation,I started by installing Python 2.7.13 and Active-Perl,and adding their installation path to the PATH variable,along with the gnuwin32/bin folder
Then i created a qt5vars.cmd file under C:\Qt,here's his content :
REM Set up \Microsoft Visual Studio 2017, where <arch> is \c amd64, \c x86, etc.
CALL "C:\Program Files\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
SET _ROOT=C:\Qt\5.9.1
SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
REM Uncomment the below line when using a git checkout of the source repository
#REM SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
SET _ROOT=
And finally I unzipped Qt sources (downloaded from here to C:\Qt\5.9.1,and jom under C:\Qt\jom
I'm planning to use these commands (after executing qt5vars.cmd) to compile and install Qt :
configure -debug-and-release -opensource -platform win32-msvc2017 -static -nomake examples -nomake tests -prefix C:\Qt-5.9.1
jom -j 2
jom install
I already installed Qt vs tools in VS2017.
Is the procedure correct,or should I change something ? (particularly in the configure command)
Looks good. My only remarks would be:
To remove gnuwin32 path as I don't see a reason why would you need it.
And consider making a shadow build to keep Qt sources unpolluted.
set _SHADOW_DIR="C:\build_static"
set _SOURCE_DIR="C:\SrcQt5.9.1"
...
cd %_SHADOW_DIR%
call %_SOURCE_DIR%\configure ...
Run: "x86 Native Tools Command Prompt for VS 2017"
Or from console
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
Go to your Qt source dir "qt-everywhere-src-5.14.0/"
Run
configure -static -debug-and-release -prefix "f:\Qt\Static\build\5.14\build" -platform win32-msvc -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sqlite -sql-odbc -no-openssl -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests -skip qtwebengine
After some hours run
nmake
Wait some hours again and run
nmake install
A lot of post about qtwebengine,ssl i simply disable this.
Hope this post help you save your expensive time.

How to make a Qt build from sources portable?

How can I make a Qt build that I built with the -prefix parameter portable to other machines? When I copy my build over to a location on a different machine which differs from the location is specified for -prefix on the build machine qmake complains about not being able to find files and from the error messages it is clear that the files are being searched for in the directory that was used as the -prefix parameter on the original build machine. I mean, the builds that come from the Qt maintenance tool obviously do not have this problem since they do not know where they will be installed at.
My configure line is configure.bat -prefix C:\Development\qt-5.8.0-msvc2015-x86 -opensource -debug-and-release -nomake examples -confirm-license
Side question - when I use this build for Visual Studio with this build Qt cannot find qwindows.dll platform plugin. I copied it over to the binary folder under platforms and it works, but how does the installed Qt version get around this without copying anything?
the builds that come from the Qt maintenance tool obviously do not have this problem since they do not know where they will be installed at.
They do have that problem, and the maintenance tool works around it by binary patching the installation paths. You could do so as well. The paths are stored with empty space appended to facilitate this.
There's nothing you need to do to the build itself. Only after you unzip the build on the target machine, you need to patch it. A rudimentary patcher iterates all the files, and replaces the install path prefix with the real path.

Deploying Qt5.5 Qml App to Windows XP shows me a blank window?

I have built a static x86 Qt5.5 library with VS2013 using:
configure -static -prefix D:\Qt\qt-5.5.0-x86-static -opensource -release -static-runtime -nomake examples -no-compile-examples -static-runtime -nomake tools -no-iconv -qt-zlib -skip qtwebkit -confirm-license -qmake -opengl desktop -no-angle -nomake tests -target xp
After that I used this static library build a static-link exe of my Qml App. It can run everywhere in my windows which has been installed Qt5.5.
Then I used VMware Workstation to install a pure Windows XP SP3 only installed VC2008 runtime not VC2013 runtime.
Firstly, I copy the exe into this XP. It can run but had nothing to show. I need kill it in taskmgr.
Second, I copy all folders in D:\Qt\qt-5.5.0-x86-static\qml to the root dir of my exe, it can run. But it shows me only a blank window with correct window title.
I think I have listen all the advise in Deploying Qt 5 App on Windows. But why the qml parts cannot be compiled into static library? How can I let my app not show blank?
P.S. Even if I use windeployqt to deploy share-link library version of app. It also shows me blank window. But it can run on Windows 7.
The output of qtdiag on my virtual XP:
Qt 5.5.0 (i386-little_endian-ilp32 static release build; by MSVC 2013)
on "windo ws" OS: Windows XP [winnt version 5.1.2600]
Architecture: i386; features: SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
Library info: PrefixPath: D:\Qt\qt-5.5.0-x86-static
DocumentationPath: D:\Qt\qt-5.5.0-x86-static\doc HeadersPath:
D:\Qt\qt-5.5.0-x86-static\include LibrariesPath:
D:\Qt\qt-5.5.0-x86-static\lib LibraryExecutablesPath:
D:\Qt\qt-5.5.0-x86-static\bin BinariesPath:
D:\Qt\qt-5.5.0-x86-static\bin PluginsPath:
D:\Qt\qt-5.5.0-x86-static\plugins ImportsPath:
D:\Qt\qt-5.5.0-x86-static\imports Qml2ImportsPath:
D:\Qt\qt-5.5.0-x86-static\qml ArchDataPath:
D:\Qt\qt-5.5.0-x86-static DataPath: D:\Qt\qt-5.5.0-x86-static
TranslationsPath: D:\Qt\qt-5.5.0-x86-static\translations
ExamplesPath: D:\Qt\qt-5.5.0-x86-static\examples TestsPath:
D:\Qt\qt-5.5.0-x86-static\tests SettingsPath:
Standard paths [... denote writable entry]: DesktopLocation:
"Desktop" *C:\Documents and Settings\Administrator\
The final conclusion:
The problem is the graphic driver in my virtual Windows XP. It can run on other real PCs.
But there is a sad problem to static build of QML.
I have found this:
https://forum.qt.io/topic/22035/qml-apps-not-runnable-using-static-build-up-to-qt-5-0-1-release/24
The reason why I need copy such folders Qt QtQuick.2 QtQuick is that those lib cannot be compile-loaded. Even if I add them into .pro file. From Qt 5.0 to Qt 5.5. The official side seems do not like people use QML by static-link. So, it is waste of time to do static build of QML app.
Qt Quick applications need 3d acceleration in order to work. This is based on either OpenGL, DirectX via Angle or some kind of software renderer that comes with the commercial version of Qt. Since you specifically exclude Angle in your config, you need a proper OpenGL driver. Make sure that OpenGL works on your machine. You'll find tools for that.
I don't think that is has something to do with missing C++ standard libraries (VC2013 runtime), because in this case your application would crash during start and not run. Qt Quick graphic issues however often lead to a running black app that is writing warnings to the console.
Further debugging can be done using the qtdiag.exe command line tool that comes with Qt (It comes with the online installer. I don't know where it is when you build from source). It checks for you which graphic driver is used and often can show error messages.

QT 5.0.2 everywhere opensource configuration error on linux

A very simple question.
I am building qt under linux(CentOS to be exact), and I've been having trouble migrating from QT 4.8.4 to QT 5.0.2.
The current configuration for QT 4.8.4(and also want it the same in 5.0.2) is
./configure $QTCONFARGS -confirm-license -release -no-phonon -no-webkit -no-multimedia -no-sql-odbc -prefix
On 5.0.2, I get errors on no phonon, no webkit, and no multimedia.
I read the help for configurations, and I found none of these.
Question is, what the equivalent of these three cofigurations?
See this page from Qt documentation. Note that
Phonon was dropped in Qt 5.
The option to leave webkit out is --no-webkit (note double dashes) in init-repository and -no-webkit in configure (only single dash).
To skip multimedia, use --no-multimedia or -no-multimedia similarly to above.

Resources