Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Build Qt5 on Linux with mingw for Windows with ANGLE support for OpenGL
Forum Updated to NodeBB v4.3 + New Features

Build Qt5 on Linux with mingw for Windows with ANGLE support for OpenGL

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
1 Posts 1 Posters 843 Views 1 Watching
  • 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.
  • C Offline
    C Offline
    cytrinox
    wrote on last edited by
    #1

    Hi all,
    I want to build a Qt QML project on a Ubuntu Docker container for Windows. Basically, it works if the Windows host has OpenGL support. If not (a Win10 in KVM virtualization) the binary starts a window frame and segfaults after few seconds without any information. With WinDbg I see that it crashes somewhere in opengl functions.

    If I change the renderer via:

    QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software);
    

    the build with -opengl desktop runs fine on non-OpenGL Windows (except that some renderings are broken like gradients, ColorOverlay etc.) so I'm pretty sure it is related to OpenGL handling.

    I assume the core of the problem is that I configure Qt with -opengl desktop. So there is no fallback if OpenGL is not supported. So the trick would be to compile Qt with -opengl dynamic and -angle. But for unknown reason, configure fails and I can't figure out what dependencies for mingw I need.

    ./configure -v -prefix /opt/qt5-w64-mingw32 -opensource -confirm-license -release -nomake tests -nomake examples -skip qtwebengine  -qt-zlib -qt-freetype -qt-pcre -qt-harfbuzz -opengl dynamic -platform linux-g++-64 -xplatform win32-g++ -device-option CROSS_COMPILE=/usr/bin/x86_64-w64-mingw32-  -skip qtactiveqt -angle -nomake tools
    

    Output of configure script:

    (see https://paste.debian.net/1228367/  for full test log)
    
    Done running configuration tests.
    
    Configure summary:
    
    Building on: linux-g++-64 (x86_64, CPU features: mmx sse sse2)
    Building for: win32-g++ (x86_64, CPU features: mmx sse sse2)
    Target compiler: gcc 9.3.0
    Configuration: cross_compile sse2 aesni sse3 ssse3 sse4_1 sse4_2 compile_examples largefile precompile_header rdrnd rdseed shani x86SimdAlways shared shared release c++11 c++14 c++17 c++1z concurrent dbus no-pkg-config stl
    Build options:
      Mode ................................... release
      Optimize release build for size ........ no
      Building shared libraries .............. yes
      Using C standard ....................... C11
      Using C++ standard ..................... C++17
      Relocatable ............................ yes
      Using precompiled headers .............. yes
      Using LTCG ............................. no
      Target compiler supports:
        SSE .................................. SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
        AVX .................................. <none>
        AVX512 ............................... <none>
        Other x86 ............................ AES RDRAND SHA
        Intrinsics without -mXXX option ...... yes
      Build parts ............................ libs
      App store compliance ................... no
    Qt modules and options:
      Qt Concurrent .......................... yes
      Qt D-Bus ............................... yes
      Qt D-Bus directly linked to libdbus .... no
      Qt Gui ................................. yes
      Qt Network ............................. yes
      Qt Sql ................................. yes
      Qt Testlib ............................. yes
      Qt Widgets ............................. yes
      Qt Xml ................................. yes
    Support enabled for:
      Using pkg-config ....................... no
      udev ................................... no
      Using system zlib ...................... no
      Zstandard support ...................... no
    Qt Core:
      DoubleConversion ....................... yes
        Using system DoubleConversion ........ no
      GLib ................................... no
      iconv .................................. no
      ICU .................................... no
      Built-in copy of the MIME database ..... yes
      Tracing backend ........................ <none>
      Logging backends:
        journald ............................. no
        syslog ............................... no
        slog2 ................................ no
      PCRE2 .................................. yes
        Using system PCRE2 ................... no
    Qt Network:
      getifaddrs() ........................... no
      IPv6 ifname ............................ no
      libproxy ............................... no
      Schannel ............................... no
      OpenSSL ................................ no
        Qt directly linked to OpenSSL ........ no
      OpenSSL 1.1 ............................ no
      DTLS ................................... no
      OCSP-stapling .......................... no
      SCTP ................................... no
      Use system proxies ..................... yes
      GSSAPI ................................. no
    Qt Gui:
      Accessibility .......................... yes
      FreeType ............................... yes
        Using system FreeType ................ no
      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 ................ no
      Text formats:
        HtmlParser ........................... yes
        CssParser ............................ yes
        OdfWriter ............................ yes
        MarkdownReader ....................... yes
          Using system libmd4c ............... no
        MarkdownWriter ....................... yes
      EGL .................................... no
      OpenVG ................................. no
      OpenGL:
        ANGLE ................................ no
        Desktop OpenGL ....................... no
        Dynamic 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 .................................. no
      libinput ............................... no
      INTEGRITY HID .......................... no
      mtdev .................................. no
      tslib .................................. no
      xkbcommon .............................. no
      X11 specific:
        XLib ................................. no
        XCB Xlib ............................. no
        EGL on X11 ........................... no
        xkbcommon-x11 ........................ no
    QPA backends:
      DirectFB ............................... no
      EGLFS .................................. no
      LinuxFB ................................ no
      VNC .................................... no
      Windows:
        Direct 2D ............................ yes
        DirectWrite .......................... yes
        DirectWrite 2 ........................ yes
    Qt Sql:
      SQL item models ........................ yes
    Qt Widgets:
      GTK+ ................................... no
      Styles ................................. Fusion Windows WindowsVista
    Qt PrintSupport:
      CUPS ................................... no
    Qt Sql Drivers:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. no
      OCI (Oracle) ........................... no
      ODBC ................................... yes
      PostgreSQL ............................. no
      SQLite2 ................................ no
      SQLite ................................. yes
        Using system provided SQLite ......... no
      TDS (Sybase) ........................... no
    Qt Testlib:
      Tester for item models ................. yes
    Serial Port:
      ntddmodm ............................... yes
    Qt SerialBus:
      Socket CAN ............................. no
      Socket CAN FD .......................... no
      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 just-in-time compiler .............. yes
      QML sequence object .................... yes
      QML XML http request ................... yes
      QML Locale ............................. yes
    Qt QML Models:
      QML list model ......................... 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
    QtQuick3D:
      Assimp ................................. yes
      System Assimp .......................... no
    Qt Scxml:
      ECMAScript data model for QtScxml ...... yes
    Qt Gamepad:
      SDL2 ................................... no
    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
      Native Win32 Bluetooth ................. 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 ................................... no
      GStreamer 1.0 .......................... no
      GStreamer 0.10 ......................... no
      Video for Linux ........................ no
      OpenAL ................................. no
      PulseAudio ............................. no
      Resource Policy (libresourceqt5) ....... no
      Windows Audio Services ................. no
      DirectShow ............................. yes
      Windows Media Foundation ............... no
    Qt TextToSpeech:
      Flite .................................. no
      Flite with ALSA ........................ no
      Speech Dispatcher ...................... no
    Qt Tools:
      Qt Assistant ........................... yes
      Qt Designer ............................ yes
      Qt Distance Field Generator ............ yes
      kmap2qmap .............................. yes
      Qt Linguist ............................ yes
      Mac Deployment Tool .................... no
      makeqpf ................................ yes
      pixeltool .............................. yes
      qdbus .................................. yes
      qev .................................... yes
      Qt Attributions Scanner ................ yes
      qtdiag ................................. yes
      qtpaths ................................ yes
      qtplugininfo ........................... yes
      Windows deployment tool ................ yes
      WinRT Runner Tool ...................... no
    Qt Tools:
      QDoc ................................... no
    
    Note: No wayland-egl support detected. Cross-toolkit compatibility disabled.
    
    Note: The following modules are not being compiled in this configuration:
        3dcore
        3drender
    
    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.
    
    ERROR: Feature 'angle' was enabled, but the pre-condition '!features.opengl-desktop && features.dxguid && tests.fxc && (features.direct3d9 || (config.winrt && features.direct3d11 && libs.d3dcompiler))' 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.
    

    My Dockerfile for this build:

    FROM ubuntu:20.04
    
    RUN \
        export DEBIAN_FRONTEND=noninteractive && \
        apt -y update && \
        apt -y upgrade && \
        apt -y install \
            mingw-w64 \
            build-essential cmake freeglut3-dev gdb git iputils-ping libgl1-mesa-dev \
            libglu1-mesa-dev libjpeg-dev libmysqlclient-dev libnss3-dev libopus-dev \
            libpng-dev libsqlite3-dev libssl-dev libx11-xcb-dev libxcb-xinerama0-dev \
            libxcb-xkb-dev libxcb1-dev libxcursor-dev libxi-dev libxml2-dev libxrender-dev \
            libxslt-dev lzip mesa-common-dev nano perl python valgrind wget zlib1g-dev \
            '^libxcb.*-dev' libxkbcommon-dev libxkbcommon-x11-dev && \
        apt -y autoremove && \
        apt -y autoclean && \
        apt -y clean && \
        rm -rf /var/lib/apt/lists/* && \
        update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix && \
        update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix && \
        exit 0
    
    RUN \
        set -eux && \
        cd /opt && \
        wget -q http://download.qt.io/official_releases/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz && \
        tar xf qt-everywhere-src-5.15.2.tar.xz && \
        rm qt-everywhere-src-5.15.2.tar.xz && \
        exit 0
    
    RUN \
        cd /opt/qt-everywhere-src-5.15.2 && \
        ./configure -prefix /opt/qt5-w64-mingw32 -opensource -confirm-license -release \
            -nomake tests -nomake examples -skip qtwebengine  -qt-zlib -qt-freetype \
            -qt-pcre -qt-harfbuzz -opengl dynamic \
            -platform linux-g++-64 -xplatform win32-g++ -device-option CROSS_COMPILE=/usr/bin/x86_64-w64-mingw32- \
            -skip qtactiveqt && \
        make -j $(($(nproc)+4)) && \
        make install && \
        cd /opt && \
        rm -rf qt-everywhere-src-5.15.2 && \
        exit 0
    
    
    ENV PATH="${PATH}:/opt/qt5-w64-mingw32/bin"
    ENTRYPOINT ["/bin/bash"]
    

    Hopefully somone can give me a hint how to solve this.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved