no qt platform could be initialized
-
I followed instructions of one blog, but I don't know if all the dependencies are built statically too. Could you let me know whether the commands below build all the dependencies statically?
- add to qmake
QMAKE_LFLAGS += -static -static-libgcc
QMAKE_CFLAGS_RELEASE -= -O2
QMAKE_CFLAGS_RELEASE += -Os -momit-leaf-frame-pointer
DEFINES += QT_STATIC_BUILD
-
add an environment path
set Path=C:\Qt\Tools\mingw530_32\bin;%PATH% -
Move to Src folder, and command
configure -static -release -platform win32-g++ -prefix C:\Qt\Static\5.10.0 -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -no-openssl -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests -
next
mingw32-make -k -j4
mingw32-make -k install -
add to qmake.conf
CONFIG += static
- add to qmake
-
Did you also fully re-build your application with that new Qt build of yours ?
-
@Aaron-Kim Full rebuild means: delete build directory, run qmake, build
-
@Aaron-Kim Full rebuild means: delete build directory, run qmake, build
-
The build folder of your application.
-
You can use something like https://pastebin.com
-
I'm trying to build an application statically and I compiled and set configurations for corresponding qmake.exe
However, when I execute the file which is built by the manual static kit, the error occurs and message is like below. (Strange thing is, this error doesn't occur when I run it in the Qt creator. Only when I execute the result exe file directly)
This application failed to start because no qt platform plugin could be initialized.
I can not find any other post that shows same error message as mine. How can I solve this problem? I don't know if it will be helpful, I'll attach the compile output.23:36:46: Running steps for project untitled...
23:36:46: Starting: "D:\qt\5.11.1\msvc2015\bin\qmake.exe" C:\Users\Coder\Desktop\qt\untitled\untitled.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
Info: creating stash file C:\Users\Coder\Desktop\qt\build-untitled-Qt_5_11_1_mingw53_32_Static-Release.qmake.stash
23:36:48: The process "D:\qt\5.11.1\msvc2015\bin\qmake.exe" exited normally.
23:36:48: Starting: "D:\qt\Tools\QtCreator\bin\jom.exe" qmake_alljom 1.1.2 - empower your cores
23:36:48: The process "D:\qt\Tools\QtCreator\bin\jom.exe" exited normally.
23:36:48: Starting: "D:\qt\Tools\QtCreator\bin\jom.exe"
D:\qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release
D:\qt\5.11.1\msvc2015\bin\uic.exe ..\untitled\mainwindow.ui -o ui_mainwindow.h
cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I..\untitled -I. -ID:\qt\5.11.1\msvc2015\include -ID:\qt\5.11.1\msvc2015\include\QtWidgets -ID:\qt\5.11.1\msvc2015\include\QtGui -ID:\qt\5.11.1\msvc2015\include\QtANGLE -ID:\qt\5.11.1\msvc2015\include\QtCore -Irelease -I. -I\include -ID:\qt\5.11.1\msvc2015\mkspecs\win32-msvc -Forelease\ @C:\Users\Coder\AppData\Local\Temp\main.obj.73168.15.jom
cl -BxD:\qt\5.11.1\msvc2015\bin\qmake.exe -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E D:\qt\5.11.1\msvc2015\mkspecs\features\data\dummy.cpp 2>NUL >release\moc_predefs.h
main.cpp
cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I..\untitled -I. -ID:\qt\5.11.1\msvc2015\include -ID:\qt\5.11.1\msvc2015\include\QtWidgets -ID:\qt\5.11.1\msvc2015\include\QtGui -ID:\qt\5.11.1\msvc2015\include\QtANGLE -ID:\qt\5.11.1\msvc2015\include\QtCore -Irelease -I. -I\include -ID:\qt\5.11.1\msvc2015\mkspecs\win32-msvc -Forelease\ @C:\Users\Coder\AppData\Local\Temp\mainwindow.obj.73168.62.jom
mainwindow.cpp
D:\qt\5.11.1\msvc2015\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG --compiler-flavor=msvc --include release/moc_predefs.h -ID:/qt/5.11.1/msvc2015/mkspecs/win32-msvc -IC:/Users/Coder/Desktop/qt/untitled -ID:/qt/5.11.1/msvc2015/include -ID:/qt/5.11.1/msvc2015/include/QtWidgets -ID:/qt/5.11.1/msvc2015/include/QtGui -ID:/qt/5.11.1/msvc2015/include/QtANGLE -ID:/qt/5.11.1/msvc2015/include/QtCore -I. -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared" -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" ..\untitled\mainwindow.h -o release\moc_mainwindow.cpp
cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I..\untitled -I. -ID:\qt\5.11.1\msvc2015\include -ID:\qt\5.11.1\msvc2015\include\QtWidgets -ID:\qt\5.11.1\msvc2015\include\QtGui -ID:\qt\5.11.1\msvc2015\include\QtANGLE -ID:\qt\5.11.1\msvc2015\include\QtCore -Irelease -I. -I\include -ID:\qt\5.11.1\msvc2015\mkspecs\win32-msvc -Forelease\ @C:\Users\Coder\AppData\Local\Temp\moc_mainwindow.obj.73168.1281.jom
moc_mainwindow.cpp
link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='' processorArchitecture=''" /MANIFEST:embed /OUT:release\untitled.exe @C:\Users\Coder\AppData\Local\Temp\untitled.exe.73168.2562.jom
23:36:51: The process "D:\qt\Tools\QtCreator\bin\jom.exe" exited normally.
23:36:51: Elapsed time: 00:05.@Aaron-Kim
you must create a directory called "platforms". In the next step you copy the qwindows.dll in the platform directory.
You find the dll usually in C:\Qt\Qtx.y.z\x.y.z\mingw73_64\plugins\platforms -
@Aaron-Kim
you must create a directory called "platforms". In the next step you copy the qwindows.dll in the platform directory.
You find the dll usually in C:\Qt\Qtx.y.z\x.y.z\mingw73_64\plugins\platforms