Frontend/Qt

[Qt] Failed to load platform plugin "xcb"

Roien 2018. 3. 18. 16:55
반응형
While executing Qt application, "cannot load xcb" message could be shown on the screen if you did not configure the followings.


Ref.
https://forum.qt.io/topic/58499/solved-problems-with-setting-paths-to-libs-and-plugins-in-qt-app-s-executable-file/3



MyAppDeployment
 +- lib
 |   +- libQt5...so
 +- plugins
 |   +- platform
 |       +- libqxcb.so  <--
 |       +- libqlinuxfb.so
 |       +- ...
 +- qml
 |   +- QtQuick
 |       +- Window.2
 |           +- libwindowplugin.so
 |           +- qmldir
 |   +- QtQuick.2
 |       +- libqtquick2plugin.so
 |       +- qmldir
 +- MyApp*



1. 
the following Qt variables must be set in order to execute your Qt application.

#!/bin/sh
export LD_LIBRARY_PATH=`pwd`/lib
export QT_PLUGIN_PATH=`pwd`/plugins
export QML2_IMPORT_PATH=`pwd`/qml
./MyApp


or


2. 
qt.conf
adding resources

[Paths]
Prefix=./
Libraries=lib
Plugins=plugins
Qml2Imports=qml


build the app with the qt.conf file



3. 
RPATH의 사용은 .pro file에 한 라인만 추가하면 됨
(http://www.tripleboot.org/?p=536#PluginDLLs)

app's .pro
    QMAKE_LFLAGS += -Wl,--rpath=\$ORIGIN/lib

    QMAKE_LFLAGS += -Wl,-rpath,"'$ORIGIN/lib'"



test
chrpath -r \$ORIGIN/lib VeniceClassicRadioPlayer


반응형