简体   繁体   English

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

[英]How Qt's example built during cross compiling qt compared to run qmake after compiling?

FIRST, it's not the issue that Qt CANNOT found target .so , qt can found it, but it failed to load it and produce not logs... on both terminal and gdb . 首先,这不是Qt无法找到目标.so ,qt可以找到它,但是它无法加载它,并且在终端和gdb上均未生成日志。 It seems that qmake/make is using wrong library but I have only one qt installed in my cross compile environment that generated by make install . 似乎qmake / make使用了错误的库,但是我在make install生成的交叉编译环境中仅安装了一个qt。

I'm struggling for cross compiling qt5.10 for raspberry pi on Windows. 我正在努力为Windows上的树莓派交叉编译qt5.10。 I'm using msys2, gnutoolchains's raspberry chains. 我正在使用gnutoolchains的覆盆子链msys2。

The problem here is the examples built by the compiling process runs almost no problem, I only needs to add a qt.conf to fix the prefix override by msys2 and it can run and display something on my pi. 这里的问题是由编译过程构建的示例几乎没有问题,我只需要添加一个qt.conf即可修复qt.conf的前缀覆盖,并且它可以运行并在我的pi上显示某些内容。

But when it comes to qt creator, or qmake out of cross compiling, it starts to show me: 但是当涉及到qt creator或qmake进行交叉编译时,它开始向我展示:

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

Here are two problems, first, the platform plugin should not be xcb since I'm running without x, cross compiled version will use eglfs by default. 这里有两个问题,首先,平台插件不应该是xcb因为我没有使用x,默认情况下,交叉编译版本将使用eglfs And, second, even I specific platform plugin to eglfs , it still tells me it cannot load eglfs . 其次,即使我是eglfs特定平台插件,它仍然告诉我它无法加载eglfs

I'm putting two version of programs in the same place. 我将两个版本的程序放在同一位置。

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 is compiled by qmake && make and 2dpainting is by qt's cross compiling process uses the same source. 2dpaint_my由qmake && make编译,而2dpainting由qt的交叉编译过程使用相同的源代码。

I'm suspecting qt is adding something during it's cross compiling, but I'm not sure how it happened. 我怀疑qt在交叉编译期间添加了一些内容,但是我不确定它是如何发生的。 Qt'wiki about raspberry pi contains nothing about this issue. 关于树莓派的Qt'wiki不包含有关此问题的内容。

update 更新

It looks even wired to me. 它看起来甚至连我 I copied a running example from its folder to another and it also crash, things look like this.. 我将一个正在运行的示例从其文件夹复制到另一个文件夹,它也崩溃了,事情看起来像这样。

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"

I'm not sure, but it seems that the this step on qt'wiki introduced some qt5.7 files into lib folder. 我不确定,但是似乎在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

The problem is, qt's examples, when it on their own folders, can magically find (maybe qmake install did something?) and use the correct *.so , and so it works without problem. 问题是,当qt的示例位于其自己的文件夹中时,可以神奇地找到(也许qmake install做了什么?)并使用正确的*.so ,因此它可以正常工作。

But, when compiling with qmake , the program won't find the correct libraries so, newer libq*.so with older libQtXXXXX.so lead to this probleam. 但是,使用qmake进行编译时,程序找不到正确的库,因此,带有较旧的libQtXXXXX.so较新的libq*.so libQtXXXXX.so导致此问题。 And that's how it uses a different qt version with compile. 这就是它使用不同的qt版本进行编译的方式。

And, that indicates the optional 00- in step 13 from the wiki : 并且,这表示来自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.

should be taken even the examples run without problem. 即使示例运行没有问题,也应该采取。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM