2

Some time ago I set up a Linux host to cross-compile Qt5. I used this configure command:

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

and I successfully cross-compiled Qt5.9 with EGLFS support. Now I want update to Qt5.13.

I checked out the git repository and typed the same configure command. Here the configure output:

Building on: linux-g++ (x86_64, CPU features: mmx sse sse2) Building for: devices/linux-rasp-pi3-g++ (arm, CPU features: neon) Target compiler: gcc 4.8.3 Configuration: cross_compile compile_examples enable_new_dtags largefile neon 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 new DTAGS ........................ yes Using precompiled headers .............. no Using LTCG ............................. no Target compiler supports: NEON ................................. yes 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 Zstandard support ...................... no Qt Core: DoubleConversion ....................... yes Using system DoubleConversion ........ no GLib ................................... yes iconv .................................. yes ICU .................................... no Built-in copy of the MIME database ..... yes Tracing backend ........................ <none> Logging backends: journald ............................. no syslog ............................... no slog2 ................................ no Using system PCRE2 ..................... no Qt Network: getifaddrs() ........................... yes IPv6 ifname ............................ yes libproxy ............................... no Linux AF_NETLINK ....................... yes OpenSSL ................................ yes Qt directly linked to OpenSSL ........ no OpenSSL 1.1 ............................ no DTLS ................................... yes OCSP-stapling .......................... no SCTP ................................... no Use system proxies ..................... yes Qt Gui: Accessibility .......................... yes FreeType ............................... yes Using system FreeType ................ yes HarfBuzz ............................... yes Using system HarfBuzz ................ no Fontconfig ............................. no Image formats: GIF .................................. yes ICO .................................. yes JPEG ................................. yes Using system libjpeg ............... no PNG .................................. yes Using system libpng ................ yes EGL .................................... no OpenVG ................................. no OpenGL: Desktop OpenGL ....................... no OpenGL ES 2.0 ........................ no OpenGL ES 3.0 ........................ no OpenGL ES 3.1 ........................ no OpenGL ES 3.2 ........................ no Vulkan ................................. no Session Management ..................... yes Features used by QPA backends: evdev .................................. yes libinput ............................... yes INTEGRITY HID .......................... no mtdev .................................. no tslib .................................. yes xkbcommon .............................. no X11 specific: XLib ................................. yes XCB Xlib ............................. yes EGL on X11 ........................... no QPA backends: DirectFB ............................... no EGLFS .................................. no LinuxFB ................................ yes VNC .................................... yes Mir client ............................. no Qt Sql: SQL item models ........................ yes Qt Widgets: GTK+ ................................... no Styles ................................. Fusion Windows Qt PrintSupport: CUPS ................................... no Qt Sql Drivers: DB2 (IBM) .............................. no InterBase .............................. no MySql .................................. no OCI (Oracle) ........................... no ODBC ................................... no PostgreSQL ............................. no SQLite2 ................................ no SQLite ................................. yes Using system provided SQLite ......... no TDS (Sybase) ........................... no Qt Testlib: Tester for item models ................. yes Qt SerialBus: Socket CAN ............................. yes Socket CAN FD .......................... yes SerialPort Support ..................... yes Further Image Formats: JasPer ................................. no MNG .................................... no TIFF ................................... yes Using system libtiff ................. no WEBP ................................... yes Using system libwebp ................. no Qt QML: QML network support .................... yes QML debugging and profiling support .... yes QML tracing JIT support ................ no 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 Scxml: ECMAScript data model for QtScxml ...... yes Qt Gamepad: SDL2 ................................... no Qt 3D: Assimp ................................. yes System Assimp .......................... no Output Qt3D Job traces ................. no Output Qt3D GL traces .................. no Use SSE2 instructions .................. no Use AVX2 instructions .................. no Aspects: Render aspect ........................ yes Input aspect ......................... yes Logic aspect ......................... yes Animation aspect ..................... yes Extras aspect ........................ yes Qt 3D Renderers: OpenGL Renderer ........................ yes Qt 3D GeometryLoaders: Autodesk FBX ........................... no Qt Wayland Client ........................ no Qt Wayland Compositor .................... no Qt Bluetooth: BlueZ .................................. no BlueZ Low Energy ....................... no Linux Crypto API ....................... no WinRT Bluetooth API (desktop & UWP) .... no WinRT advanced bluetooth low energy 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 Positioning: Gypsy GPS Daemon ....................... no WinRT Geolocation API .................. no Qt Location: Qt.labs.location experimental QML plugin . yes Geoservice plugins: OpenStreetMap ........................ yes HERE ................................. yes Esri ................................. yes Mapbox ............................... yes MapboxGL ............................. no Itemsoverlay ......................... yes QtXmlPatterns: XML schema support ..................... yes Qt Multimedia: ALSA ................................... yes GStreamer 1.0 .......................... no GStreamer 0.10 ......................... no Video for Linux ........................ yes OpenAL ................................. no PulseAudio ............................. no Resource Policy (libresourceqt5) ....... no Windows Audio Services ................. no DirectShow ............................. no Windows Media Foundation ............... no Qt Tools: QDoc ................................... no Qt WebEngineCore: Qt WebEngine Widgets ................... yes Qt WebEngine Qml ....................... yes Embedded build ......................... yes Pepper Plugins ......................... no Printing and PDF ....................... no Proprietary Codecs ..................... no Spellchecker ........................... yes Native Spellchecker .................... no WebRTC ................................. no Use System Ninja ....................... no Geolocation ............................ yes WebChannel support ..................... yes Use v8 snapshot ........................ yes Kerberos Authentication ................ no Extensions ............................. no Building v8 snapshot supported ......... yes Use ALSA ............................... yes Use PulseAudio ......................... no Optional system libraries used: re2 .................................. no icu .................................. no libwebp, libwebpmux and libwebpdemux . no opus ................................. no ffmpeg ............................... no libvpx ............................... no snappy ............................... no glib ................................. yes zlib ................................. yes minizip .............................. no libevent ............................. no jsoncpp .............................. no protobuf ............................. no libxml2 and libxslt .................. no lcms2 ................................ no png .................................. yes JPEG ................................. no harfbuzz ............................. no freetype ............................. yes x11 .................................. no Required system libraries: fontconfig ........................... no dbus ................................. yes nss .................................. no khr .................................. yes glibc ................................ yes Required system libraries for qpa-xcb: libdrm ............................... no xcomposite ........................... no xcursor .............................. no xi ................................... no xtst ................................. no Qt WebEngineQml: UI Delegates ........................... yes Test Support ........................... no Note: Also available for Linux: linux-clang linux-icc Note: No wayland-egl support detected. Cross-toolkit compatibility disabled. WARNING: QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation. Either ensure that llvm-config is in your PATH environment variable, or set LLVM_INSTALL_DIR to the location of your llvm installation. On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution. On macOS, you can use Homebrew's llvm package. On Windows, you must set LLVM_INSTALL_DIR to the installation path. WARNING: Thumb instruction set is required to build ffmpeg for QtWebEngine. ERROR: Feature 'opengles2' was enabled, but the pre-condition '(config.win32 && !features.opengl-dynamic) || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)' failed. ERROR: The OpenGL functionality tests failed! You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2], QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform. 

