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

Error running app in Linux (static bulid)



  • Building Qt 5.15.2 on a Linux Mint 20.1 Cinnamin

    Building work (but takes hours...). No errors.

    Clean source install every time I tried, no error at configure, make or make install.

    Compiling/building an app works with static libs, no warnings from linker BUT when trying to run it:

    qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    
    Available platform plugins are: wayland, wayland-xcomposite-glx.
    
    Aborted (core dumped)
    

    No idea what to try, may be missing configure option or something missing from system. Same project (my app, not Qt) work without any problem in non-static (default Linux 5.15.2 installation). Help :-)

    /Martin

    configure is:

    ./configure -static -prefix "/home/jma/Qt/5.15.2/static" -confirm-license -opensource -nomake tests -nomake examples -openssl-linked -dbus -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -qt-sqlite -qt-tiff -qt-webp
    

    config.summary:

    Build type: linux-g++ (x86_64, CPU features: mmx sse sse2)
    Compiler: gcc 9.3.0
    Configuration: sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples enable_new_dtags f16c largefile precompile_header rdrnd rdseed shani x86SimdAlways release c++11 c++14 c++17 c++1z concurrent dbus reduce_exports reduce_relocations static stl
    Build options:
      Mode ................................... release
      Optimize release build for size ........ no
      Building shared libraries .............. no
      Using C standard ....................... C11
      Using C++ standard ..................... C++17
      Using ccache ........................... no
      Using new DTAGS ........................ yes
      Relocatable ............................ no
      Using precompiled headers .............. yes
      Using LTCG ............................. no
      Target compiler supports:
        SSE .................................. SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
        AVX .................................. AVX AVX2
        AVX512 ............................... F ER CD PF DQ BW VL IFMA VBMI
        Other x86 ............................ AES F16C RDRAND SHA
        Intrinsics without -mXXX option ...... yes
      Build parts ............................ libs tools
    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 ...................... no
      Zstandard support ...................... no
    Qt Core:
      DoubleConversion ....................... yes
        Using system DoubleConversion ........ yes
      GLib ................................... yes
      iconv .................................. no
      ICU .................................... yes
      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() ........................... yes
      IPv6 ifname ............................ yes
      libproxy ............................... no
      Linux AF_NETLINK ....................... yes
      OpenSSL ................................ yes
        Qt directly linked to OpenSSL ........ yes
      OpenSSL 1.1 ............................ yes
      DTLS ................................... yes
      OCSP-stapling .......................... yes
      SCTP ................................... no
      Use system proxies ..................... yes
      GSSAPI ................................. no
    Qt Gui:
      Accessibility .......................... yes
      FreeType ............................... yes
        Using system FreeType ................ no
      HarfBuzz ............................... yes
        Using system HarfBuzz ................ yes
      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:
        Desktop OpenGL ....................... yes
        OpenGL ES 2.0 ........................ no
        OpenGL ES 3.0 ........................ no
        OpenGL ES 3.1 ........................ no
        OpenGL ES 3.2 ........................ no
      Vulkan ................................. yes
      Session Management ..................... yes
    Features used by QPA backends:
      evdev .................................. yes
      libinput ............................... yes
      INTEGRITY HID .......................... no
      mtdev .................................. yes
      tslib .................................. no
      xkbcommon .............................. yes
      X11 specific:
        XLib ................................. yes
        XCB Xlib ............................. yes
        EGL on X11 ........................... no
        xkbcommon-x11 ........................ yes
    QPA backends:
      DirectFB ............................... no
      EGLFS .................................. no
      LinuxFB ................................ yes
      VNC .................................... yes
    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 .................................. yes
      OCI (Oracle) ........................... no
      ODBC ................................... yes
      PostgreSQL ............................. yes
      SQLite2 ................................ no
      SQLite ................................. yes
        Using system provided SQLite ......... no
      TDS (Sybase) ........................... yes
    Qt Testlib:
      Tester for item models ................. yes
    Serial Port:
      ntddmodm ............................... no
    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 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:
      Assimp ................................. yes
      System Assimp .......................... no
      Output Qt3D GL traces .................. no
      Use SSE2 instructions .................. yes
      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
      RHI Renderer ........................... no
    Qt 3D GeometryLoaders:
      Autodesk FBX ........................... no
    Qt Wayland Drivers:
      EGL .................................... no
      Raspberry Pi ........................... no
      XComposite EGL ......................... no
      XComposite GLX ......................... yes
      DRM EGL ................................ no
      libhybris EGL .......................... no
      Linux dma-buf server buffer integration . no
      Vulkan-based server buffer integration . no
      Shm emulation server buffer integration . yes
    Qt Wayland Client Shell Integrations:
      xdg-shell .............................. yes
      xdg-shell unstable v5 (deprecated) ..... yes
      xdg-shell unstable v6 .................. yes
      ivi-shell .............................. yes
      wl-shell (deprecated) .................. yes
    Qt Wayland Client ........................ yes
    Qt Wayland Compositor .................... yes
    Qt Wayland Compositor Layer Plugins:
      VSP2 hardware layer integration ........ 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 ............................. yes
        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 ............................. yes
      Resource Policy (libresourceqt5) ....... no
      Windows Audio Services ................. no
      DirectShow ............................. no
      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 ................ no
      WinRT Runner Tool ...................... no
    Qt Tools:
      QDoc ................................... no
    Qt WebEngine Build Tools:
      Use System Ninja ....................... no
      Use System Gn .......................... no
      Jumbo Build Merge Limit ................ 8
      Developer build ........................ no
      Sanitizer .............................. no
      QtWebEngine required system libraries:
        fontconfig ........................... yes
        dbus ................................. yes
        nss .................................. no
        khr .................................. yes
        glibc ................................ yes
      Optional system libraries used:
        re2 .................................. no
        icu .................................. no
        libwebp, libwebpmux and libwebpdemux . no
        opus ................................. no
        ffmpeg ............................... no
        libvpx ............................... no
        snappy ............................... no
        glib ................................. yes
        zlib ................................. no
        minizip .............................. no
        libevent ............................. no
        jsoncpp .............................. no
        protobuf ............................. no
        libxml2 and libxslt .................. no
        lcms2 ................................ no
        png .................................. no
        JPEG ................................. no
        harfbuzz ............................. yes
        freetype ............................. no
    
    Note: Also available for Linux: linux-clang linux-icc
    
    Note: Using static linking will disable the use of dynamically
    loaded plugins. Make sure to import all needed static plugins,
    or compile needed modules into the library.
    
    Note: When linking against OpenSSL, you can override the default
    library names through OPENSSL_LIBS.
    For example:
        OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked
    
    Note: The following modules are not being compiled in this configuration:
        webenginecore
        webengine
        webenginewidgets
        pdf
        pdfwidgets
    
    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: Tool gperf is required to build QtWebEngine.
    
    WARNING: Tool gperf is required to build QtPdf.
    
    WARNING: QtWebEngine will not be built.
    
    WARNING: QtPdf will not be built.
    

  • Lifetime Qt Champion

    Hi,

    Start your application with the QT_DEBUG_PLUGINS environment variable set to 1 to see what is going on with the plugins.



  • With:
    export QT_DEBUG_PLUGINS=1

    Now I get this error:

    QFactoryLoader::QFactoryLoader() ignoring "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3" since plugins are disabled in static builds
    qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    
    Available platform plugins are: wayland, wayland-xcomposite-glx.
    
    Aborted (core dumped)
    

    I'm I missing something in configure?


  • Lifetime Qt Champion

    No, looks good.

    What do you get if your call ldd on your application ?



  • This:
    ```
    linux-vdso.so.1 (0x00007ffe257e6000)
    libXcomposite.so.1 => /lib/x86_64-linux-gnu/libXcomposite.so.1 (0x00007fb1e6a04000)
    libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007fb1e68c7000)
    libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007fb1e6876000)
    libwayland-cursor.so.0 => /lib/x86_64-linux-gnu/libwayland-cursor.so.0 (0x00007fb1e686b000)
    libwayland-client.so.0 => /lib/x86_64-linux-gnu/libwayland-client.so.0 (0x00007fb1e685a000)
    libxkbcommon.so.0 => /lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007fb1e6818000)
    libharfbuzz.so.0 => /lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007fb1e6711000)
    libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007fb1e667e000)
    libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007fb1e63a8000)
    libdouble-conversion.so.3 => /lib/x86_64-linux-gnu/libdouble-conversion.so.3 (0x00007fb1e6392000)
    libicui18n.so.66 => /lib/x86_64-linux-gnu/libicui18n.so.66 (0x00007fb1e6093000)
    libicuuc.so.66 => /lib/x86_64-linux-gnu/libicuuc.so.66 (0x00007fb1e5ead000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb1e5ea5000)
    libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fb1e5d7c000)
    libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007fb1e5cf4000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb1e5cd1000)
    libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fb1e5af0000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb1e59a1000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fb1e5984000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb1e5792000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fb1e7b78000)
    libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fb1e5768000)
    libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007fb1e56b9000)
    libffi.so.7 => /lib/x86_64-linux-gnu/libffi.so.7 (0x00007fb1e56ad000)
    libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fb1e55ee000)
    libgraphite2.so.3 => /lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007fb1e55bf000)
    libicudata.so.66 => /lib/x86_64-linux-gnu/libicudata.so.66 (0x00007fb1e3afe000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fb1e3a8c000)
    libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007fb1e39d4000)
    libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007fb1e39a0000)
    libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007fb1e3998000)
    libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fb1e3990000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fb1e3985000)
    liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fb1e395c000)
    liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007fb1e393b000)
    libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007fb1e381d000)
    libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007fb1e37e3000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fb1e37c7000)
    libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007fb1e37ad000)
    libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fb1e378a000)


  • Lifetime Qt Champion

    Are you running wayland or X11 on your machine ?



  • @SGaist

    $ echo $XDG_SESSION_TYPE
    x11
    


  • Hi, I had same exact issue in Ubuntu 16.04, after successfull static build of Qt 5.15.2 my application built fine but was give the same error when tried to run it. I discovered that I didn't have xcb plugin in my plugin folder. So I reviewed the Qt build process and installed all the libraries listed here and here. I already had most of them, but something was now installed (can't say which one) and probably did the trick. Then these was my steps:

    git clone git://code.qt.io/qt/qt5.git
    cd qt5
    git checkout 5.15.2
    ./init-repository --module-subset=qtbase,qtwebsockets,qtdeclarative
    cd qtwebsockets
    git checkout -b 5.15.2 origin/5.15.2
    cd ..
    ./configure -static -prefix "/home/rocco/static_libraries/qt-5.15.2" -qt-harfbuzz -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -make libs -nomake tools -nomake examples -nomake tests -opensource -confirm-license
    make -j8
    make install


Log in to reply