Qt AppImage not working on embedded device
-
The host I am building on and the embedded device are both running Ubuntu 18.04.
If I copy over my AppImage to the embedded device and launch it manually, it will work.
However, I am trying to come up with the correct solution so I can have the app launched via systemd.
The error that appears in the syslog is
Could not initialize egl display
(full error output is below)I build the Qt Libraries myself with the following:
./configure -opensource -confirm-license -verbose -pkg-config -no-use-gold-linker -device linux-nuc-g++ -device-option CROSS_COMPILE=/usr/bin/ -kms -gbm -sysroot / -system-freetype -fontconfig -skip webengine -verbose -recheck-all -make libs -prefix /usr/ -extprefix /opt/myapp-target -hostprefix /opt/myapp-host -qt-zlib -qt-libjpeg -qt-libpng -no-feature-bearermanagement -no-xcb -no-xcb-xlib -no-xkbcommon -no-xcb-xinput -no-linuxfb
I believe the relevant flags are
-kms -gbm
,-prefix /usr/
,-extprefix /opt/myapp-target
, and-hostprefix /opt/myapp-host
Building the Qt Libraries with the above, I end up with:
/opt/myapp-target/lib /opt/myapp-target/plugins /opt/myapp-target/qml
I have a method (hack?) that I can use which works.
If I build an initial AppImage with
linuxdeployqt.AppImage ~/appimage/myappui -appimage -qmake=/opt/myapp-host/bin/qmake -qmldir=/home/jamesh/myapp/myapp-ui
, it will place a bunch of stuff into a working appimage folder.Then, I
rm -rf ~/appimage/doc/ ~/appimage/lib/ ~/appimage/plugins/ ~/appimage/translations/
to remove those folders that linuxdeployqt put there.And then,
cp -r /opt/myapp-target/lib ~/appimage/ cp -r /opt/myapp-target/plugins ~/appimage/ cp -r /opt/myapp-target/qml ~/appimage/
I then use
./appimagetool.AppImage ~/appimage/
to rebuild the AppImage. Moving the new myapp.AppImage to the device, I can use the systemd .service to launch it and it works.What this tells me is that there are flags I could be passing to linuxdeployqt to get what is needed in my AppImage rather than coping over everything and the kitchen sink which is what I believe I am doing with this solution.
The linuxdeployqt command I use, which provides an AppImage that does not work via systemd, is:
linuxdeployqt ./appimage/usr/share/applications/myappui.desktop -appimage -qmake=/opt/myapp-host/bin/qmake -qmldir=/home/jamesh/myapp/myapp-ui -extra-plugins=imageformats,platforms
did not resolve the problem.
I believe I am closer however to the correct solution rather than a hack that happens to work.
I did try passing in every extra plugin to -extra-plugins, but that did not fix the issue.
Any other thoughts on this would be appreciated.
Full output from the syslog. The lines that start with [*] are syslog commands from the app itself to show what environment variables are set. So, code is being executed. However, when it comes time to connect to the display, it fails.
Apr 21 14:16:24 myapp systemd[1]: Started myapp-Ui. : QML debugging is enabled. Only use this in a safe environment. : [*] LANG=en_US.UTF-8 : [*] PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin : [*] INVOCATION_ID=833724a35eff49af8d12f07b3437f3d9 : [*] JOURNAL_STREAM=8:144389 : [*] QT_DEBUG_PLUGINS=1 : [*] QT_QPA_PLATFORM=eglfs : [*] QT_QPA_EGLFS_INTEGRATION=eglfs_kms : [*] QT_LOGGING_RULES=qt.qpa.*=true : [*] APPIMAGE=/media/apps/myappui_debug_myapp_ubuntu20-x86_64.AppImage : [*] ARGV0=/media/apps/myappui.AppImage : [*] APPDIR=/tmp/.mount_myappVXqUjm : [*] OWD=/ : QFactoryLoader::QFactoryLoader() checking directory path "/tmp/.mount_myappVXqUjm/usr/plugins/platforms" ... : QFactoryLoader::QFactoryLoader() looking at "/tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqeglfs.so" : Found metadata in lib /tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqeglfs.so, metadata= : { : "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", : "MetaData": { : "Keys": [ : "eglfs" : ] : }, : "archreq": 0, : "className": "QEglFSIntegrationPlugin", : "debug": false, : "version": 330752 : } : Got keys from plugin meta data ("eglfs") : QFactoryLoader::QFactoryLoader() looking at "/tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqminimal.so" : Found metadata in lib /tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqminimal.so, metadata= : { : "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", : "MetaData": { : "Keys": [ : "minimal" : ] : }, : "archreq": 0, : "className": "QMinimalIntegrationPlugin", : "debug": false, : "version": 330752 : } : Got keys from plugin meta data ("minimal") : QFactoryLoader::QFactoryLoader() looking at "/tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqminimalegl.so" : Found metadata in lib /tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqminimalegl.so, metadata= : { : "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", : "MetaData": { : "Keys": [ : "minimalegl" : ] : }, : "archreq": 0, : "className": "QMinimalEglIntegrationPlugin", : "debug": false, : "version": 330752 : } : Got keys from plugin meta data ("minimalegl") : QFactoryLoader::QFactoryLoader() looking at "/tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqoffscreen.so" : Found metadata in lib /tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqoffscreen.so, metadata= : { : "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", : "MetaData": { : "Keys": [ : "offscreen" : ] : }, : "archreq": 0, : "className": "QOffscreenIntegrationPlugin", : "debug": false, : "version": 330752 : } : Got keys from plugin meta data ("offscreen") : QFactoryLoader::QFactoryLoader() looking at "/tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqvnc.so" : Found metadata in lib /tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqvnc.so, metadata= : { : "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", : "MetaData": { : "Keys": [ : "vnc" : ] : }, : "archreq": 0, : "className": "QVncIntegrationPlugin", : "debug": false, : "version": 330752 : } : Got keys from plugin meta data ("vnc") : QFactoryLoader::QFactoryLoader() looking at "/tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqwayland-egl.so" : Found metadata in lib /tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqwayland-egl.so, metadata= : { : "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", : "MetaData": { : "Keys": [ : "wayland-egl" : ] : }, : "archreq": 0, : "className": "QWaylandEglPlatformIntegrationPlugin", : "debug": false, : "version": 330752 : } : Got keys from plugin meta data ("wayland-egl") : QFactoryLoader::QFactoryLoader() looking at "/tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqwayland-generic.so" : Found metadata in lib /tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqwayland-generic.so, metadata= : { : "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", : "MetaData": { : "Keys": [ : "wayland" : ] : }, : "archreq": 0, : "className": "QWaylandIntegrationPlugin", : "debug": false, : "version": 330752 : } : Got keys from plugin meta data ("wayland") : QFactoryLoader::QFactoryLoader() looking at "/tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqwebgl.so" : Found metadata in lib /tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqwebgl.so, metadata= : { : "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", : "MetaData": { : "Keys": [ : "webgl" : ] : }, : "archreq": 0, : "className": "QWebGLIntegrationPlugin", : "debug": false, : "version": 330752 : } : Got keys from plugin meta data ("webgl") : QFactoryLoader::QFactoryLoader() checking directory path "/tmp/.mount_myappVXqUjm/usr/bin/platforms" ... : loaded library "/tmp/.mount_myappVXqUjm/usr/plugins/platforms/libqeglfs.so" : QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' : QFactoryLoader::QFactoryLoader() checking directory path "/tmp/.mount_myappVXqUjm/usr/plugins/egldeviceintegrations" ... : QFactoryLoader::QFactoryLoader() checking directory path "/tmp/.mount_myappVXqUjm/usr/bin/egldeviceintegrations" ... : qt.qpa.egldeviceintegration: EGL device integration plugin keys: () : qt.qpa.egldeviceintegration: Using base device integration : Could not initialize egl display Apr 21 14:16:24 myapp systemd[1]: myappui.service: Main process exited, code=dumped, status=6/ABRT Apr 21 14:16:24 myapp systemd[1]: myappui.service: Failed with result 'core-dump'. Apr 21 14:17:01 myapp CRON[22321]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)