在 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