probonopd / linuxdeployqt

Makes Linux applications self-contained by copying in the libraries and plugins that the application uses, and optionally generates an AppImage. Can be used for Qt and other applications
Other
2.22k stars 414 forks source link

linuxdeployqtApp xcb issue QT_QPA_PLATFORM_PLUGIN_PATH #537

Closed SnoZek closed 2 years ago

SnoZek commented 2 years ago

Hello,

I'm trying to use linuxdeployqt for the first time and i try to run a little helloworld qt program. when i try to run my .AppImage after creating it with linuxdeployqt i got this error :

qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

The only way i found to correct the error is to set the QT_QPA_PLATFORM_PLUGIN_PATH to an external folder. To be more clear : main_dir : |----> helloworld.AppImage |----> platforms/ here are the needed lib And i set the env QT_QPA_PLATFORM_PLUGIN_PATH to platforms/

The folder platforms is also in the AppDir folder : usr/lib/platforms With this configuration it work in an other Linux PC with a different distribution. PC where it is build : Scientific Linux 7.9 Pc where it run : Ubuntu 20.04 LTS Qt version : 6.2.2

How could i make qt.qpa.plugin automatically search in usr/lib/platforms folder. I tried to add the path in bin/qt.conf but it don't work (maybe i did it wrong?).

Thank you in advance for your help,

SnoZek commented 2 years ago

edit : I supp the auto generate AppRun and create a custom one :

!/bin/sh

HERE="$(dirname "$(readlink -f "${0}")")" EXEC="${HERE}/usr/bin/helloworld_bin" export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${HERE}/usr/lib/" export QT_QPA_PLATFORM_PLUGIN_PATH="${HERE}/usr/lib/platforms/" exec "${EXEC}"