linuxdeployqt and qtwebengine
Hi. I use linuxdeployqt-x86_64.AppImage from the Releases page to transfer the program to another computer without Qt.
But when I run the program, it is crashes. After searching the information I added icudtl.dat in the "resources" folder. The program is successfully launched.
Now I have a some errors: Failed to load qtwebengine_resources.pak, qtwebengine_resources_100p.pak and qtwebengine_resources_200p.pak. Then I added these files in the "resources" directory.
And Installed Qt WebEngine locales directory not found at location .../qtwebengine_locales. Trying application directory... Qt WebEngine locales directory not found at location .../qtwebengine_locales. Trying fallback directory... Translations MAY NOT not be correct. [0116/112551:WARNING:resource_bundle.cc(291)] locale_file_path.empty() for locale Then I added a "translation" into the root.
Now I have a some errors: Qt WebEngine ICU data not found at /opt/Qt/Qt5.6.2/5.6/gcc_64. Trying fallback directory. ... qml: render process terminated qml: Render process exited with code -1 (crashed)
And WebEngineView page is empty.
Qt 5.6.2, Ubuntu 64bit.
Hmmm. linuxdeployqt should handle these things for you properly automatically, but clearly something is going wrong. I don't know why it is not working in your case, but here is the relevant code: https://github.com/probonopd/linuxdeployqt/blob/4951fd133b43e475d1bd64f32b9c5e265253485b/shared/shared.cpp#L885-L915
I also copied qtwebengine_resources.pak, qtwebengine_resources_100p.pak, qtwebengine_resources_200p.pak and icudtl.dat in the directory "libexec". Now it works!
I am not really sure what is the difference between libexec and resources, and what needs to go where. Can this differ for different Qt builds/instances, and is there a generic way to find out where it would need to go?
You may want to read the documentation: https://doc-snapshots.qt.io/qt5-5.7/qtwebengine-deploying.html
Deploying Resources
Qt WebEngine requires the following resource files:
qtwebengine_resources.pak contains the resources needed by Chromium. qtwebengine_devtools_resources.pak contains tools for remote debugging. qtwebengine_resources_100p.pak contains images suitable for low resolution displays. qtwebengine_resources_200p.pak contains images suitable for high DPI displays. icudtl.dat provides support for International Components for Unicode (ICU). It is the Chromium version of ICU, which is not needed if Qt WebEngine was configured to use the system ICU.Resources are searched from the following locations:
- On Linux and Windows: the resources directory in the directory specified by
QLibraryInfo::location(QLibraryInfo::DataPath)- On macOS:
.app/Content/Resources
Excellent, so we need to find the content of QLibraryInfo::location(QLibraryInfo::DataPath) of the Qt instance to be bundled and use that.
Autodesk Eagle seems to be running into this issue as well: http://forums.autodesk.com/t5/eagle-forum/linux-educational-installation-freeze/td-p/6815841
Just verified this on ubuntu-16.04-desktop-amd64.iso:
me@host:~$ '/home/me/Downloads/eagle-8.0.0/eagle'
Installed Qt WebEngine locales directory not found at location /home/me/Downloads/eagle-8.0.0/translations/qtwebengine_locales. Trying application directory...
Qt WebEngine locales directory not found at location /home/me/Downloads/eagle-8.0.0/qtwebengine_locales. Trying fallback directory... Translations MAY NOT not be correct.
[0129/011129:WARNING:resource_bundle.cc(291)] locale_file_path.empty() for locale
Qt WebEngine ICU data not found at /home/eagle/Qt/5.6/gcc_64/resources. Trying parent directory...
Qt WebEngine ICU data not found at /home/eagle/Qt/5.6/gcc_64. Trying application directory...
Installed Qt WebEngine locales directory not found at location /home/eagle/Qt/5.6/gcc_64/translations/qtwebengine_locales. Trying application directory...
Qt WebEngine locales directory not found at location /home/me/Downloads/eagle-8.0.0/libexec/qtwebengine_locales. Trying fallback directory... Translations MAY NOT not be correct.
Qt WebEngine resources not found at /home/eagle/Qt/5.6/gcc_64/resources. Trying parent directory...
Qt WebEngine resources not found at /home/eagle/Qt/5.6/gcc_64. Trying application directory...
[0129/011129:WARNING:resource_bundle.cc(291)] locale_file_path.empty() for locale
Bus error
As a workaround, in the eagle-8.0.0 directory, running
ln -s resources/ libexec
fixes it. But all you get to see now is a login page due to their cloud-based licensing, which drives people away to KiCad in droves.
Dear Autodesk EAGLE developers, if you read this, please consider to
- use the -appimage switch to generate an AppImage
- allow at least non-commercial use without a cloud login (i.e., offline)
Thanks for your consideration.
All, please see @atehxx proposed patch at https://github.com/probonopd/linuxdeployqt/issues/55. Can we make it use QLibraryInfo::location(QLibraryInfo::DataPath)?
@Alexorleon could you share the command line you finally used and also the extra steps you did for the webengine? i have tried the same as you but i end up in a few errors that i am not able to solve
[0130/143807:ERROR:iau_util.cc(178)] Invalid file descriptor to ICU data received.
[0130/143807:FATAL:content_main_runner.cc(705)] Check failed: base::i18n::InitializeICU()
and this are my command lines
gulp.task('prepare-linux-qt',shell.task([
'mkdir ./dist-desktop/libexec/',
'mkdir ./dist-desktop/plugins/',
'mkdir ./dist-desktop/plugins/resources/',
'mkdir ./dist-desktop/lib/',
'mkdir ./dist-desktop/resources/',
'cp /opt/Qt/5.8/gcc_64/resources/* ./dist-desktop/libexec/',
'cp /opt/Qt/5.8/gcc_64/resources/* ./dist-desktop/plugins/resources/',
'cp /opt/Qt/5.8/gcc_64/resources/* ./dist-desktop/resources/',
'cp /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0.4800.1 ./dist-desktop/lib/libgthread-2.0.so.0.4800.1',
'ln -sf ./dist-desktop/lib/libgthread-2.0.so.0.4800.1 ./dist-desktop/lib/libgthread-2.0.so.0',
'linuxdeployqt ./dist-desktop/stremio -qmldir=./shell -bundle-non-qt-libs'
]));
@Alexorleon had those files missing because current version has a bug which result in those files not being copied to application. There is a pull request which fixes that.
@kanekotic Qt is picking some wrong icudtl.icu file. When you have it in ./resources then add qt.conf file in ./libexec with content:
[Paths]
Prefix = ../
and then it should work.
My pull request fixes that also.
@kanekotic I copy the program to a directory and perform it there.
export PATH=/opt/Qt/Qt5.6.2/5.6/gcc_64/bin/:$PATH
This should be done twice.
/home/alexorleon/Deployment/linuxdeployqt-2-x86_64.AppImage /home/alexorleon/Deployment/test/untitled -qmldir='/home/alexorleon/QtProjects/untitled'
Then I copy qtwebengine_resources.pak, qtwebengine_resources_100p.pak, qtwebengine_resources_200p.pak and icudtl.dat in the directory "libexec" and "resources".
I do not know how it is right, but it works for me.
hello @atehxx and @Alexorleon . Sorry for the late reply thanks for both of your inputs. they have been very useful. Its still not working due some zigote issues in some machines but that is a different beast I think 😄 . also i need to check if the dependency comes from webengine or somewhere else @probonopd, but some openGl plugins qt are also not added in (maybe because they are optional). So i ended up having to:
cp /opt/Qt/5.8/gcc_64/plugins/xcbglintegrations/* ./dist-desktop/plugins/xcbglintegrations
@Alexorleon please check if https://github.com/probonopd/linuxdeployqt/commit/74ca072c7f30d2dd7f57c6f91f66a7fb1edb35b3 solves the original issue of this ticket. @kanekotic please open a new issue for xcbglintegrations.
@Alexorleon can you confirm this is fixed in 74ca072?
I downloaded linuxdeployqt-continuous-x86_64.AppImage.
QMake version 3.0 Using Qt version 5.7.1 in /opt/Qt/Qt5.7.1/5.7/gcc_64/lib patchelf 0.9
/home/alexorleon/Deployment/linuxdeployqt-continuous-x86_64.AppImage /home/alexorleon/Deployment/VIC/VIC-client -qmldir='/home/alexorleon/QtProjects/VIC-client'
"/tmp/.mount_SHCqrI/usr/bin/usr/bin:/usr/local/bin/:/opt/Qt/Qt5.7.1/5.7/gcc_64/bin/:/home/alexorleon/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin" app-binary: "/home/alexorleon/Deployment/VIC/VIC-client" Not using FHS-like mode, appBinaryPath: "/home/alexorleon/Deployment/VIC/VIC-client" appDirPath: "/home/alexorleon/Deployment/VIC" relativeBinPath: "VIC-client" QIODevice::write (QFile, "/home/alexorleon/Deployment/VIC/VIC-client/../qt.conf"): device not open
Catalog "libexec" contains: QtWebEngineProcess and qt.conf
# Generated by linuxdeployqt
# https://github.com/probonopd/linuxdeployqt/
[Paths]
Prefix = ../
./VIC-client
./VIC-client: error while loading shared libraries: libQt5WebEngine.so.5: cannot open shared object file: No such file or directory
However, this file exists in the directory "lib".
Please run appimagetool twice on the same directory. Does the error persist? Can you upload the directory for futher testing?
/home/alexorleon/Deployment/linuxdeployqt-continuous-x86_64.AppImage /home/alexorleon/Deployment/VIC/VIC-client -qmldir='/home/alexorleon/QtProjects/VIC-client'
First run:
"/tmp/.mount_55udt7/usr/bin/usr/bin:/usr/local/bin/:/opt/Qt/Qt5.7.1/5.7/gcc_64/bin/:/home/alexorleon/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin"
app-binary: "/home/alexorleon/Deployment/VIC/VIC-client"
Not using FHS-like mode, appBinaryPath: "/home/alexorleon/Deployment/VIC/VIC-client"
appDirPath: "/home/alexorleon/Deployment/VIC"
relativeBinPath: "VIC-client"
QIODevice::write (QFile, "/home/alexorleon/Deployment/VIC/VIC-client/../qt.conf"): device not open
Second run:
"/tmp/.mount_VZJ4jm/usr/bin/usr/bin:/usr/local/bin/:/opt/Qt/Qt5.7.1/5.7/gcc_64/bin/:/home/alexorleon/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin"
app-binary: "/home/alexorleon/Deployment/VIC/VIC-client"
Not using FHS-like mode, appBinaryPath: "/home/alexorleon/Deployment/VIC/VIC-client"
appDirPath: "/home/alexorleon/Deployment/VIC"
relativeBinPath: "VIC-client"
WARNING: "/home/alexorleon/Deployment/VIC/libexec/qt.conf" already exists, will not overwrite.
QIODevice::write (QFile, "/home/alexorleon/Deployment/VIC/VIC-client/../qt.conf"): device not open
Error is still here.
./VIC-client
./VIC-client: error while loading shared libraries: libQt5WebEngine.so.5: cannot open shared object file: No such file or directory
HTML file. That's enough, or files are needed? DirectoryTree.zip
Thanks, Files are needed for analysis.
@probonopd, the file is too large. Can you give me an e-mail, I'll send a link to google disc?
probono /at/ puredarwin -dot- org
So it looks like QtWebEngine is there but isn't getting loaded.
me@host ~/Downloads/VIC $ ./AppRun
./AppRun: error while loading shared libraries: libQt5WebEngine.so.5: cannot open shared object file: No such file or directory
me@host ~/Downloads/VIC $ find . | grep WebEngine
./qml/QtWebEngine
./qml/QtWebEngine/qmldir
./qml/QtWebEngine/plugins.qmltypes
./qml/QtWebEngine/libqtwebengineplugin.so
./qml/QtWebEngine/experimental
./qml/QtWebEngine/experimental/qmldir
./qml/QtWebEngine/experimental/libqtwebengineexperimentalplugin.so
./qml/QtWebEngine/UIDelegates
./qml/QtWebEngine/UIDelegates/qmldir
./qml/QtWebEngine/UIDelegates/PromptDialog.qml
./qml/QtWebEngine/UIDelegates/MessageBubble.qml
./qml/QtWebEngine/UIDelegates/MenuSeparator.qml
./qml/QtWebEngine/UIDelegates/MenuItem.qml
./qml/QtWebEngine/UIDelegates/Menu.qml
./qml/QtWebEngine/UIDelegates/FilePicker.qml
./qml/QtWebEngine/UIDelegates/ConfirmDialog.qml
./qml/QtWebEngine/UIDelegates/ColorDialog.qml
./qml/QtWebEngine/UIDelegates/AuthenticationDialog.qml
./qml/QtWebEngine/UIDelegates/AlertDialog.qml
./libexec/QtWebEngineProcess
./lib/libQt5WebEngineCore.so.5
./lib/libQt5WebEngine.so.5
For whatever strange reason, it seems like the rpath of the main executable is set to $ORIGIN rather than to $ORIGIN/lib as should be done by this code. Are you sure you used the latest continuous build of linuxdeployqt?
Fixing this manually:
patchelf --set-rpath '$ORIGIN/lib/' ./VIC-client
me@host ~/Downloads/VIC $ ./AppRun
This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "".
Reinstalling the application may fix this problem.
Aborted
It is not finding the Qt plugins/platforms directory, and it can't, because there is neiter a qt.conf file next to the main executable binary, nor is qt_prfxpath= set correctly as this code should do. Again, are you using the latest continuous build of linuxdeployqt?
Manual workaround:
sed -i -e 's|qt_prfxpath=/o|qt_prfxpath=.\x00|g' ./lib/libQt5Core.so.5
And voilà, the app runs. But please do use the latest linuxdeployqt to do these things properly.
Let me know how it goes.