libqeglfs-kms-integration.so not deployed automatically
This is possibly related to https://github.com/probonopd/linuxdeployqt/issues/484
I am working with the project at https://github.com/jh3010-qt-questions/HelloWorld
My goal is to have linuxdeployqt create an AppImage that can be launched by a systemd service on an embedded device.
Both my host and embedded device are running Ubuntu 18.04.
First, I build the Qt Libraries myself with:
./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
If I construct an appimage by doing:
(A)
mkdir build
cd build
/opt/myapp-host/bin/qmake /home/jamesh/HelloWorld/HelloWorld/HelloWorld.pro -spec linux-g++ CONFIG+=qtquickcompiler
/usr/bin/make
cd ..
mkdir appimage
cp ./build/HelloWorld ./appimage/
/home/jamesh/local/bin/linuxdeployqt ./appimage/HelloWorld -appimage -qmake=/opt/myapp-host/bin/qmake -qmldir=/home/jamesh/HelloWorld/HelloWorld
rm Application-x86_64.AppImage
rm -rf ./appimage/doc/ ./appimage/lib/ ./appimage/plugins/ ./appimage/translations/
cp -r /opt/myapp-target/lib ./appimage/
cp -r /opt/myapp-target/plugins ./appimage/
cp -r /opt/myapp-target/qml ./appimage/
/home/jamesh/local/bin/appimagetool ./appimage/
mv Application-x86_64.AppImage helloworld_111_embedded.AppImage
I can move the AppImage to my embedded device and have a systemd service launch it.
However, if I construct the appimage by doing:
(B)
mkdir build
cd build
/opt/myapp-host/bin/qmake /home/jamesh/HelloWorld/HelloWorld/HelloWorld.pro -spec linux-g++ CONFIG+=qtquickcompiler
/usr/bin/make
cd ..
cp build/HelloWorld appimage/usr/bin/
/home/jamesh/local/bin/linuxdeployqt ./appimage/usr/share/applications/HelloWorld.desktop -appimage -qmake=/opt/myapp-host/bin/qmake -qmldir=/home/jamesh/HelloWorld/HelloWorld -extra-plugins=egldeviceintegrations,platforminputcontexts,imageformats,platforms
where the appimage folder has the following structure:
appimage/
└── usr
├── bin
│ └── HelloWorld
├── lib
└── share
├── applications
│ └── HelloWorld.desktop
└── icons
└── hicolor
└── 256x256
└── apps
└── HelloWorld.png
The AppImage fails to be executed by the systemd service and fails with the following error:
QFactoryLoader::QFactoryLoader() checking directory path "/tmp/.mount_myappNS4gJP/usr/bin/egldeviceintegrations" ...
loaded library "/tmp/.mount_myappNS4gJP/usr/plugins/egldeviceintegrations/libqeglfs-kms-integration.so"
Could not initialize egl display
I can, however, go to my embedded device with a keyboard and successfully launch the AppImage manually. Why it fails with systemd execution is a mystery.
What seems clear to me is that linuxdeployqt is not copying over everything it needs to. I did some work to make the plugins and lib directory in (A) match what (B) contained and (A) continued to work. My only guess is that linuxdeployqt is not copying over critical qml files which is why I think this may be related to the issue linked above.
You need to manually copy the file in question to appdir/usr/plugins/egldeviceintegrations/libqeglfs-kms-integration.so.
Apparently linuxdeployqt cannot figure out automatically yet that this file is required for your application.
If you know a way to find that out, then we can possibly modify linuxdeployqt to know this in the future.
As a stop gap, much like there is a -extra-plugins= flag for those plugins that linuxdeployqt cannot automatically figure out, perhaps there needs to be an -extra-libs= flag for those libraries that linuxdeployqt cannot automatically figure out.
It doesn't seem like there would be much effort to add such a flag for someone familiar with the code base.
Save the potentially difficult automatic detection for later.