Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Cross-compile to Raspberry Pi 3 fails & EGLFS issue



  • Hello,

    i tried cross-compiling qt to the raspberry pi 3 using this tutorial:
    https://wiki.qt.io/RaspberryPi2EGLFS

    Everything until step 10 works perfectly, but when compiling it fails:
    I am getting the following errors in th /src/corelib/thread/qbasicatomic.h:

    ...
    61:4: error: #error "Qt requires C++11 support"
    94:13: error: QAtomicOps does not name a type
    ...
    

    I am using the toolkit provided by the raspberry pi repository. My configuration looks like that:

    ./configure -release -opengl es2 -device linux-rasp-pi3-vc4-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v -no-use-gold-linker
    

    I am using Qt 5.14.0 from the official repo.
    The Linaro compiler is gcc 4.8.3 from 03.2014.
    Does the cross compiler not support C++11 or is something missing/wrong?

    Sincerely,
    onek24

    Update 1:

    When using Qt 5.12.0 from the official repo, the compilation seems to work, altho i have seen that EGLFS Raspberry Pi is set to No. Looks like the tutorial isn't working from Qt 5.14 upwards. If using linux-rasp-pi3-g++, EGLFS support is set to yes.

    Building Qt 5.12 is fine for now, but how to obtain EGLFS support with linux-rasp-pi3-vc4-g++?


  • Lifetime Qt Champion

    @onek24 said in Cross-compile to Raspberry Pi 3 fails & EGLFS issue:

    but how to obtain EGLFS support with linux-rasp-pi3-vc4-g++?

    You should check the configure log to see why EGLFS was disabled.

    "The Linaro compiler is gcc 4.8.3 from 03.2014." - this is quite old compiler, you should update.



  • @jsulm said in Cross-compile to Raspberry Pi 3 fails & EGLFS issue:

    @onek24 said in Cross-compile to Raspberry Pi 3 fails & EGLFS issue:

    but how to obtain EGLFS support with linux-rasp-pi3-vc4-g++?

    You should check the configure log to see why EGLFS was disabled.

    "The Linaro compiler is gcc 4.8.3 from 03.2014." - this is quite old compiler, you should update.

    There is no newer "official" raspberry pi compiler, see: https://github.com/raspberrypi/tools
    Also i am very averse to build a newer crosscompile GCC myself.

    Couldn't find anything in the configure log yet, but ill continue to search.



  • @jsulm
    Thank you for your answer by the way.

    I compiled Qt 5.12 and the qopenglwidget example using linux-rasp-pi3-g+.
    When i try to start the qopenglwidget example on my pi, i get a "Could not find DRM device" error.
    When i configured "vc4-kms-v3d" or "vc4-fkms-v3d" for the pi, it detects a video device, but i get the error "failed to add service - already in use?"

    I am having a really hard time to understand how to compile Qt and applications to be useable with EGLFS and either the offical broadcom or the newer ("experimental") VC4 driver - e.g. with GPU support.

    What are "vc4-fkms-v3d" and "vc4-kms-v3d"?
    Are they enabling the open source VC4 driver or the closed broadcom driver?
    If i have neither of them in the config, is there any opengl support available at all?
    What EGL/GLES libraries are the ones in /opt/vc/lib?


  • Lifetime Qt Champion

    @onek24 Sorry, I don't have much experience with compiling Qt for RPi. Maybe somebody else can help here.



  • @jsulm said in Cross-compile to Raspberry Pi 3 fails & EGLFS issue:

    @onek24 Sorry, I don't have much experience with compiling Qt for RPi. Maybe somebody else can help here.

    Thanks anyway. Other people had similiar issues but didn't receive much help, if any at all, so i don't really expect to get an answer here.



  • Build Qt using this Tutorial with GCC 6.3:
    https://wiki.qt.io/RaspberryPiWithWebEngine
    and it says "could not initialize EGL display"

    When booting into raspbian desktop environment, i can use "-platform eglfs" and it works



  • When adding -kms to configure, it says that drm.libs fails.
    When checking the log, i see that "xf86drmMode.h" can not find the "drm.h".
    I installed libdrm-dev for the headers and these are in sysroot/usr/include/libdrm/ while "xf86drmMode.h" is in sysroot/usr/include/.
    Why cant it find drm.h?



  • Late reply on this topic. I ran in the same problem when cross compiling Qt5.15.0 using QtCreator 4.13 on Ubuntu 18.04. I think the error message itself is a mis-nomer, since the configure scripts confirms C++11 capability of the (old) linaro toolchain compiler. Anyway, my solution was to use an alternative (newer) toolchain from https://github.com/Pro/raspi-toolchain/releases/latest/download/raspi-toolchain.tar.gz (see https://stackoverflow.com/questions/19162072/how-to-install-the-raspberry-pi-cross-compiler-on-my-linux-host-machine/58559140#58559140 for some additional info) It provides an arm-linux-gnueabihf-g++ (GCC) 8.3.0 - and the error is gone. Although I ran into problems with openGL. After changing the toolchain the Qt configure script didn't find the openGL headers anymore. Since I don't need openGL on raspi, I just disabled it with -no-opengl without trying to solve the openGL issue. (sorry, my impression is that openGL on Raspbian is quite a mess...)



  • I ran in the same problems but I finally got it to build it with the toolchain proposed by stryga42 AND OpenGL support.

    1.)
    I copied the liniux-rasp-pi-g++/qmake.conf to liniux-rasp-pi-g++ and took the following lines

    QMAKE_CFLAGS = -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8
    QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -std=c++11

    from the inital qmake.conf (as mentioned in the tutorial).

    2.)

    To make ./configure find the raspi OpenGL drivers it was necessary to set the following symlinks in sysroot/opt/vc/lib

    libEGL.so -> libbrcmEGL.so
    libGLESv2.so -> libbrcmGLESv2.so
    libOpenVG.so -> libbrcmOpenVG.so

    (this needs to be done on raspberry side as well)

    3.)
    With following env variables it was possible to start the glwidget example with Qt 5.14.1 and eglfs with the correct openGL drivers.

    export QT_QPA_PLATFORM=eglfs
    export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/local/qt5pi/plugins/platforms
    export LD_LIBRARY_PATH=/usr/local/qt5pi/lib


Log in to reply