Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. This application failed to start because it could not find or load the Qt platform plugin “xcb”

This application failed to start because it could not find or load the Qt platform plugin “xcb”

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 3.3k Views
  • 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.
  • rorocoR Offline
    rorocoR Offline
    roroco
    wrote on last edited by roroco
    #1

    here is my stackoverflow question

    this exist answer can not fix my question

    In qt official example, I use following CMakeLists.txt

    SET(CMAKE_PREFIX_PATH /media/roroco/disk750/Downloads/qtbase)
    set(CMAKE_INCLUDE_CURRENT_DIR ON)
    set(CMAKE_AUTOMOC ON)
    set(CMAKE_AUTORCC ON)
    find_package(Qt5Widgets)
    find_library(xcb NAMES qxcb PATHS /media/roroco/disk750/Downloads/qtbase/plugins/platforms)
    add_executable(systray main.cpp window.cpp systray.qrc)
    target_link_libraries(systray Qt5::Widgets ${xcb})
    

    and I get

    This application failed to start because it could not find or load the Qt platform plugin "xcb".
    

    How to add "xcb" plugin to cmake?

    update

    I'm sure find_library(xcb find the lib "/media/roroco/disk750/Downloads/qtbase/plugins/platforms/libqxcb.so".

    update
    when I add QApplication::addLibraryPath("/media/roroco/disk750/Downloads/qtbase/plugins");
    and run again, I get:

    This application failed to start because it could not find or load the Qt platform plugin "xcb".
    
    Available platform plugins are: linuxfb, minimal, offscreen, xcb.
    
    Reinstalling the application may fix this problem.
    

    update
    I try to add "LD_LIBRARY_PATH" like following in main.cpp, but still get error

        setenv("LD_LIBRARY_PATH", "/media/roroco/disk750/Downloads/qtbase/lib:/media/roroco/disk750/Downloads/qtbase/plugins", 1);
        QApplication::addLibraryPath("/media/roroco/disk750/Downloads/qtbase/plugins");
    
    K 1 Reply Last reply
    0
    • rorocoR roroco

      here is my stackoverflow question

      this exist answer can not fix my question

      In qt official example, I use following CMakeLists.txt

      SET(CMAKE_PREFIX_PATH /media/roroco/disk750/Downloads/qtbase)
      set(CMAKE_INCLUDE_CURRENT_DIR ON)
      set(CMAKE_AUTOMOC ON)
      set(CMAKE_AUTORCC ON)
      find_package(Qt5Widgets)
      find_library(xcb NAMES qxcb PATHS /media/roroco/disk750/Downloads/qtbase/plugins/platforms)
      add_executable(systray main.cpp window.cpp systray.qrc)
      target_link_libraries(systray Qt5::Widgets ${xcb})
      

      and I get

      This application failed to start because it could not find or load the Qt platform plugin "xcb".
      

      How to add "xcb" plugin to cmake?

      update

      I'm sure find_library(xcb find the lib "/media/roroco/disk750/Downloads/qtbase/plugins/platforms/libqxcb.so".

      update
      when I add QApplication::addLibraryPath("/media/roroco/disk750/Downloads/qtbase/plugins");
      and run again, I get:

      This application failed to start because it could not find or load the Qt platform plugin "xcb".
      
      Available platform plugins are: linuxfb, minimal, offscreen, xcb.
      
      Reinstalling the application may fix this problem.
      

      update
      I try to add "LD_LIBRARY_PATH" like following in main.cpp, but still get error

          setenv("LD_LIBRARY_PATH", "/media/roroco/disk750/Downloads/qtbase/lib:/media/roroco/disk750/Downloads/qtbase/plugins", 1);
          QApplication::addLibraryPath("/media/roroco/disk750/Downloads/qtbase/plugins");
      
      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @roroco

      Hi and welcome to devnet

      I suggest that you are posting the complete also here. It is good to have the link to your original post somewhere else. However, your link might after a while no longer helpful to others.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • E Offline
        E Offline
        eureka
        wrote on last edited by
        #3

        I had to troubleshoot this same xcb plugin problem when trying to run a third party app developed in Qt.

        https://forum.qt.io/topic/64383/installed-app-cannot-find-or-load-plugin-xcb

        And there are other threads in this forum if you just search 'xcb' ..

        https://forum.qt.io/topic/64539/qt-5-5-app-deployment-on-ubuntu-14-04/4

        As far as I understand (as a newcomer to Qt) LD_LIBRARY_PATH should just point to lib (not plugins as you have set)

        In command line run .. qmake --version .. to get path to Qt lib.

        When I run echo $LD_LIBRARY_PATH in command line I have
        /opt/qt55/lib:/usr/lib/i386-linux-gnu/:/usr/lib/

        (/opt/qt55 is my custom installation of Qt 5.5.1).

        You can get plugin debug information by running your app in command line

        QT_DEBUG_PLUGINS=1 myappname

        or setting QT_DEBUG_PLUGINS=1 in environment.

        I solved my problem by

        (a) adding a qt.conf file to same location as app binaries (/usr/bin)

        [Paths]
        Prefix= ../../opt/qt55
        Translations=i18n
        Libraries=lib
        Plugins=plugins

        (b) adding Qt paths to ~/.profile

        export PATH="/opt/qt55/bin":$PATH
        export LD_LIBRARY_PATH="/opt/qt55/lib":${LD_LIBRARY_PATH}

        There might be some redundancy in above steps I took by trial and error.

        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