Conan, Qt 5.15.9 : can't start deployed Qt app without qt.conf
-
Hello,
Recently we switched to Qt 5.15.9 from conan repo instead of using prebuild SDK from the installer.
This a list of options we enabled in conanfile.py for Qt package :"qt:shared": True, "qt:widgets": True, "qt:gui": True, "qt:qtsvg" : True, "qt:qtdeclarative" : True, "qt:qtactiveqt" : False, "qt:qtscript" : True, "qt:qtmultimedia" : True, "qt:qttools" : True, "qt:qtxmlpatterns" : True, "qt:qttranslations" : True, "qt:qtlocation" : True, "qt:qtsensors" : True, "qt:qtconnectivity" : True, "qt:qt3d" : True, "qt:qtimageformats" : True, "qt:qtgraphicaleffects" : True, "qt:qtquickcontrols" : True, "qt:qtserialbus" : False, "qt:qtserialport" : False, "qt:qtwinextras" : True, "qt:qtwebsockets" : True, "qt:qtwebchannel" : True, "qt:qtwebengine" : True, "qt:qtwebview" : True, "qt:qtquickcontrols2" : True, "qt:qtcharts" : True, "qt:qtdatavis3d" : True, "qt:qtvirtualkeyboard" : True, "qt:qtgamepad" : True, "qt:qtscxml" : True, "qt:qtnetworkauth" : True, "qt:qtremoteobjects" : True, "qt:qtwebglplugin" : True, "qt:qtlottie" : False, "qt:qtquicktimeline" : True, "qt:qtquick3d" : True,
Problem :
I noticed that Qt executable can't be started. The workaround is to put the default qt.conf file in the same folder where binary exists with the following context :[Paths] Prefix="."
According to qt.conf guidance, the binary working directory is used first for searching plugins and Qt dll's. And thus, I don't understand why setting prefix in qt.conf is really required to start the app.
Please, assist to understand the default Qt dll/plugins preload process and figure out what I'm doing wrong.
Thanks,
Dima -
Hello,
Recently we switched to Qt 5.15.9 from conan repo instead of using prebuild SDK from the installer.
This a list of options we enabled in conanfile.py for Qt package :"qt:shared": True, "qt:widgets": True, "qt:gui": True, "qt:qtsvg" : True, "qt:qtdeclarative" : True, "qt:qtactiveqt" : False, "qt:qtscript" : True, "qt:qtmultimedia" : True, "qt:qttools" : True, "qt:qtxmlpatterns" : True, "qt:qttranslations" : True, "qt:qtlocation" : True, "qt:qtsensors" : True, "qt:qtconnectivity" : True, "qt:qt3d" : True, "qt:qtimageformats" : True, "qt:qtgraphicaleffects" : True, "qt:qtquickcontrols" : True, "qt:qtserialbus" : False, "qt:qtserialport" : False, "qt:qtwinextras" : True, "qt:qtwebsockets" : True, "qt:qtwebchannel" : True, "qt:qtwebengine" : True, "qt:qtwebview" : True, "qt:qtquickcontrols2" : True, "qt:qtcharts" : True, "qt:qtdatavis3d" : True, "qt:qtvirtualkeyboard" : True, "qt:qtgamepad" : True, "qt:qtscxml" : True, "qt:qtnetworkauth" : True, "qt:qtremoteobjects" : True, "qt:qtwebglplugin" : True, "qt:qtlottie" : False, "qt:qtquicktimeline" : True, "qt:qtquick3d" : True,
Problem :
I noticed that Qt executable can't be started. The workaround is to put the default qt.conf file in the same folder where binary exists with the following context :[Paths] Prefix="."
According to qt.conf guidance, the binary working directory is used first for searching plugins and Qt dll's. And thus, I don't understand why setting prefix in qt.conf is really required to start the app.
Please, assist to understand the default Qt dll/plugins preload process and figure out what I'm doing wrong.
Thanks,
Dima@Dima-Rusyy
Windows? LIbrary searching is somewhat platform dependent.
Exactly what is in the same directory as the executable? -
@Dima-Rusyy
Windows? LIbrary searching is somewhat platform dependent.
Exactly what is in the same directory as the executable?@ChrisW67 , I use windeploy.exe and feed executable to it. Then, I just put linked executable in the directory created by windeploy.exe.
To confirm, Qt5***.dll, resources and plugins are at the same folder where executable it. -
@ChrisW67 , I use windeploy.exe and feed executable to it. Then, I just put linked executable in the directory created by windeploy.exe.
To confirm, Qt5***.dll, resources and plugins are at the same folder where executable it.@Dima-Rusyy If by "the qt.conf guidance" you mean this page then it i talking about the application directory as the first place QLibraryInfo looks for qt.conf in order to locate platfomr and other plugins. In the absence of qt.conf the QLibraryInfo returns hard-coded paths, and these do not match your deployed environment.
If the Conan-supplied libraries have unusual hard-coded paths then this may the root cause of the problem (you could ask QLibraryInfo where these are early in main() ). Alternatively, if windeployqt picked up a different Qt library you may have a mismatch of another sort.
-
@Dima-Rusyy If by "the qt.conf guidance" you mean this page then it i talking about the application directory as the first place QLibraryInfo looks for qt.conf in order to locate platfomr and other plugins. In the absence of qt.conf the QLibraryInfo returns hard-coded paths, and these do not match your deployed environment.
If the Conan-supplied libraries have unusual hard-coded paths then this may the root cause of the problem (you could ask QLibraryInfo where these are early in main() ). Alternatively, if windeployqt picked up a different Qt library you may have a mismatch of another sort.
@ChrisW67 , you are right. I may specify where to search for qt.conf.
But is there any way to set Prefix="." via C++ code to avoid shipping qt.conf in the installer ?
PS : When qt.conf file is dropped, I'm getting an error about error preloading Qt-plugins. -
@ChrisW67 , you are right. I may specify where to search for qt.conf.
But is there any way to set Prefix="." via C++ code to avoid shipping qt.conf in the installer ?
PS : When qt.conf file is dropped, I'm getting an error about error preloading Qt-plugins.@Dima-Rusyy The problem is likely that the hard coded paths in the Conan-supplied Qt libraries are unusual.
What does this code do when you drop its executable in your deployed folder with, and without, the qt.conf file?
#include <QCoreApplication> #include <QDebug> #include <QLibraryInfo> int main(int argc, char **argv) { qDebug() << "Version:" << QLibraryInfo::version(); qDebug() << "Prefix :" << QLibraryInfo::location(QLibraryInfo::PrefixPath); qDebug() << "Libs :" << QLibraryInfo::location(QLibraryInfo::LibrariesPath); qDebug() << "Plugins:" << QLibraryInfo::location(QLibraryInfo::PluginsPath); qDebug() << "Libexec:" << QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath); QCoreApplication app(argc, argv); return 0; }
-
@Dima-Rusyy The problem is likely that the hard coded paths in the Conan-supplied Qt libraries are unusual.
What does this code do when you drop its executable in your deployed folder with, and without, the qt.conf file?
#include <QCoreApplication> #include <QDebug> #include <QLibraryInfo> int main(int argc, char **argv) { qDebug() << "Version:" << QLibraryInfo::version(); qDebug() << "Prefix :" << QLibraryInfo::location(QLibraryInfo::PrefixPath); qDebug() << "Libs :" << QLibraryInfo::location(QLibraryInfo::LibrariesPath); qDebug() << "Plugins:" << QLibraryInfo::location(QLibraryInfo::PluginsPath); qDebug() << "Libexec:" << QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath); QCoreApplication app(argc, argv); return 0; }
@ChrisW67 , the output of a simple app you suggested with/without qt.conf is the same :
But, when I switched to /SUBSYTEM:CONSOLE I noticed the following message while running the app without qt.conf :
[0218/131921.920:ERROR:icu_util.cc(251)] Couldn't mmap icu data file [2024-02-18 13:19:21.920] [QML] [warning] Warning: Qt WebEngine resources not found at D:/Temp/1/bin/datadir. Trying application directory... (<no file>:0, <no function>) [2024-02-18 13:19:21.920] [QML] [warning] Warning: Qt WebEngine resources not found at D:/Temp/1. Trying fallback directory... The application MAY NOT work. (<no file>:0, <no function>) [2024-02-18 13:19:21.920] [QML] [warning] Warning: Installed Qt WebEngine locales directory not found at location D:/Temp/1/bin/datadir/translations\qtwebengine_locales. Trying application directory... (<no file>:0, <no function>) [2024-02-18 13:19:21.920] [QML] [warning] Warning: Qt WebEngine locales directory not found at location D:/Temp/1\qtwebengine_locales. Trying fallback directory... Translations MAY NOT not be correct. (<no file>:0, <no function>) D:\Temp\1>
Looks like some webengine resources are not found while loading the app without qt.conf.
The resource directory seems to exist :
D:\Temp\1>dir resources Volume in drive D is WORK Volume Serial Number is 20C4-FAFE Directory of D:\Temp\1\resources 02/18/2024 01:18 PM <DIR> . 02/18/2024 01:18 PM <DIR> .. 11/27/2023 01:52 PM 10,527,632 icudtl.dat 11/27/2023 01:52 PM 2,204,511 qtwebengine_devtools_resources.pak 11/27/2023 01:52 PM 2,502,554 qtwebengine_resources.pak 11/27/2023 01:52 PM 195,621 qtwebengine_resources_100p.pak 11/27/2023 01:52 PM 256,762 qtwebengine_resources_200p.pak 5 File(s) 15,687,080 bytes 2 Dir(s) 121,621,774,336 bytes free
-
@Dima-Rusyy The problem is likely that the hard coded paths in the Conan-supplied Qt libraries are unusual.
What does this code do when you drop its executable in your deployed folder with, and without, the qt.conf file?
#include <QCoreApplication> #include <QDebug> #include <QLibraryInfo> int main(int argc, char **argv) { qDebug() << "Version:" << QLibraryInfo::version(); qDebug() << "Prefix :" << QLibraryInfo::location(QLibraryInfo::PrefixPath); qDebug() << "Libs :" << QLibraryInfo::location(QLibraryInfo::LibrariesPath); qDebug() << "Plugins:" << QLibraryInfo::location(QLibraryInfo::PluginsPath); qDebug() << "Libexec:" << QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath); QCoreApplication app(argc, argv); return 0; }
@ChrisW67 , I think I understand what is happening :
QLibraryInfo::DataPath is not pointing to .\resources thus causing webengine resources load failure. When either Prefix or DataPath is specified in qt.cont, the resource path is updated and resources lookup succeeds.That probably could a bug - either in webdeploy or webengine resources load.
Anyway, could you suggest if there is any way to update QLibraryInfo::DataPath in C++ code ? So far I can see that it's only possible via qt.conf.And looks like conan recipe (conanfile.py) has a hard-coded DataPath :
args.append("-archdatadir %s" % os.path.join(self.package_folder, "bin", "archdatadir"))