[英]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.