Qt World Summit: Register Today!

How can I make Cantata-Qt to work with EGLFS on Raspberry Pi2?

  • Hi,
    I built Qt to work with EGLFS on my Raspberry Pi2 according to
    these instructions.

    This works fine, as I can run the various standard Qt example projects.

    Because it has a Qt frontend, I selected Cantata as a simple yet powerful
    music player, which I built from natively on my Pi2 from
    this source version for Qt without KDE.

    It builds well, but upon launching, I get the following error:

    pi@pi2:~/cantata-master/build$ cantata
    QXcbConnection: Could not connect to display

    I tried to set the eglfs platform as follows:

    export QT_QPA_PLATFORM=eglfs

    Then running it again this time gives:

    pi@pi2:~$ cantata
    libEGL warning: DRI3: xcb_connect failed
    libEGL warning: DRI2: xcb_connect failed
    libEGL warning: DRI2: xcb_connect failed
    Could not initialize egl display

    Any one knows what is going on here? Does the above error mean that libEGL is trying to use the XCB library? Why does it need the XCB library, since I don't want to use X11 but EGLFS?

    What do I need to change to make Cantata-Qt work with EGLFS then?

    Many, many thanks if you know the answer and are willing to share it here!

  • Try to cantata with eglfs option

    cantata -platform eglfs

  • Hi, tomasz3dk,
    Thanks for reacting.

    I tried cantata -platform eglfs too, but gives the same error as when using export QT_QPA_PLATFORM=eglfs
    Why is it using xcb_connect? That's for XCB, no?

    Other suggestions? ^^

  • Probably you crosscompiled qt with xcb support and not with eglfs. If you want to quick deploy cantata on raspberry you can use image from this site, or build your own image and sdk starting with instructions on this site. Hope it will be useful for you.

  • @tomasz3dk
    I cross-compiled Qt for use with EGLFS according to this wiki. I have tested it to work with all the demo applications in the Qt directory, specifically those requiring openGL, thus Qt is OK.

    Not knowing how to setup the cantata build for cross-compiling, I compiled it natively, i.e. directly on the Pi2. The default build settings are for a Qt5 build without KDE, but apparently it requires X11 or XCB which I don't want to use.

    The cantata package in the official Debian jessie repository is for use with KDE which I also don't want.

  • @Diracsbracket said in How can I make Cantata-Qt to work with EGLFS on Raspberry Pi2?:

    Not knowing how to setup the cantata build for cross-compiling, I compiled it natively, i.e. directly on the Pi2

    I think that maybe this is the reason that cantata requires xcb, check which version of Qt was used when you compiled natively on rpi(crosscompiled and deployed to device or this directly from rootfs).

  • @tomasz3dk
    I uninstalled all Qt packages that were on my Pi, and resync'ed it with the sysroot on the build server and relaunched the build.
    Now, I don't get the xcb error messages any longer, but the usual "Unable to query physical screen size...." I also get when I run the Qt examples requiring GL, which work.

    cantata -platform=eglfs
    Unable to query physical screen size, defaulting to 100 dpi.
    To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).

    Although I don't get any error message this time, I also don't get anything else. Nothing happens, and there is no cantata process in the background either...

    So, I got a little bit closer, but still not completely there yet...

  • I looked into cantata main.cpp file from sources and there are some lines that might cause this

    if (Settings::self()->firstRun()) {
            InitialSettingsWizard wz;
            if (QDialog::Rejected==wz.exec()) {
                return 0;
        MainWindow mw;
        #if defined Q_OS_WIN || defined Q_OS_MAC
        #endif // !defined Q_OS_MAC
        if (!Settings::self()->startHidden()) {

    Maybe comment out lines about "first run", and "start hidden" and leave just only:

    Mainwindow mw;

    and try to compile again, run and see what's happen.

  • @
    Thanks! I tried what you suggested, but gives same result.

    Since my Qt Creator's cross-compiling environment is set up correctly, I also tried cross-compiling it on my build host which also runs Qt Creator by creating a CMake toolchain file and passing it to cmake. The build succeeds, but again, with the same result (as expected of course, since the native build didn't work either).

    What a waste of time...
    In any case, thanks for your kind suggestions @tomasz3dk

  • No problem ;). Since you abandoned idea with cantata, maybe you will write your own fronted for mpd?

Log in to reply