Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved Cross compile Qt5.12.9 for raspberry pi 3b+ succeeds except OpenGL

    Mobile and Embedded
    1
    1
    290
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      thoru last edited by thoru

      Hello folks,

      for cross compiling Qt5.12.9 for a Raspberry Pi 3b+ I followed the blog post https://mechatronicsblog.com/cross-compile-and-deploy-qt-5-12-for-raspberry-pi/
      and https://wiki.qt.io/RaspberryPi2EGLFS. I've also run update-rpi before rsyncing my sysroot. Compiling succeeds. I also have support for eglfs on the pi. But I can't get openGl to work.

      QOpenGLFramebufferObject: Framebuffer incomplete attachment.
      QOpenGLShaderProgram: could not create shader program
      shader compilation failed: 
      ""
      QOpenGLShaderProgram::uniformLocation(matrix): shader program is not linked
      QOpenGLShaderProgram::uniformLocation(opacity): shader program is not linked
      QOpenGLShaderProgram: could not create shader program
      shader compilation failed: 
      ""
      QOpenGLShaderProgram::uniformLocation(matrix): shader program is not linked
      QOpenGLShaderProgram::uniformLocation(textureScale): shader program is not linked
      QOpenGLShaderProgram::uniformLocation(color): shader program is not linked
      QOpenGLShaderProgram::uniformLocation(alphaMin): shader program is not linked
      QOpenGLShaderProgram::uniformLocation(alphaMax): shader program is not linked
      QOpenGLShaderProgram: could not create shader program
      

      I have tried so many different combinations of symlinks, qmake.conf file edits (adding brcm), targets pi3-g++ and pi-g++, and whatever, I just can't get it to work.
      I only see a white blank screen. There are pieces in my QML code that make use of OpacityMask and DropShadow to style an image. If I comment them out, the app runs just fine.

      For example, here is my latest build with the pi-g++ device:

      # qmake configuration for:
      #  - Raspberry PI
      #  - Raspberry PI Zero
      # http://wiki.qt.io/RaspberryPi
      
      include(../common/linux_device_pre.conf)
      
      QMAKE_RPATHLINKDIR_POST += $$[QT_SYSROOT]/opt/vc/lib
      
      QMAKE_LIBDIR_OPENGL_ES2 = $$[QT_SYSROOT]/opt/vc/lib
      QMAKE_LIBDIR_EGL        = $$QMAKE_LIBDIR_OPENGL_ES2
      QMAKE_LIBDIR_OPENVG     = $$QMAKE_LIBDIR_OPENGL_ES2
      
      QMAKE_INCDIR_EGL        = $$[QT_SYSROOT]/opt/vc/include \
                                $$[QT_SYSROOT]/opt/vc/include/interface/vcos/pthreads \
                                $$[QT_SYSROOT]/opt/vc/include/interface/vmcs_host/linux
      QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL}
      QMAKE_INCDIR_OPENVG     = $${QMAKE_INCDIR_EGL}
      
      QMAKE_LIBS_EGL          = -lbrcmEGL -lbrcmGLESv2
      QMAKE_LIBS_OPENVG       = -lbrcmEGL -lbrcmOpenVG -lbrcmGLESv2
      
      QMAKE_INCDIR_BCM_HOST   = $$[QT_SYSROOT]/opt/vc/include
      QMAKE_LIBDIR_BCM_HOST   = $$[QT_SYSROOT]/opt/vc/lib
      QMAKE_LIBS_BCM_HOST     = -lbcm_host
      
      contains(DISTRO, squeeze) {
          #Debian Squeeze: Legacy everything
          QMAKE_LIBS_OPENGL_ES2   = -lbrcmGLESv2 -lbrcmEGL
      } else:contains(DISTRO, arch) {
          #On principle: no wizardry required
      } else {
          #This is not strictly necessary
          DISTRO_OPTS += deb-multi-arch
          DISTRO_OPTS += hard-float
      }
      
      QMAKE_CFLAGS           += \
                                -marm \
                                -mfpu=vfp \
                                -mtune=arm1176jzf-s \
                                -march=armv6zk \
                                -mabi=aapcs-linux
      
      QMAKE_CXXFLAGS          = $$QMAKE_CFLAGS
      
      # Preferred eglfs backend
      EGLFS_DEVICE_INTEGRATION = eglfs_brcm
      
      include(../common/linux_arm_device_post.conf)
      
      load(qt_config)
      

      Qt config:

      Configure summary:
      
      Building on: linux-g++ (x86_64, CPU features: mmx sse sse2)
      Building for: devices/linux-rasp-pi-g++ (arm, CPU features: <none>)
      Target compiler: gcc 4.8.3
      Configuration: cross_compile compile_examples enable_new_dtags largefile precompile_header shared rpath release c++11 concurrent dbus reduce_exports stl
      Build options:
        Mode ................................... release
        Optimize release build for size ........ no
        Building shared libraries .............. yes
        Using C standard ....................... C11
        Using C++ standard ..................... C++11
        Using ccache ........................... no
        Using gold linker ...................... no
        Using new DTAGS ........................ yes
        Using precompiled headers .............. yes
        Using LTCG ............................. no
        Target compiler supports:
          NEON ................................. no
        Build parts ............................ libs
      Qt modules and options:
        Qt Concurrent .......................... yes
        Qt D-Bus ............................... yes
        Qt D-Bus directly linked to libdbus .... yes
        Qt Gui ................................. yes
        Qt Network ............................. yes
        Qt Sql ................................. yes
        Qt Testlib ............................. yes
        Qt Widgets ............................. yes
        Qt Xml ................................. yes
      Support enabled for:
        Using pkg-config ....................... yes
        udev ................................... yes
        Using system zlib ...................... yes
      Qt Core:
        DoubleConversion ....................... yes
          Using system DoubleConversion ........ yes
        GLib ................................... yes
        iconv .................................. yes
        ICU .................................... no
        Tracing backend ........................ <none>
        Logging backends:
          journald ............................. no
          syslog ............................... no
          slog2 ................................ no
        Using system PCRE2 ..................... yes
      Qt Network:
        getifaddrs() ........................... yes
        IPv6 ifname ............................ yes
        libproxy ............................... no
        Linux AF_NETLINK ....................... yes
        OpenSSL ................................ yes
          Qt directly linked to OpenSSL ........ no
        OpenSSL 1.1 ............................ yes
        DTLS ................................... yes
        SCTP ................................... no
        Use system proxies ..................... yes
      Qt Gui:
        Accessibility .......................... yes
        FreeType ............................... yes
          Using system FreeType ................ yes
        HarfBuzz ............................... yes
          Using system HarfBuzz ................ yes
        Fontconfig ............................. yes
        Image formats:
          GIF .................................. yes
          ICO .................................. yes
          JPEG ................................. yes
            Using system libjpeg ............... yes
          PNG .................................. yes
            Using system libpng ................ yes
        EGL .................................... yes
        OpenVG ................................. yes
        OpenGL:
          Desktop OpenGL ....................... no
          OpenGL ES 2.0 ........................ yes
          OpenGL ES 3.0 ........................ yes
          OpenGL ES 3.1 ........................ yes
          OpenGL ES 3.2 ........................ yes
        Vulkan ................................. yes
        Session Management ..................... yes
      Features used by QPA backends:
        evdev .................................. yes
        libinput ............................... yes
        INTEGRITY HID .......................... no
        mtdev .................................. yes
        tslib .................................. yes
        xkbcommon .............................. yes
        X11 specific:
          XLib ................................. yes
          XCB Xlib ............................. yes
          EGL on X11 ........................... no
      QPA backends:
        DirectFB ............................... no
        EGLFS .................................. yes
        EGLFS details:
          EGLFS OpenWFD ........................ no
          EGLFS i.Mx6 .......................... no
          EGLFS i.Mx6 Wayland .................. no
          EGLFS RCAR ........................... no
          EGLFS EGLDevice ...................... no
          EGLFS GBM ............................ no
          EGLFS VSP2 ........................... no
          EGLFS Mali ........................... no
          EGLFS Raspberry Pi ................... yes
          EGLFS X11 ............................ no
        LinuxFB ................................ yes
        VNC .................................... yes
        Mir client ............................. no
        XCB:
          Using system-provided XCB libraries .. yes
          XCB XKB .............................. yes
          XCB XInput ........................... no
          Native painting (experimental) ....... yes
          GL integrations:
            GLX Plugin ......................... no
            EGL-X11 Plugin ..................... no
      Qt Sql:
        SQL item models ........................ yes
      Qt Widgets:
        GTK+ ................................... no
        Styles ................................. Fusion Windows
      Qt PrintSupport:
        CUPS ................................... yes
      Qt Sql Drivers:
        DB2 (IBM) .............................. no
        InterBase .............................. no
        MySql .................................. no
        OCI (Oracle) ........................... no
        ODBC ................................... yes
        PostgreSQL ............................. yes
        SQLite2 ................................ yes
        SQLite ................................. yes
          Using system provided SQLite ......... no
        TDS (Sybase) ........................... yes
      Qt Testlib:
        Tester for item models ................. yes
      Qt SerialBus:
        Socket CAN ............................. yes
        Socket CAN FD .......................... yes
      Further Image Formats:
        JasPer ................................. no
        MNG .................................... yes
        TIFF ................................... yes
          Using system libtiff ................. yes
        WEBP ................................... yes
          Using system libwebp ................. no
      Qt QML:
        QML network support .................... yes
        QML debugging and profiling support .... yes
        QML sequence object .................... yes
        QML list model ......................... yes
        QML XML http request ................... yes
        QML Locale ............................. yes
        QML delegate model ..................... yes
      Qt Quick:
        Direct3D 12 ............................ no
        AnimatedImage item ..................... yes
        Canvas item ............................ yes
        Support for Qt Quick Designer .......... yes
        Flipable item .......................... yes
        GridView item .......................... yes
        ListView item .......................... yes
        TableView item ......................... yes
        Path support ........................... yes
        PathView item .......................... yes
        Positioner items ....................... yes
        Repeater item .......................... yes
        ShaderEffect item ...................... yes
        Sprite item ............................ yes
      Qt Bluetooth:
        BlueZ .................................. no
        BlueZ Low Energy ....................... no
        Linux Crypto API ....................... no
        WinRT Bluetooth API (desktop & UWP) .... no
      Qt Sensors:
        sensorfw ............................... no
      Qt Quick Controls 2:
        Styles ................................. Default Fusion Imagine Material Universal
      Qt Quick Templates 2:
        Hover support .......................... yes
        Multi-touch support .................... yes
      Qt Multimedia:
        ALSA ................................... yes
        GStreamer 1.0 .......................... no
        GStreamer 0.10 ......................... no
        Video for Linux ........................ yes
        OpenAL ................................. yes
        PulseAudio ............................. yes
        Resource Policy (libresourceqt5) ....... no
        Windows Audio Services ................. no
        DirectShow ............................. no
        Windows Media Foundation ............... no
      Qt Tools:
        QDoc ................................... no
      
      Note: Also available for Linux: linux-clang linux-icc
      
      Note: PKG_CONFIG_LIBDIR automatically set to /home/thomas/raspi/sysroot/usr/lib/pkgconfig:/home/thomas/raspi/sysroot/usr/share/pkgconfig:/home/thomas/raspi/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig
      

      Command line:

      -release -opengl es2 -eglfs -qpa eglfs -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=/home/thomas/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot /home/thomas/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix /home/thomas/raspi/qt5pi -hostprefix /home/thomas/raspi/qt5 -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtscript -skip qtcharts -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtlocation -skip qtmacextras -skip qtpurchasing -skip qtscript -skip qtscxml -skip qtspeech -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebglplugin -skip qtwebsockets -skip qtwebview -skip qtwinextras -skip qtxmlpatterns -no-use-gold-linker -v -no-gbm
      

      The links to the brcm libs:

      lrwxrwxrwx 1 root root  /usr/lib/arm-linux-gnueabihf/libEGL.so.1.1.0 -> /opt/vc/lib/libbrcmEGL.so
      lrwxrwxrwx 1 root root  /usr/lib/arm-linux-gnueabihf/libEGL.so.1.1 -> /opt/vc/lib/libbrcmEGL.so
      lrwxrwxrwx 1 root root  /usr/lib/arm-linux-gnueabihf/libEGL.so.1 -> /opt/vc/lib/libbrcmEGL.so
      lrwxrwxrwx 1 root root  /usr/lib/arm-linux-gnueabihf/libEGL.so -> /opt/vc/lib/libbrcmEGL.so
      -rw-r--r-- 1 root root  /opt/vc/lib/libEGL.so
      lrwxrwxrwx 1 root root  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.1.0 -> /opt/vc/lib/libbrcmGLESv2.so
      lrwxrwxrwx 1 root root  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.1 -> /opt/vc/lib/libbrcmGLESv2.so
      lrwxrwxrwx 1 root root  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2 -> /opt/vc/lib/libbrcmGLESv2.so
      lrwxrwxrwx 1 root root  /usr/lib/arm-linux-gnueabihf/libGLESv2.so -> /opt/vc/lib/libbrcmGLESv2.so
      

      ldd myapp

      ...
      libGLESv2.so.2 => /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2
      libbrcmEGL.so => /opt/vc/lib/libbrcmEGL.so
      ...
      

      And now the really strange part -> maybe this is a bug?
      I can display the image (with mask, and dropshadow) itself.
      But I can not load it as a delegate from a DelegateModel like following (this is when I see the open gl errors from above):

      DelegateModel{      
          id: mydelegatemodel      
          model: kidmodel      
          delegate: RoundShadowIcon{      
              id: item      
              width: grid.cellWidth;      
              height: grid.cellHeight;      
          }      
      }      
      GridView{      
          clip: true      
          id: grid      
          anchors.fill: parent      
          cellWidth: 100      
          cellHeight: 100      
          model: mydelegatemodel      
      }
      

      RoundShadowIcon.qml:

      import QtQuick 2.12
      import QtGraphicalEffects 1.12
      
      Item {
          Image {
              id: face
              source: "file:///usr/local/qt5pi/examples/myapp/cache/someimage.png"
              sourceSize: Qt.size(parent.width, parent.height)
              width: parent.width
              height: parent.height
              fillMode: Image.PreserveAspectCrop
              smooth: true
              visible: false
          }
          Rectangle{
              id: mask
              anchors.fill: parent
              radius: main.radius_
              visible: false
          }
          OpacityMask {
              id: round
              anchors.fill: face
              source: face
              maskSource: mask
          }
          DropShadow {
              id: shadow
              anchors.fill: parent
              horizontalOffset: 0
              verticalOffset: 0
              radius: 12.0
              samples: 17
              source: round
          }
      }
      

      Greetings
      Thomas

      1 Reply Last reply Reply Quote 0
      • First post
        Last post