I don't understand why the OpenGL has failed this time. Perhaps I need to install some other libraries? When cross-compiling I always confused if I need to install library for my host on for the target... As side note, it's correct the specified device? I see other people use -device linux-rpi3-vc4-g++.

1 Answer 1

0

First

cd qt5/qtbase/mkspecs/devices cp -r linux-rasp-pi3-g++/ linux-rasp-pi3-brcm-g++/

nano linux-rasp-pi3-brcm-g++/qmake.conf You will need to customize qmake.conf. This file defines some settings for compilation and is a modification of the one provided by Qt. It should look like this:

qmake configuration for the Raspberry Pi 3 using the Broadcom graphics stack

MODIFIED to use the library names that are shipped since 2016

Also setting the linker flags according to the pkg-config files that are shipped with the libraries.

Remove egl.pc and glesv2.pc from /usr/lib/arm-linux-gnueabihf/pkgconfig/ for these to take effect.

The reason for using static values instead of supplying the correct pkg-config files is that configure ignores -pthread from there

Including headers from /opt/vc first, but also from mesa version of EGL and GLES, since the /opt/vc headers are from 2009 and don't work

with qtwebengine.

This way you can make mesa headers available by manually removing directories EGL, GLES and GLES2 from /opt/vc/include before building.

include(../common/linux_device_pre.conf)

Let the linker know about /opt/vc/lib. Required for EGL config.test (at least) because brcmGLESv2 also needs brcmEGL.

QMAKE_RPATHLINKDIR_POST += $$[QT_SYSROOT]/opt/vc/lib VC_LIBRARY_PATH
= $$[QT_SYSROOT]/opt/vc/lib VC_INCLUDE_PATH = $$[QT_SYSROOT]/opt/vc/include MESA_INCLUDE_PATH = $$[QT_SYSROOT]/usr/include QMAKE_LIBDIR_OPENGL_ES2 = $${VC_LIBRARY_PATH} QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2 QMAKE_LIBDIR_OPENVG = $$QMAKE_LIBDIR_OPENGL_ES2 QMAKE_LIBDIR_BCM_HOST = $$VC_LIBRARY_PATH QMAKE_INCDIR_EGL =
$${VC_INCLUDE_PATH}
$${MESA_INCLUDE_PATH}
$${VC_INCLUDE_PATH}/interface/vcos/pthreads
$${VC_INCLUDE_PATH}/interface/vmcs_host/linux QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL} QMAKE_INCDIR_BCM_HOST
= $$VC_INCLUDE_PATH

recreating pkg-config --libs glesv2 QMAKE_LIBS_OPENGL_ES2 = -L$${VC_LIBRARY_PATH} -lbrcmGLESv2 -lbcm_host -lvcos -lvchiq_arm -pthread

recreating pkg-config --libs egl QMAKE_LIBS_EGL = -L$${VC_LIBRARY_PATH} -lbrcmEGL -lbrcmGLESv2 -lbcm_host -lvchostif -lbcm_host -lvcos -lvchiq_arm -pthread

#recreating pkg-config --libs bcm_host QMAKE_LIBS_BCM_HOST = -L$${VC_LIBRARY_PATH} -lbcm_host -lvcos -lvchiq_arm -pthread QMAKE_CFLAGS = -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 QMAKE_CXXFLAGS = $$QMAKE_CFLAGS DISTRO_OPTS += hard-float DISTRO_OPTS += deb-multi-arch EGLFS_DEVICE_INTEGRATION= eglfs_brcm include(../common/linux_arm_device_post.conf) load(qt_config)

fist compile withou qtwebengine and compile eglfs

-device linux-rasp-pi3-brcm-g++ -skip qtwebengine
-opengl es2 -eglfs
-no-pch
-evdev
-qpa eglfs \

After opt/qt5pi/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig/

mv egl.pc egl.pc.mesa mv glesv2.pc glesv2.pc.mesa

Retri and remov -skip qtwebengine \

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.