[英]How Qt's example built during cross compiling qt compared to run qmake after compiling?
首先,这不是Qt无法找到目标.so
,qt可以找到它,但是它无法加载它,并且在终端和gdb
上均未生成日志。 似乎qmake / make使用了错误的库,但是我在make install
生成的交叉编译环境中仅安装了一个qt。
我正在努力为Windows上的树莓派交叉编译qt5.10。 我正在使用gnutoolchains的覆盆子链msys2。
这里的问题是由编译过程构建的示例几乎没有问题,我只需要添加一个qt.conf
即可修复qt.conf
的前缀覆盖,并且它可以运行并在我的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
libQtXXXXX.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.
即使示例运行没有问题,也应该采取。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.