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. Error running statically-linked application... Could not find the Qt platform plugin "xcb"
Forum Updated to NodeBB v4.3 + New Features

Error running statically-linked application... Could not find the Qt platform plugin "xcb"

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 3 Posters 3.3k Views 3 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.
  • D Offline
    D Offline
    Daniel Williams
    wrote on last edited by Daniel Williams
    #1

    I've read a bunch of posts on this subject, but I'm not sure, yet, what the solution is.

    I have a subdirs project name, InPlantScanner, that I created with a standard install of Qt on Ubuntu 16.04 lts. It runs fine when I run it from Qt creator and the command line. Now I need to get it ready for deployment to the destination computer. I don't want to install Qt on the computer (though I could) to keep the maintenance more simple. When I update the application, it updates everything needed.

    So, I'm following the instructions at: https://doc.qt.io/qt-5/linux-deployment.html for x11 deployment. I had some challenges and received help in the forums getting the statically-linked Qt setup (https://forum.qt.io/topic/104112/clarification-of-path-to-qt-in-qt-documentation/2)

    Now, I have built my application with the 5.12.4, statically-linked Qt. When I run my application (./IPSgui), I get some errors:

    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 ""
    

    From some of the posts I read, I thought I should re-compile the Qt-5124 with the -qt-xcb option, but that didn't work.

    $ ../Qt/5.12.4/Src/configure -static -prefix ~/qt-5124 -qt-xcb
    
    ERROR: Feature 'xcb' was enabled, but the pre-condition 'features.thread && features.xkbcommon && libs.xcb' failed.
    

    I could keep adding dependencies to the compilation, but I'm not sure what to specify to include features.thread and features.xkbcommon.

    I have 2 questions:

    1. Will continuting to add the dependencies like I started with -qt-xcb work eventually?
    2. Is there a better path?
    Pablo J. RoginaP 1 Reply Last reply
    0
    • D Daniel Williams

      I've read a bunch of posts on this subject, but I'm not sure, yet, what the solution is.

      I have a subdirs project name, InPlantScanner, that I created with a standard install of Qt on Ubuntu 16.04 lts. It runs fine when I run it from Qt creator and the command line. Now I need to get it ready for deployment to the destination computer. I don't want to install Qt on the computer (though I could) to keep the maintenance more simple. When I update the application, it updates everything needed.

      So, I'm following the instructions at: https://doc.qt.io/qt-5/linux-deployment.html for x11 deployment. I had some challenges and received help in the forums getting the statically-linked Qt setup (https://forum.qt.io/topic/104112/clarification-of-path-to-qt-in-qt-documentation/2)

      Now, I have built my application with the 5.12.4, statically-linked Qt. When I run my application (./IPSgui), I get some errors:

      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 ""
      

      From some of the posts I read, I thought I should re-compile the Qt-5124 with the -qt-xcb option, but that didn't work.

      $ ../Qt/5.12.4/Src/configure -static -prefix ~/qt-5124 -qt-xcb
      
      ERROR: Feature 'xcb' was enabled, but the pre-condition 'features.thread && features.xkbcommon && libs.xcb' failed.
      

      I could keep adding dependencies to the compilation, but I'm not sure what to specify to include features.thread and features.xkbcommon.

      I have 2 questions:

      1. Will continuting to add the dependencies like I started with -qt-xcb work eventually?
      2. Is there a better path?
      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @Daniel-Williams do you have X11 development libraries and headers installed in the machine where you try to build static Qt?

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      2
      • D Offline
        D Offline
        Daniel Williams
        wrote on last edited by
        #3

        @Pablo-J-Rogina I had run the apt-get install previously to make sure they were installed:

         sudo apt-get install libx11-dev
        Reading package lists... Done
        Building dependency tree       
        Reading state information... Done
        libx11-dev is already the newest version (2:1.6.3-1ubuntu2.1).
        

        They were installed previously. The part of you reply "where you try to build static Qt" is not familiar to me. Do I need to copy them from the base install location somewhere?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          @Daniel-Williams said in Error running statically-linked application... Could not find the Qt platform plugin "xcb":

          features.xkbcommon

          Do you have the xkbcommon development package installed ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          D 2 Replies Last reply
          1
          • SGaistS SGaist

            Hi,

            @Daniel-Williams said in Error running statically-linked application... Could not find the Qt platform plugin "xcb":

            features.xkbcommon

            Do you have the xkbcommon development package installed ?

            D Offline
            D Offline
            Daniel Williams
            wrote on last edited by
            #5

            @SGaist How do I tell if I have xkbcommon installed? I tried sudo apt-get install xkbcommon and received an error "unable to locate packate xkbcommon."

            1 Reply Last reply
            0
            • SGaistS SGaist

              Hi,

              @Daniel-Williams said in Error running statically-linked application... Could not find the Qt platform plugin "xcb":

              features.xkbcommon

              Do you have the xkbcommon development package installed ?

              D Offline
              D Offline
              Daniel Williams
              wrote on last edited by
              #6

              @SGaist I was able to run sudo apt-get install libxkbcommon-dev and it installed the package.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Good, did that solve your build problem ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                D 1 Reply Last reply
                0
                • SGaistS SGaist

                  Good, did that solve your build problem ?

                  D Offline
                  D Offline
                  Daniel Williams
                  wrote on last edited by Daniel Williams
                  #8

                  @SGaist Unfortunately not. I also expanded that with:

                  sudo apt install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev

                  In the ~/qt-5124-build/config.log file, I see some errors, but I'm not sure how to resolve the errors. I tried to attach the file, but I don't have privileges for that.

                  Sample error messages:

                  
                  executing config test c++1z
                  + cd /home/inplant/qt-5124-build/config.tests/c++1z && /home/inplant/qt-5124-build/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += static use_gold_linker warn_off console single_arch" /home/inplant/qt-5124-build/config.tests/c++1z
                  + cd /home/inplant/qt-5124-build/config.tests/c++1z && MAKEFLAGS= /usr/bin/make
                  > g++ -c -pipe -O2 -std=gnu++1z -w -fPIC  -I. -I/home/inplant/Qt/5.12.4/Src/qtbase/mkspecs/linux-g++ -o main.o main.cpp
                  > main.cpp:8:19: fatal error: variant: No such file or directory
                  > compilation terminated.
                  > Makefile:167: recipe for target 'main.o' failed
                  > make: *** [main.o] Error 1
                  
                  Trying source 2 (type inline) of library dbus ...
                  None of [libdbus-1.so libdbus-1.a] found in [] and global paths.
                    => source produced no result.
                  test config.qtbase.libraries.dbus FAILED
                  
                  Trying source 1 (type inline) of library libudev ...
                  None of [libudev.so libudev.a] found in [] and global paths.
                    => source produced no result.
                  test config.qtbase.libraries.libudev FAILED
                  
                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    Daniel Williams
                    wrote on last edited by Daniel Williams
                    #9

                    I thought I'd give some more detail of what I'm doing in case I'm missing a step:

                    Linux ubuntu 4.15.0-52-generic #56~16.04.1-Ubuntu SMP Thu Jun 6 12:03:31 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux running in a VMWare virtual machine on a windows 10 computer.

                    I originally installed Qt open source. It installed a kit (5.12.1 and I later upgraded to 5.12.4).
                    The kit I have is located at ~/Qt/5.12.4.

                    That was all I had while I was developing the subdirs project (InPlantScanner). When I build using that kit, it builds
                    to ~/scannerRD/builds/release/InPlantScanner. Using this application I can run the program just fine. All of
                    the necessary libraries are on the system and the application works great.

                    Now, I'm ready to deploy the appliation to a physical server running the same version of linux. For simplicity,
                    I decided to deploy it as a statically-linked application. I want to be able to take the build directory,
                    copy it to the destination server and have it run.

                    I followed these directions:
                    https://doc.qt.io/qt-5/linux-deployment.html

                    cd ~
                    mkdir qt-5124
                    mkdir qt-5124-build
                    cd ~/qt-5124-build
                    ../Qt/5.12.4/Src/configure -static -prefix ~/qt-5124

                    make -j 4 #make the build
                    make install #install to ~/qt-5124

                    #After several hours, the install was complete.
                    #I opened the subdirs project, InPlantScanner, in Qt creator. I added a new kit with the statically-linked
                    #version of Qt. I set the project to build to ~/scannerRD/builds/staticallylinked/release/InPlantScanner

                    #I re-built the application in Qt creator and it built successfully.

                    cd ~/scannerRD/builds/staticallylinked/release/InPlantScanner/IPSguid
                    ./IPSgui

                    #I then look in the logs and see the error I listed at the beginning of this post.

                    #There are some errors in the config.log file. But, I have no idea how to fix them.
                    #I'm attaching the latest config.log file.

                    #For Example, I see this error on line 175:
                    175 > g++ -c -pipe -O2 -std=gnu++1z -w -fPIC -I. -I/home/inplant/Qt/5.12.4/Src/qtbase/mkspecs/linux-g++ -o main.o main.cpp
                    176 > main.cpp:8:19: fatal error: variant: No such file or directory
                    177 > compilation terminated.
                    178 > Makefile:167: recipe for target 'main.o' failed
                    179 > make: *** [main.o] Error 1
                    180 test config.qtbase.tests.c++1z FAILED

                    #I don't know what main is in relation to the Qt source code. How do I fix that.

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      Daniel Williams
                      wrote on last edited by
                      #10

                      This is what I ultimately had to do to resolve the issue:

                      sudo apt install libxkbcommon-dev
                      sudo apt install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev

                      ../Qt/5.12.4/Src/configure -static -prefix ~/qt-5124 -system-xcb -recheck-all

                      Note:
                      I had a build directory that I used for an interim build location: ~/qt-5124-build. In that directory, there were two very useful file:
                      config.log
                      config.summary

                      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