Qt在交叉编译期间构建的示例与编译后运行qmake相比如何?



首先,Qt找不到目标.so不是问题,qt可以找到它,但它无法加载它并生成不日志...在终端和gdb.似乎 qmake/make 使用了错误的库,但我在交叉编译环境中只安装了一个由make install生成的 qt。

我正在努力在Windows上为树莓派交叉编译qt5.10。我正在使用msys2,gnutoolchains的覆盆子链。

这里的问题是编译过程构建的示例运行几乎没有问题,我只需要添加一个qt.conf来修复 msys2 的前缀覆盖,它就可以在我的 pi 上运行和显示一些东西。

但是当涉及到 qt creator 或交叉编译中的 qmake 时,它开始向我展示:

This application failed to start because it could not find or load the Qt platform plugin "xcb"

这里有两个问题,首先,平台插件不应该xcb因为我在没有 x 的情况下运行,交叉编译版本默认会使用eglfs。 其次,即使我特定的平台插件要eglfs,它仍然告诉我它无法加载eglfs

我将两个版本的程序放在同一个地方。

qt5pi/examples/opengl/2dpainting $ ls
2dpainting      glwidget.cpp  helper.h  widget.cpp  window.h
2dpainting.pro  glwidget.h    main.cpp  widget.h
2dpaint_my      helper.cpp    qt.conf   window.cpp

2dpaint_my由qmake && make编译,2dpainting由Qt的交叉编译过程使用相同的源代码。

我怀疑 qt 在交叉编译期间添加了一些东西,但我不确定它是怎么发生的。关于树莓派的Qt'wiki不包含有关此问题的任何内容。

更新

它看起来甚至连线给我。我将一个正在运行的示例从其文件夹复制到另一个文件夹,它也崩溃了,事情看起来像这样。

pi@raspberrypi:/usr/local/qt5pi/examples/qt_test $ cp ../opengl/2dpainting/2dpainting .
pi@raspberrypi:/usr/local/qt5pi/examples/qt_test $ ./2dpainting
This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "".
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen,vnc, webgl, xcb.
Reinstalling the application may fix this problem.
Aborted
pi@raspberrypi:/usr/local/qt5pi/examples/qt_test $ ../opengl/2dpainting/2dpainting
qt.qpa.egldeviceintegration: EGL device integration plugin keys: ("eglfs_brcm","eglfs_emu")
qt.qpa.egldeviceintegration: EGL device integration plugin keys (sorted): ("eglfs_brcm", "eglfs_emu")
qt.qpa.egldeviceintegration: Trying to load device EGL integration "eglfs_brcm"
qt.qpa.egldeviceintegration: Using EGL device integration "eglfs_brcm"
qt.qpa.input: Initializing tslib plugin "TsLib" ""
qt.qpa.input: tslib device is "/dev/input/event0"

我不确定,但似乎qt'wiki上的这一步将一些qt5.7文件引入lib文件夹。

sudo apt-get update
sudo apt-get build-dep qt4-x11
sudo apt-get build-dep libqt5gui5
sudo apt-get install libudev-dev libinput-dev libts-dev libxcb-xinerama0-dev libxcb-xinerama0

问题是,qt的例子,当它在自己的文件夹上时,可以神奇地找到(也许qmake install做了什么?)并使用正确的*.so,所以它可以毫无问题地工作。

但是,当使用qmake编译时,程序将找不到正确的库,因此,具有较旧libQtXXXXX.so的新libq*.so会导致此问题。这就是它在编译中使用不同 qt 版本的方式。

并且,这表示 wiki 中步骤 13 中的可选00-

[on RPi] Update the device to let the linker find the Qt libs:
echo /usr/local/qt5pi/lib | sudo tee /etc/ld.so.conf.d/qt5pi.conf
sudo ldconfig
If you're facing issues with running the example, try to use 00-qt5pi.conf instead of qt5pi.conf, to introduce proper order.

即使示例运行也没有问题,也应该采取。

最新更新