我在笔记本电脑上交叉编译了 Qt5.12,并将其安装在运行 Raspbian Stretch OS 的 Raspberry Pi 3 上。我正在尝试远程调试(从 QtCreator)在 RPi 上运行的应用程序。
当我使用像 ./app -platform xcb
这样的命令从 RPi 终端运行我的 Qt 应用程序时,它工作正常,但是当我尝试从远程调试 session 运行相同的应用程序时,我得到了以下输出:
Could not load shared library symbols for /usr/local/qt5pi/plugins/platforms/libqxcb.so.
Do you need "set solib-search-path" or "set sysroot"?qt.qpa.xcb: could not connect to display
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/qt5pi/plugins/platforms" 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:
eglfs (from /usr/local/qt5pi/plugins/platforms),
linuxfb (from /usr/local/qt5pi/plugins/platforms),
minimal (from /usr/local/qt5pi/plugins/platforms),
minimalegl (from /usr/local/qt5pi/plugins/platforms),
offscreen (from /usr/local/qt5pi/plugins/platforms),
vnc (from /usr/local/qt5pi/plugins/platforms),
webgl (from /usr/local/qt5pi/plugins/platforms),
xcb (from /usr/local/qt5pi/plugins/platforms),
eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, webgl, xcb.
有人遇到过这种情况吗?我可以尝试解决这个问题吗?
最佳答案
加载失败,因为它无法连接到显示器。如果这是远程的,如您所说,您是否使用带 X 转发的 SSH?你会需要这样的东西。
或者您想要在 RPi 上显示,那么问题是缺少环境变量。使用 printenv 查看常规 shell session 。将 DISPLAY、XAUTHORITY 和任何其他看起来可能的内容复制到您的远程调试 session 中。
关于linux - 为什么Qt平台插件 "xcb"找到了却无法加载?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56259725/