qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "/opt/Qt-5.12.4/plugins"
在 Colibri iMX6DL 上编译qt, 参考
嵌入式 Arm 平台交叉编译 Qt5 源代码(https://www.toradex.com/zh-cn/blog/qian-ru-shi-arm-ping-tai-jiao-cha-bian-yi-qt5-yuan-dai-ma)
部署到 Colibri iMX6DL 上后,出现
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "/opt/Qt-5.12.4/plugins" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
设置环境变量 export QT_DEBUG_PLUGINS=1
参考:https://blog.csdn.net/sinat_26106275/article/details/82778951
重新运行程序,显示:
Got keys from plugin meta data ("xcb") QFactoryLoader::QFactoryLoader() checking directory path "/home/root/_testWidget1/bin/platforms" ... Cannot load library /opt/Qt-5.12.4/plugins/platforms/libqxcb.so2: (libxkbcommon-x11.so.0: cannot open shared object file: No such file or directory) QLibraryPrivate::loadPlugin failed on "/opt/Qt-5.12.4/plugins/platforms/libqxcb.so2" : "Cannot load library /opt/Qt-5.12.4/plugins/platforms/libqxcb.so2: (libxkbcommon-x11.so.0: cannot open shared object file: No such file or directory)" qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/opt/Qt-5.12.4/plugins" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: linuxfb, minimal, offscreen, vnc, webgl, xcb.
输入
~$ ldd /opt/Qt-5.12.4/plugins/platforms/libqxcb.so
参考:https://forum.qt.io/topic/93247/qt-qpa-plugin-could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/7
显示缺少 libxkbcommon,并展示其路径,
从 /usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/lib/ 目录中找到,拷之,传到 Colibri iMX6DL 的 /usr/lib/ 目录下
运行成功
学习到:
ldd 命令
qt调试:
export QT_DEBUG_PLUGINS=1