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. 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.

I'm struggling for cross compiling qt5.10 for raspberry pi on Windows. I'm using msys2, gnutoolchains's raspberry chains.

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.

But when it comes to qt creator, or qmake out of cross compiling, it starts to show me:

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. And, second, even I specific platform plugin to eglfs, it still tells me it cannot load 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  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.

I'm suspecting qt is adding something during it's cross compiling, but I'm not sure how it happened. Qt'wiki about raspberry pi contains nothing about this issue.


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.
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"

1 answer

  • answered 2018-04-17 09:07 Yangff

    I'm not sure, but it seems that the this step on qt'wiki introduced some qt5.7 files into lib folder.

    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.

    But, when compiling with qmake, the program won't find the correct libraries so, newer libq*.so with older lead to this probleam. And that's how it uses a different qt version with compile.

    And, that indicates the optional 00- in step 13 from the wiki:

    [on RPi] Update the device to let the linker find the Qt libs:
    echo /usr/local/qt5pi/lib | sudo tee /etc/
    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.