Qt Forum

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

    Unsolved Qt 5.15.1 for Raspberry Pi 4 (cross)

    Mobile and Embedded
    raspberry pi 4 cross-compiling pkg-config
    2
    5
    1967
    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.
    • M
      mneg last edited by

      Hi,

      I am cross-compiling Qt 5.15.1 (qt-everywhere bundle) for a Raspberry Pi 4 with Raspbian Buster, however, the configuration seems to have difficulties finding several headers ("XY not found in [] and global paths."). The RPi and sysroot do contain the headers and libraries and the related .pc files in the pkgconfig-folders seem to point to the right paths.

      Here are some details:

      Toolchains tested: arm-gcc 8.3.0 (cross-pi-gcc by Pro on github) and 7.5.0 (Linaro)

      Configuration: ./configure
      -release
      -opengl es2
      -eglfs
      -device linux-rasp-pi4-v3d-g++
      -device-option CROSS_COMPILE=/opt/cross-pi-gcc/bin/arm-linux-gnueabihf-
      -sysroot /mnt/data/qteverywhere/sysroot
      -opensource -confirm-license
      -skip qtwayland
      -skip qtlocation
      -skip qtscript
      -make libs
      -prefix /opt/Qt
      -extprefix /mnt/data/qteverywhere/qt5pi
      -hostprefix /mnt/data/qteverywhere/qt5
      -v -recheck

      Sample output of configure for one of the headers not found (GLES2/gl2.h):

      Checking for OpenGL ES 2.0... 
      Trying source 0 (type pkgConfig) of library opengl_es2 ...
      + PKG_CONFIG_SYSROOT_DIR=/mnt/data/qteverywhere/sysroot PKG_CONFIG_LIBDIR=/mnt/data/qteverywhere/sysroot/usr/lib/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/share/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig /usr/bin/pkg-config --exists --silence-errors glesv2
      + PKG_CONFIG_SYSROOT_DIR=/mnt/data/qteverywhere/sysroot PKG_CONFIG_LIBDIR=/mnt/data/qteverywhere/sysroot/usr/lib/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/share/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig /usr/bin/pkg-config --modversion glesv2
      > 3.2
      + PKG_CONFIG_SYSROOT_DIR=/mnt/data/qteverywhere/sysroot PKG_CONFIG_LIBDIR=/mnt/data/qteverywhere/sysroot/usr/lib/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/share/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig /usr/bin/pkg-config --libs-only-L glesv2
      > -L/mnt/data/qteverywhere/sysroot/usr/lib/arm-linux-gnueabihf
      + PKG_CONFIG_SYSROOT_DIR=/mnt/data/qteverywhere/sysroot PKG_CONFIG_LIBDIR=/mnt/data/qteverywhere/sysroot/usr/lib/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/share/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig /usr/bin/pkg-config --libs-only-l glesv2
      > -lGLESv2
      + PKG_CONFIG_SYSROOT_DIR=/mnt/data/qteverywhere/sysroot PKG_CONFIG_LIBDIR=/mnt/data/qteverywhere/sysroot/usr/lib/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/share/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig /usr/bin/pkg-config --cflags glesv2
      header entry 'config.qtbase_gui.libraries.opengl_es2.headers.0' passed condition.
      GLES2/gl2.h not found in [] and global paths.
        => source produced no result.
      Trying source 1 (type makeSpec) of library opengl_es2 ...
      header entry 'config.qtbase_gui.libraries.opengl_es2.headers.0' passed condition.
      GLES2/gl2.h not found in [] and global paths.
        => source produced no result.
      test config.qtbase_gui.libraries.opengl_es2 FAILED
      

      Sample folder structure in sysroot:
      /mnt/data/qteverywhere/sysroot/usr/include/GLES2/
      ├── gl2ext.h
      ├── gl2.h
      └── gl2platform.h

      ls -la /mnt/data/qteverywhere/sysroot/usr/lib/arm-linux-gnueabihf/libGLESv2.so*
      /mnt/data/qteverywhere/sysroot/usr/lib/arm-linux-gnueabihf/libGLESv2.so -> libGLESv2.so.2
      /mnt/data/qteverywhere/sysroot/usr/lib/arm-linux-gnueabihf/libGLESv2.so.2 -> libGLESv2.so.
      /mnt/data/qteverywhere/sysroot/usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.1.0

      more /mnt/data/qteverywhere/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig/glesv2.pc
      prefix=/usr
      libdir=${prefix}/lib/arm-linux-gnueabihf
      includedir=${prefix}/include

      Name: GLESv2
      Description: OpenGL ES v2/v3 library and headers.
      Version: 3.2
      Libs: -L${libdir} -lGLESv2
      Cflags: -I${includedir}

      Unmodified qmake.conf of linux-rasp-pi4-v3d-g++:

      # qmake configuration for the Raspberry Pi 4 (32-bit) using the Mesa V3D
      # graphics stack. (not the Broadcom stack)
      #
      # This supports accelerated OpenGL both for X11 and DRM/KMS.  Perhaps
      # Wayland too.
      #
      # Tested with a sysroot created from Raspbian Buster and a gcc 7.4
      # toolchain from Linaro.
      #
      # Example configure command line, assuming installation to
      # /usr/local/qt5pi on device and ~/rpi/qt5 on the host:
      #
      # ./configure -release -opengl es2 -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=~/rpi/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- \
      #   -sysroot ~/rpi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/rpi/qt5 -v
      #
      # Check the configure output carefully. EGLFS, EGLFS GBM, and EGL on X11
      # should all be 'yes'. Otherwise something is wrong.
      #
      # If getting linker errors like "undefined reference to `_dl_stack_flags'" check the
      # symlinks in the sysroot, they were probably not adjusted
      # correctly. F.ex. sysroot/usr/lib/arm-linux-gnueabihf/libpthread.so must point to
      # sysroot/lib/arm-linux-gnueabihf/libpthread.so.0. If it is a broken link instead, bad
      # things will happen.
      
      include(../common/linux_device_pre.conf)
      
      QMAKE_LIBS_EGL         += -lEGL
      QMAKE_LIBS_OPENGL_ES2  += -lGLESv2 -lEGL
      
      QMAKE_CFLAGS            = -march=armv8-a -mtune=cortex-a72 -mfpu=crypto-neon-fp-armv8
      QMAKE_CXXFLAGS          = $$QMAKE_CFLAGS
      
      DISTRO_OPTS            += hard-float
      DISTRO_OPTS            += deb-multi-arch
      
      EGLFS_DEVICE_INTEGRATION = eglfs_kms
      
      include(../common/linux_arm_device_post.conf)
      
      load(qt_config)
      

      Any help would be most welcome.

      1 Reply Last reply Reply Quote 0
      • Diracsbracket
        Diracsbracket last edited by Diracsbracket

        Hi.
        I also just spent the last couple of days trying to get Qt 5.15.1 to cross build for Pi 4 and the latest Pi OS Lite image on my Debian 10 (Buster) and it finally worked.

        Like you, I initially tried several toolchains:

        gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf (from linaro.org)
        gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf (from arm.com)
        

        Neither of the above seemed to work for some reason, and I ended up using the toolchain from the Debian repository, which I found to work before too:

        sudo dpkg --add-architecture armhf
        sudo apt install crossbuild-essential-armhf
        

        It installs in /usr/bin and has version:

        $ /usr/bin/arm-linux-gnueabihf-g++ --version
        arm-linux-gnueabihf-g++ (Debian 8.3.0-2) 8.3.0
        

        Furthermore, I needed to add -kms to configure, requiring in turn to install libdrm-dev in order for test.egl-egldevice to pass.

        Indeed, from ./qtbase/src/gui/configure.json:

        "eglfs_egldevice": {
                    "label": "EGLFS EGLDevice",
                    "condition": "features.eglfs && tests.egl-egldevice && features.kms",
                    "output": [ "privateFeature" ]
                },
        

        This is my configure command-line:

        ../configure -v \
        -release \
        -opengl es2 -eglfs -kms \
        -make libs \
        -device linux-rasp-pi4-v3d-g++ \
        -device-option CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- \
        -sysroot /home/dirac/raspi/rootfs \
        -prefix /opt/Qt5.15.1 \
        -extprefix /home/dirac/raspi/Qt5.15.1 \
        -hostprefix /home/dirac/raspi/qt5tools \
        -opensource -confirm-license \
        -evdev \
        -skip qtwayland \
        -skip qtwebengine \
        -skip qtlocation \
        -skip qtscript \
        -no-use-gold-linker \
        -nomake tests \
        -nomake examples
        
        1 Reply Last reply Reply Quote 2
        • M
          mneg last edited by

          Using the toolchain from Debian repository didn't help for me (compiler version is 7.5.0 on Mint 19.3 / Ubuntu 18.04). While trying to dig deeper into the Qt build calls to identify the problem, I end up at "=> source produced no result". The pkg-config still seems to be successfull for most tests but after that there is no more information about why the test fails.

          Has someone an idea of how to make further investigations? There must be a way to see why the tests fail.

          Here is another sample output of a failed test:

          Checking for udev... 
          Trying source 0 (type pkgConfig) of library libudev ...
          + PKG_CONFIG_SYSROOT_DIR=/mnt/data/qteverywhere/sysroot PKG_CONFIG_LIBDIR=/mnt/data/qteverywhere/sysroot/usr/lib/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/share/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig /usr/bin/pkg-config --exists --silence-errors libudev
          + PKG_CONFIG_SYSROOT_DIR=/mnt/data/qteverywhere/sysroot PKG_CONFIG_LIBDIR=/mnt/data/qteverywhere/sysroot/usr/lib/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/share/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig /usr/bin/pkg-config --modversion libudev
          > 241
          + PKG_CONFIG_SYSROOT_DIR=/mnt/data/qteverywhere/sysroot PKG_CONFIG_LIBDIR=/mnt/data/qteverywhere/sysroot/usr/lib/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/share/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig /usr/bin/pkg-config --libs-only-L libudev
          > -L/mnt/data/qteverywhere/sysroot/lib/arm-linux-gnueabihf
          + PKG_CONFIG_SYSROOT_DIR=/mnt/data/qteverywhere/sysroot PKG_CONFIG_LIBDIR=/mnt/data/qteverywhere/sysroot/usr/lib/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/share/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig /usr/bin/pkg-config --libs-only-l libudev
          > -ludev
          + PKG_CONFIG_SYSROOT_DIR=/mnt/data/qteverywhere/sysroot PKG_CONFIG_LIBDIR=/mnt/data/qteverywhere/sysroot/usr/lib/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/share/pkgconfig:/mnt/data/qteverywhere/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig /usr/bin/pkg-config --cflags libudev
          libudev.h not found in [] and global paths.
            => source produced no result.
          Trying source 1 (type inline) of library libudev ...
          libudev.h not found in [] and global paths.
            => source produced no result.
          test config.qtbase.libraries.libudev FAILED
          
          1 Reply Last reply Reply Quote 0
          • M
            mneg last edited by

            On manually running the udev test (log output is above) which reads

             "libudev": {
                        "label": "udev",
                        "test": {
                            "main": "udev_unref(udev_new());"
                        },
                        "headers": "libudev.h",
                        "sources": [
                            { "type": "pkgConfig", "args": "libudev" },
                            "-ludev"
                        ]
                    }
            

            I get

            LANG=en /opt/gcc-linaro-7.5.0_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -march=armv8-a -mtune=cortex-a72 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/mnt/data/qteverywhere/sysroot -O2 -w -fPIC -L/mnt/data/qteverywhere/sysroot/lib/arm-linux-gnueabihf -ludev test.c 
            /opt/gcc-linaro-7.5.0_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/bin/ld: warning: librt.so.1, needed by /mnt/data/qteverywhere/sysroot/lib/arm-linux-gnueabihf/libudev.so, not found (try using -rpath or -rpath-link)
            /opt/gcc-linaro-7.5.0_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/bin/ld: warning: libpthread.so.0, needed by /mnt/data/qteverywhere/sysroot/lib/arm-linux-gnueabihf/libudev.so, not found (try using -rpath or -rpath-link)
            /mnt/data/qteverywhere/sysroot/lib/arm-linux-gnueabihf/libudev.so: undefined reference to `clock_gettime@GLIBC_2.4'
            collect2: error: ld returned 1 exit status
            

            Upon linking the missing libraries by adding '-lrt -lpthread', the program compiles. When modifying sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig/libudev.pc to explicitly point to those libraries (Libs.private: -lrt -lpthread) and even adding it to 'Libs:', the test still fails.

            It seems as if the test is not executed at all. Why is that?

            1 Reply Last reply Reply Quote 0
            • M
              mneg last edited by

              FYI: the issues vanished with the previous version Qt 5.14.2 and the 7.5.0 Linaro toolchain (but not the others!). Suddenly the tests are being run. My cross development toolchain now is up and running, however, I still find it odd that there are no error messages in Qt's build system.

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