Qt cross platform compilation with QtRpi to rpi3 - could not find "eglfs"



  • I made a small project using Qt which is intended to run on Raspberry Pi 3 model B. For cross compilation I found QtRpi on web and followed all the instructions on how to install it found here. On my RaspPi3 I flashed latest version of Raspbian Stretch (April 2018), on which I ran rpi-update after booting. Installation went smoothly but when I try to run the compiled binary on my RPi3 I get the following message:

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

    Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, xcb.

    Reinstalling the application may fix the problem. Aborted.

    I already tried twice from the start, but I got the same message both tries. Any advice would be great help. Thanks :)

    Note: I am pretty new with Qt and Linux, take it easy on me :)


  • Moderators

    @Worly So this just means it can't find the platform plugin. Chances are you just need to deploy your application properly. Another way to do it is to use the qt.conf file in your application binary directory and have that point to the plugin path with your platform plugin.

    So for instance my Qt is at /opt/Qt/5.11.0/gcc_64 and the platform plugins are in plugins/platforms.

    You could create a qt.conf that looks like:

    [Paths]
    Plugins = /path/to/your/qt/plugins
    

    And that should allow your app to run. The proper way is to deploy it with all the supporting libraries but since it's for a Pi I wouldn't necessarily bother with all that unless you plan on distributing this software.

    You can also change your rpath on the binary itself. This is where it will check (by default for libraries). It's how the machine you built the application on can find Qt without the deployment or qt.conf, etc. Look up a program called chrpath for that. This is a non-portable method like the hardcoded qt.conf plugin path, so don't use either of these if you intend to distribute.



  • @ambershark Okay that makes sense, I will try it soon but I have few more questions. Does that mean that I have to install Qt on raspberry? Or I can just somehow install the plugins?
    QtRpi has only up to 5.7.0 version of Qt, does that mean that I have to use v5.7.0 plugins or I can use the latest?


  • Moderators

    @Worly You will need to install a cross compiler (for Pi) version of Qt that you want to use to the device. If it has 5.7 preinstalled, you would need to use 5.7 or earlier. You wouldn't be able to use anything newer unless you installed it.



  • @Worly said in Qt cross platform compilation with QtRpi to rpi3 - could not find "eglfs":

    QtRpi has only up to 5.7.0 version of Qt, does that mean that I have to use v5.7.0 plugins or I can use the latest?

    Would you consider going through the steps from this guide? It allows you to cross compile Qt for RPi and it's been used with newer Qt versions and several RPi models.