“Failed to load platform plugin ”xcb“ ” while launching qt5 app on linux without qt installed












13















I wrote application for linux which uses Qt5.



But when I am trying to launch it on the linux without Qt SDK installed, the output in console is:



Failed to load platform plugin "xcb". Available platforms are:


How can I fix this? Maybe I need to copy some plugin file? When I use Ubuntu with Qt5 installed, but I rename Qt directory, the same problem occurs. So, it uses some file from qt directory...



I have found file libqxcb.so in the Qt SDK directory, but placing it in /usr/lib does not help.










share|improve this question





























    13















    I wrote application for linux which uses Qt5.



    But when I am trying to launch it on the linux without Qt SDK installed, the output in console is:



    Failed to load platform plugin "xcb". Available platforms are:


    How can I fix this? Maybe I need to copy some plugin file? When I use Ubuntu with Qt5 installed, but I rename Qt directory, the same problem occurs. So, it uses some file from qt directory...



    I have found file libqxcb.so in the Qt SDK directory, but placing it in /usr/lib does not help.










    share|improve this question



























      13












      13








      13


      7






      I wrote application for linux which uses Qt5.



      But when I am trying to launch it on the linux without Qt SDK installed, the output in console is:



      Failed to load platform plugin "xcb". Available platforms are:


      How can I fix this? Maybe I need to copy some plugin file? When I use Ubuntu with Qt5 installed, but I rename Qt directory, the same problem occurs. So, it uses some file from qt directory...



      I have found file libqxcb.so in the Qt SDK directory, but placing it in /usr/lib does not help.










      share|improve this question
















      I wrote application for linux which uses Qt5.



      But when I am trying to launch it on the linux without Qt SDK installed, the output in console is:



      Failed to load platform plugin "xcb". Available platforms are:


      How can I fix this? Maybe I need to copy some plugin file? When I use Ubuntu with Qt5 installed, but I rename Qt directory, the same problem occurs. So, it uses some file from qt directory...



      I have found file libqxcb.so in the Qt SDK directory, but placing it in /usr/lib does not help.







      plugins qt qt5






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 8 '16 at 8:59









      Zanna

      51k13138242




      51k13138242










      asked Jun 14 '13 at 11:56









      locomotionlocomotion

      166114




      166114






















          11 Answers
          11






          active

          oldest

          votes


















          10














          The correct solution is running the following comand onto a terminal:



          sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/ /usr/bin/



          It creates the symbolic link it's missed.






          share|improve this answer



















          • 1





            This solved the problem for me.

            – Pratik Singhal
            Sep 2 '17 at 14:15











          • Why do you link the files in plugins/platforms to /usr/bin? The platforms directory contains shared libraries, /usr/bin is used for binary files. Shouldn't the contents of platforms go into /usr/lib?

            – Nathan Fiscaletti
            Apr 20 '18 at 14:52





















          4














          I had this error message when trying to run "Stellarium".



          With strace I found that the missing file was libxcb-xinerama.so.0.
          I had to reinstall libxcb-xinerama0 to make it work:



          sudo apt-get install --reinstall libxcb-xinerama0





          share|improve this answer
























          • Wow, what a mess of a hunt this was trying various reinstalls. So grateful for this.

            – Hendy
            Sep 20 '18 at 1:01



















          3














          Run ldd on your application executable to see how it resolves library dependencies.



          Also this is a must read to understand what essential libraries are needed in simple case of gui application:



          http://qt-project.org/doc/qt-5/linux-deployment.html






          share|improve this answer































            3














            Try to install libqt5x11extras5 package with command:

            sudo apt-get install libqt5x11extras5



            The name may be different. You can figure it out by searching:

            sudo apt-cache search qt5 | grep 'X11 extras'



            and u get the name of the package as result:




            libqt5x11extras5 - Qt 5 X11 extras







            share|improve this answer































              2














              In my ubuntu
              type:



              sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/ /usr/bin/platforms


              Can work






              share|improve this answer





















              • 1





                This is not a good answer as it stands. Please edit to explain what exactly that command does.

                – Android Dev
                May 14 '16 at 0:23



















              1














              For those who are still stuck after trying every other option out there in the internet, you can look into exact path from which this notorious libqxcb.so is being searched in, for opening/loading by the Qt App(VirtualBox-5.2.8 is the Qt app in my case), using the strace tool. In my case, since I was building VirtualBox-5.2.8 from its source, it was searching for libqxcb.so in the below location :
              "...VirtualBox-5.2.8/out/linux.amd64/release/bin/platforms/"
              and not in the default library paths, Qt installation path, etc. So, none of the ldd checks, and other solutions worked. And also setting QT_DEBUG_PLUGINS=1 didn't produce any extra logs either.



              Running strace on the the VirtualBox binary I built using Clang/LLVM on Ubuntu 17.10 x86_64:



              ...VirtualBox-5.2.8$ strace ./out/linux.amd64/release/bin/VirtualBox

              .
              .
              .
              access(".../VirtualBox-5.2.8/out/linux.amd64/release/bin/platforms/.", F_OK) = -1 ENOENT (No such file or directory)
              write(2, "Qt FATAL: ", 10Qt FATAL: ) = 10
              write(2, "This application failed to start"..., 154This application failed to start because it could not find or load the Qt platform plugin "xcb"
              in "".

              Reinstalling the application may fix this problem.) = 154
              .
              .
              .


              That was my hitting-the-nail-on-its-head moment, and I created the symlink from the installed Qt5.10.1's platforms directory mentioned below :
              "...Qt5.10.1/Tools/QtCreator/lib/Qt/plugins/platforms/" onto the searched path which is "...VirtualBox-5.2.8/out/linux.amd64/release/bin/". Thus, VirtualBox-5.2.8 built from source on Linux(Ubuntu 17.10 x86_64) using Clang/LLVM, finally launched successfully!



              In fact, another interesting thing here is that, I have built VirtualBox-5.2.8 entirely using Clang/Clang++/LLVM on Ubuntu 17.10 x86_64 after substantial effort - for FreeBSD, there's already a port for building VirtualBox using clang but for Linux, it's heavily dependent on GCC as I saw and hence it took a lot of effort to get to this point to be able successfully build VirtualBox-5.2.8 from its source using Clang/Clang++/LLVM on Ubuntu 17.10 x86_64 for target Linux/AMD64(Ubuntu 17.10 x86_64) and successfully launch it after resolving other issues along with this notorious libqxcb.so one.



              Cheers.






              share|improve this answer

































                1














                Running this solved it to me:



                sudo apt-get --reinstall install libqt5dbus5 
                libqt5widgets5 libqt5network5 libqt5gui5 libqt5core5a
                libdouble-conversion1 libxcb-xinerama0





                share|improve this answer

































                  0














                  This is how solve few issues when I am running emulator on Ubuntu 18.04.



                  $ vim ~/.bashrc


                  Add the following lines at the end of file. I install my Android SDK at /opt/Android/Sdk



                  export ANDROID_HOME=/opt/Android/Sdk
                  export ANDROID_SDK_ROOT=/opt/Android/Sdk
                  export ANDROID_AVD_HOME=/home/<your name>/.android/avd
                  export LD_LIBRARY_PATH="/opt/Android/Sdk/emulator/lib64:$LD_LIBRARY_PATH"
                  export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins





                  share|improve this answer

































                    0














                    To any future readers who come across this - before you start (dangerously) messing around with symlinks to shared libraries, I strongly suggest that you run



                    export QT_DEBUG_PLUGINS=1



                    and then run your failing executable again in the Terminal. Read the actual error message thrown by QT, since none of the above solutions addressed the cause of this error in my case.



                    My output after turning on QT_DEBUG_PLUGINS was:



                    QFactoryLoader::QFactoryLoader() checking directory path "/opt/PostgreSQL/9.6/pgAdmin 4/bin/platforms" ...
                    loaded library "/opt/PostgreSQL/9.6/pgAdmin 4/plugins/platforms/libqxcb.so"
                    QLibraryPrivate::loadPlugin failed on "/opt/PostgreSQL/9.6/pgAdmin 4/plugins/platforms/libqxcb.so" : "Cannot load library /opt/PostgreSQL/9.6/pgAdmin 4/plugins/platforms/libqxcb.so: (/opt/PostgreSQL/9.6/lib/libz.so.1: version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16))"
                    This application failed to start because it could not find or load the Qt platform plugin "xcb".

                    Available platform plugins are: xcb.

                    Reinstalling the application may fix this problem.
                    Aborted (core dumped)


                    so I then googled the version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16)) error and found the solution to that, which solved the problem.






                    share|improve this answer































                      0














                      It seems there can be various different things missing behind this.
                      In my case (Debian 9.7), QT_DEBUG_PLUGINS=1 did help to trace back the missing libraries, and



                      $ sudo apt-get install libxcb-render-util0 libxcb-image0 libxcb-keysyms1 libxcb-icccm4



                      solved the problem.






                      share|improve this answer































                        -3














                        Copy plugins/platforms/libqxcb.so from your qt install to platforms/libqxcb.so in your application directory.






                        share|improve this answer

























                          Your Answer








                          StackExchange.ready(function() {
                          var channelOptions = {
                          tags: "".split(" "),
                          id: "89"
                          };
                          initTagRenderer("".split(" "), "".split(" "), channelOptions);

                          StackExchange.using("externalEditor", function() {
                          // Have to fire editor after snippets, if snippets enabled
                          if (StackExchange.settings.snippets.snippetsEnabled) {
                          StackExchange.using("snippets", function() {
                          createEditor();
                          });
                          }
                          else {
                          createEditor();
                          }
                          });

                          function createEditor() {
                          StackExchange.prepareEditor({
                          heartbeatType: 'answer',
                          autoActivateHeartbeat: false,
                          convertImagesToLinks: true,
                          noModals: true,
                          showLowRepImageUploadWarning: true,
                          reputationToPostImages: 10,
                          bindNavPrevention: true,
                          postfix: "",
                          imageUploader: {
                          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                          allowUrls: true
                          },
                          onDemand: true,
                          discardSelector: ".discard-answer"
                          ,immediatelyShowMarkdownHelp:true
                          });


                          }
                          });














                          draft saved

                          draft discarded


















                          StackExchange.ready(
                          function () {
                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f308128%2ffailed-to-load-platform-plugin-xcb-while-launching-qt5-app-on-linux-without%23new-answer', 'question_page');
                          }
                          );

                          Post as a guest















                          Required, but never shown

























                          11 Answers
                          11






                          active

                          oldest

                          votes








                          11 Answers
                          11






                          active

                          oldest

                          votes









                          active

                          oldest

                          votes






                          active

                          oldest

                          votes









                          10














                          The correct solution is running the following comand onto a terminal:



                          sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/ /usr/bin/



                          It creates the symbolic link it's missed.






                          share|improve this answer



















                          • 1





                            This solved the problem for me.

                            – Pratik Singhal
                            Sep 2 '17 at 14:15











                          • Why do you link the files in plugins/platforms to /usr/bin? The platforms directory contains shared libraries, /usr/bin is used for binary files. Shouldn't the contents of platforms go into /usr/lib?

                            – Nathan Fiscaletti
                            Apr 20 '18 at 14:52


















                          10














                          The correct solution is running the following comand onto a terminal:



                          sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/ /usr/bin/



                          It creates the symbolic link it's missed.






                          share|improve this answer



















                          • 1





                            This solved the problem for me.

                            – Pratik Singhal
                            Sep 2 '17 at 14:15











                          • Why do you link the files in plugins/platforms to /usr/bin? The platforms directory contains shared libraries, /usr/bin is used for binary files. Shouldn't the contents of platforms go into /usr/lib?

                            – Nathan Fiscaletti
                            Apr 20 '18 at 14:52
















                          10












                          10








                          10







                          The correct solution is running the following comand onto a terminal:



                          sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/ /usr/bin/



                          It creates the symbolic link it's missed.






                          share|improve this answer













                          The correct solution is running the following comand onto a terminal:



                          sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/ /usr/bin/



                          It creates the symbolic link it's missed.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Oct 19 '16 at 18:59









                          FrancescoFrancesco

                          20125




                          20125








                          • 1





                            This solved the problem for me.

                            – Pratik Singhal
                            Sep 2 '17 at 14:15











                          • Why do you link the files in plugins/platforms to /usr/bin? The platforms directory contains shared libraries, /usr/bin is used for binary files. Shouldn't the contents of platforms go into /usr/lib?

                            – Nathan Fiscaletti
                            Apr 20 '18 at 14:52
















                          • 1





                            This solved the problem for me.

                            – Pratik Singhal
                            Sep 2 '17 at 14:15











                          • Why do you link the files in plugins/platforms to /usr/bin? The platforms directory contains shared libraries, /usr/bin is used for binary files. Shouldn't the contents of platforms go into /usr/lib?

                            – Nathan Fiscaletti
                            Apr 20 '18 at 14:52










                          1




                          1





                          This solved the problem for me.

                          – Pratik Singhal
                          Sep 2 '17 at 14:15





                          This solved the problem for me.

                          – Pratik Singhal
                          Sep 2 '17 at 14:15













                          Why do you link the files in plugins/platforms to /usr/bin? The platforms directory contains shared libraries, /usr/bin is used for binary files. Shouldn't the contents of platforms go into /usr/lib?

                          – Nathan Fiscaletti
                          Apr 20 '18 at 14:52







                          Why do you link the files in plugins/platforms to /usr/bin? The platforms directory contains shared libraries, /usr/bin is used for binary files. Shouldn't the contents of platforms go into /usr/lib?

                          – Nathan Fiscaletti
                          Apr 20 '18 at 14:52















                          4














                          I had this error message when trying to run "Stellarium".



                          With strace I found that the missing file was libxcb-xinerama.so.0.
                          I had to reinstall libxcb-xinerama0 to make it work:



                          sudo apt-get install --reinstall libxcb-xinerama0





                          share|improve this answer
























                          • Wow, what a mess of a hunt this was trying various reinstalls. So grateful for this.

                            – Hendy
                            Sep 20 '18 at 1:01
















                          4














                          I had this error message when trying to run "Stellarium".



                          With strace I found that the missing file was libxcb-xinerama.so.0.
                          I had to reinstall libxcb-xinerama0 to make it work:



                          sudo apt-get install --reinstall libxcb-xinerama0





                          share|improve this answer
























                          • Wow, what a mess of a hunt this was trying various reinstalls. So grateful for this.

                            – Hendy
                            Sep 20 '18 at 1:01














                          4












                          4








                          4







                          I had this error message when trying to run "Stellarium".



                          With strace I found that the missing file was libxcb-xinerama.so.0.
                          I had to reinstall libxcb-xinerama0 to make it work:



                          sudo apt-get install --reinstall libxcb-xinerama0





                          share|improve this answer













                          I had this error message when trying to run "Stellarium".



                          With strace I found that the missing file was libxcb-xinerama.so.0.
                          I had to reinstall libxcb-xinerama0 to make it work:



                          sudo apt-get install --reinstall libxcb-xinerama0






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Aug 27 '18 at 18:01









                          wmeyerwmeyer

                          1411




                          1411













                          • Wow, what a mess of a hunt this was trying various reinstalls. So grateful for this.

                            – Hendy
                            Sep 20 '18 at 1:01



















                          • Wow, what a mess of a hunt this was trying various reinstalls. So grateful for this.

                            – Hendy
                            Sep 20 '18 at 1:01

















                          Wow, what a mess of a hunt this was trying various reinstalls. So grateful for this.

                          – Hendy
                          Sep 20 '18 at 1:01





                          Wow, what a mess of a hunt this was trying various reinstalls. So grateful for this.

                          – Hendy
                          Sep 20 '18 at 1:01











                          3














                          Run ldd on your application executable to see how it resolves library dependencies.



                          Also this is a must read to understand what essential libraries are needed in simple case of gui application:



                          http://qt-project.org/doc/qt-5/linux-deployment.html






                          share|improve this answer




























                            3














                            Run ldd on your application executable to see how it resolves library dependencies.



                            Also this is a must read to understand what essential libraries are needed in simple case of gui application:



                            http://qt-project.org/doc/qt-5/linux-deployment.html






                            share|improve this answer


























                              3












                              3








                              3







                              Run ldd on your application executable to see how it resolves library dependencies.



                              Also this is a must read to understand what essential libraries are needed in simple case of gui application:



                              http://qt-project.org/doc/qt-5/linux-deployment.html






                              share|improve this answer













                              Run ldd on your application executable to see how it resolves library dependencies.



                              Also this is a must read to understand what essential libraries are needed in simple case of gui application:



                              http://qt-project.org/doc/qt-5/linux-deployment.html







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Sep 10 '14 at 8:33









                              DorianDorian

                              658




                              658























                                  3














                                  Try to install libqt5x11extras5 package with command:

                                  sudo apt-get install libqt5x11extras5



                                  The name may be different. You can figure it out by searching:

                                  sudo apt-cache search qt5 | grep 'X11 extras'



                                  and u get the name of the package as result:




                                  libqt5x11extras5 - Qt 5 X11 extras







                                  share|improve this answer




























                                    3














                                    Try to install libqt5x11extras5 package with command:

                                    sudo apt-get install libqt5x11extras5



                                    The name may be different. You can figure it out by searching:

                                    sudo apt-cache search qt5 | grep 'X11 extras'



                                    and u get the name of the package as result:




                                    libqt5x11extras5 - Qt 5 X11 extras







                                    share|improve this answer


























                                      3












                                      3








                                      3







                                      Try to install libqt5x11extras5 package with command:

                                      sudo apt-get install libqt5x11extras5



                                      The name may be different. You can figure it out by searching:

                                      sudo apt-cache search qt5 | grep 'X11 extras'



                                      and u get the name of the package as result:




                                      libqt5x11extras5 - Qt 5 X11 extras







                                      share|improve this answer













                                      Try to install libqt5x11extras5 package with command:

                                      sudo apt-get install libqt5x11extras5



                                      The name may be different. You can figure it out by searching:

                                      sudo apt-cache search qt5 | grep 'X11 extras'



                                      and u get the name of the package as result:




                                      libqt5x11extras5 - Qt 5 X11 extras








                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Apr 9 '17 at 7:09









                                      Bonus_05Bonus_05

                                      312




                                      312























                                          2














                                          In my ubuntu
                                          type:



                                          sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/ /usr/bin/platforms


                                          Can work






                                          share|improve this answer





















                                          • 1





                                            This is not a good answer as it stands. Please edit to explain what exactly that command does.

                                            – Android Dev
                                            May 14 '16 at 0:23
















                                          2














                                          In my ubuntu
                                          type:



                                          sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/ /usr/bin/platforms


                                          Can work






                                          share|improve this answer





















                                          • 1





                                            This is not a good answer as it stands. Please edit to explain what exactly that command does.

                                            – Android Dev
                                            May 14 '16 at 0:23














                                          2












                                          2








                                          2







                                          In my ubuntu
                                          type:



                                          sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/ /usr/bin/platforms


                                          Can work






                                          share|improve this answer















                                          In my ubuntu
                                          type:



                                          sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/ /usr/bin/platforms


                                          Can work







                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          edited May 11 '16 at 2:59









                                          Videonauth

                                          24.6k1271101




                                          24.6k1271101










                                          answered May 11 '16 at 1:49









                                          李智坚李智坚

                                          211




                                          211








                                          • 1





                                            This is not a good answer as it stands. Please edit to explain what exactly that command does.

                                            – Android Dev
                                            May 14 '16 at 0:23














                                          • 1





                                            This is not a good answer as it stands. Please edit to explain what exactly that command does.

                                            – Android Dev
                                            May 14 '16 at 0:23








                                          1




                                          1





                                          This is not a good answer as it stands. Please edit to explain what exactly that command does.

                                          – Android Dev
                                          May 14 '16 at 0:23





                                          This is not a good answer as it stands. Please edit to explain what exactly that command does.

                                          – Android Dev
                                          May 14 '16 at 0:23











                                          1














                                          For those who are still stuck after trying every other option out there in the internet, you can look into exact path from which this notorious libqxcb.so is being searched in, for opening/loading by the Qt App(VirtualBox-5.2.8 is the Qt app in my case), using the strace tool. In my case, since I was building VirtualBox-5.2.8 from its source, it was searching for libqxcb.so in the below location :
                                          "...VirtualBox-5.2.8/out/linux.amd64/release/bin/platforms/"
                                          and not in the default library paths, Qt installation path, etc. So, none of the ldd checks, and other solutions worked. And also setting QT_DEBUG_PLUGINS=1 didn't produce any extra logs either.



                                          Running strace on the the VirtualBox binary I built using Clang/LLVM on Ubuntu 17.10 x86_64:



                                          ...VirtualBox-5.2.8$ strace ./out/linux.amd64/release/bin/VirtualBox

                                          .
                                          .
                                          .
                                          access(".../VirtualBox-5.2.8/out/linux.amd64/release/bin/platforms/.", F_OK) = -1 ENOENT (No such file or directory)
                                          write(2, "Qt FATAL: ", 10Qt FATAL: ) = 10
                                          write(2, "This application failed to start"..., 154This application failed to start because it could not find or load the Qt platform plugin "xcb"
                                          in "".

                                          Reinstalling the application may fix this problem.) = 154
                                          .
                                          .
                                          .


                                          That was my hitting-the-nail-on-its-head moment, and I created the symlink from the installed Qt5.10.1's platforms directory mentioned below :
                                          "...Qt5.10.1/Tools/QtCreator/lib/Qt/plugins/platforms/" onto the searched path which is "...VirtualBox-5.2.8/out/linux.amd64/release/bin/". Thus, VirtualBox-5.2.8 built from source on Linux(Ubuntu 17.10 x86_64) using Clang/LLVM, finally launched successfully!



                                          In fact, another interesting thing here is that, I have built VirtualBox-5.2.8 entirely using Clang/Clang++/LLVM on Ubuntu 17.10 x86_64 after substantial effort - for FreeBSD, there's already a port for building VirtualBox using clang but for Linux, it's heavily dependent on GCC as I saw and hence it took a lot of effort to get to this point to be able successfully build VirtualBox-5.2.8 from its source using Clang/Clang++/LLVM on Ubuntu 17.10 x86_64 for target Linux/AMD64(Ubuntu 17.10 x86_64) and successfully launch it after resolving other issues along with this notorious libqxcb.so one.



                                          Cheers.






                                          share|improve this answer






























                                            1














                                            For those who are still stuck after trying every other option out there in the internet, you can look into exact path from which this notorious libqxcb.so is being searched in, for opening/loading by the Qt App(VirtualBox-5.2.8 is the Qt app in my case), using the strace tool. In my case, since I was building VirtualBox-5.2.8 from its source, it was searching for libqxcb.so in the below location :
                                            "...VirtualBox-5.2.8/out/linux.amd64/release/bin/platforms/"
                                            and not in the default library paths, Qt installation path, etc. So, none of the ldd checks, and other solutions worked. And also setting QT_DEBUG_PLUGINS=1 didn't produce any extra logs either.



                                            Running strace on the the VirtualBox binary I built using Clang/LLVM on Ubuntu 17.10 x86_64:



                                            ...VirtualBox-5.2.8$ strace ./out/linux.amd64/release/bin/VirtualBox

                                            .
                                            .
                                            .
                                            access(".../VirtualBox-5.2.8/out/linux.amd64/release/bin/platforms/.", F_OK) = -1 ENOENT (No such file or directory)
                                            write(2, "Qt FATAL: ", 10Qt FATAL: ) = 10
                                            write(2, "This application failed to start"..., 154This application failed to start because it could not find or load the Qt platform plugin "xcb"
                                            in "".

                                            Reinstalling the application may fix this problem.) = 154
                                            .
                                            .
                                            .


                                            That was my hitting-the-nail-on-its-head moment, and I created the symlink from the installed Qt5.10.1's platforms directory mentioned below :
                                            "...Qt5.10.1/Tools/QtCreator/lib/Qt/plugins/platforms/" onto the searched path which is "...VirtualBox-5.2.8/out/linux.amd64/release/bin/". Thus, VirtualBox-5.2.8 built from source on Linux(Ubuntu 17.10 x86_64) using Clang/LLVM, finally launched successfully!



                                            In fact, another interesting thing here is that, I have built VirtualBox-5.2.8 entirely using Clang/Clang++/LLVM on Ubuntu 17.10 x86_64 after substantial effort - for FreeBSD, there's already a port for building VirtualBox using clang but for Linux, it's heavily dependent on GCC as I saw and hence it took a lot of effort to get to this point to be able successfully build VirtualBox-5.2.8 from its source using Clang/Clang++/LLVM on Ubuntu 17.10 x86_64 for target Linux/AMD64(Ubuntu 17.10 x86_64) and successfully launch it after resolving other issues along with this notorious libqxcb.so one.



                                            Cheers.






                                            share|improve this answer




























                                              1












                                              1








                                              1







                                              For those who are still stuck after trying every other option out there in the internet, you can look into exact path from which this notorious libqxcb.so is being searched in, for opening/loading by the Qt App(VirtualBox-5.2.8 is the Qt app in my case), using the strace tool. In my case, since I was building VirtualBox-5.2.8 from its source, it was searching for libqxcb.so in the below location :
                                              "...VirtualBox-5.2.8/out/linux.amd64/release/bin/platforms/"
                                              and not in the default library paths, Qt installation path, etc. So, none of the ldd checks, and other solutions worked. And also setting QT_DEBUG_PLUGINS=1 didn't produce any extra logs either.



                                              Running strace on the the VirtualBox binary I built using Clang/LLVM on Ubuntu 17.10 x86_64:



                                              ...VirtualBox-5.2.8$ strace ./out/linux.amd64/release/bin/VirtualBox

                                              .
                                              .
                                              .
                                              access(".../VirtualBox-5.2.8/out/linux.amd64/release/bin/platforms/.", F_OK) = -1 ENOENT (No such file or directory)
                                              write(2, "Qt FATAL: ", 10Qt FATAL: ) = 10
                                              write(2, "This application failed to start"..., 154This application failed to start because it could not find or load the Qt platform plugin "xcb"
                                              in "".

                                              Reinstalling the application may fix this problem.) = 154
                                              .
                                              .
                                              .


                                              That was my hitting-the-nail-on-its-head moment, and I created the symlink from the installed Qt5.10.1's platforms directory mentioned below :
                                              "...Qt5.10.1/Tools/QtCreator/lib/Qt/plugins/platforms/" onto the searched path which is "...VirtualBox-5.2.8/out/linux.amd64/release/bin/". Thus, VirtualBox-5.2.8 built from source on Linux(Ubuntu 17.10 x86_64) using Clang/LLVM, finally launched successfully!



                                              In fact, another interesting thing here is that, I have built VirtualBox-5.2.8 entirely using Clang/Clang++/LLVM on Ubuntu 17.10 x86_64 after substantial effort - for FreeBSD, there's already a port for building VirtualBox using clang but for Linux, it's heavily dependent on GCC as I saw and hence it took a lot of effort to get to this point to be able successfully build VirtualBox-5.2.8 from its source using Clang/Clang++/LLVM on Ubuntu 17.10 x86_64 for target Linux/AMD64(Ubuntu 17.10 x86_64) and successfully launch it after resolving other issues along with this notorious libqxcb.so one.



                                              Cheers.






                                              share|improve this answer















                                              For those who are still stuck after trying every other option out there in the internet, you can look into exact path from which this notorious libqxcb.so is being searched in, for opening/loading by the Qt App(VirtualBox-5.2.8 is the Qt app in my case), using the strace tool. In my case, since I was building VirtualBox-5.2.8 from its source, it was searching for libqxcb.so in the below location :
                                              "...VirtualBox-5.2.8/out/linux.amd64/release/bin/platforms/"
                                              and not in the default library paths, Qt installation path, etc. So, none of the ldd checks, and other solutions worked. And also setting QT_DEBUG_PLUGINS=1 didn't produce any extra logs either.



                                              Running strace on the the VirtualBox binary I built using Clang/LLVM on Ubuntu 17.10 x86_64:



                                              ...VirtualBox-5.2.8$ strace ./out/linux.amd64/release/bin/VirtualBox

                                              .
                                              .
                                              .
                                              access(".../VirtualBox-5.2.8/out/linux.amd64/release/bin/platforms/.", F_OK) = -1 ENOENT (No such file or directory)
                                              write(2, "Qt FATAL: ", 10Qt FATAL: ) = 10
                                              write(2, "This application failed to start"..., 154This application failed to start because it could not find or load the Qt platform plugin "xcb"
                                              in "".

                                              Reinstalling the application may fix this problem.) = 154
                                              .
                                              .
                                              .


                                              That was my hitting-the-nail-on-its-head moment, and I created the symlink from the installed Qt5.10.1's platforms directory mentioned below :
                                              "...Qt5.10.1/Tools/QtCreator/lib/Qt/plugins/platforms/" onto the searched path which is "...VirtualBox-5.2.8/out/linux.amd64/release/bin/". Thus, VirtualBox-5.2.8 built from source on Linux(Ubuntu 17.10 x86_64) using Clang/LLVM, finally launched successfully!



                                              In fact, another interesting thing here is that, I have built VirtualBox-5.2.8 entirely using Clang/Clang++/LLVM on Ubuntu 17.10 x86_64 after substantial effort - for FreeBSD, there's already a port for building VirtualBox using clang but for Linux, it's heavily dependent on GCC as I saw and hence it took a lot of effort to get to this point to be able successfully build VirtualBox-5.2.8 from its source using Clang/Clang++/LLVM on Ubuntu 17.10 x86_64 for target Linux/AMD64(Ubuntu 17.10 x86_64) and successfully launch it after resolving other issues along with this notorious libqxcb.so one.



                                              Cheers.







                                              share|improve this answer














                                              share|improve this answer



                                              share|improve this answer








                                              edited Mar 21 '18 at 15:06

























                                              answered Mar 21 '18 at 14:21







                                              user194850






























                                                  1














                                                  Running this solved it to me:



                                                  sudo apt-get --reinstall install libqt5dbus5 
                                                  libqt5widgets5 libqt5network5 libqt5gui5 libqt5core5a
                                                  libdouble-conversion1 libxcb-xinerama0





                                                  share|improve this answer






























                                                    1














                                                    Running this solved it to me:



                                                    sudo apt-get --reinstall install libqt5dbus5 
                                                    libqt5widgets5 libqt5network5 libqt5gui5 libqt5core5a
                                                    libdouble-conversion1 libxcb-xinerama0





                                                    share|improve this answer




























                                                      1












                                                      1








                                                      1







                                                      Running this solved it to me:



                                                      sudo apt-get --reinstall install libqt5dbus5 
                                                      libqt5widgets5 libqt5network5 libqt5gui5 libqt5core5a
                                                      libdouble-conversion1 libxcb-xinerama0





                                                      share|improve this answer















                                                      Running this solved it to me:



                                                      sudo apt-get --reinstall install libqt5dbus5 
                                                      libqt5widgets5 libqt5network5 libqt5gui5 libqt5core5a
                                                      libdouble-conversion1 libxcb-xinerama0






                                                      share|improve this answer














                                                      share|improve this answer



                                                      share|improve this answer








                                                      edited Nov 9 '18 at 8:29









                                                      N0rbert

                                                      24.2k850113




                                                      24.2k850113










                                                      answered Nov 8 '18 at 23:47









                                                      FerranBFerranB

                                                      1112




                                                      1112























                                                          0














                                                          This is how solve few issues when I am running emulator on Ubuntu 18.04.



                                                          $ vim ~/.bashrc


                                                          Add the following lines at the end of file. I install my Android SDK at /opt/Android/Sdk



                                                          export ANDROID_HOME=/opt/Android/Sdk
                                                          export ANDROID_SDK_ROOT=/opt/Android/Sdk
                                                          export ANDROID_AVD_HOME=/home/<your name>/.android/avd
                                                          export LD_LIBRARY_PATH="/opt/Android/Sdk/emulator/lib64:$LD_LIBRARY_PATH"
                                                          export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins





                                                          share|improve this answer






























                                                            0














                                                            This is how solve few issues when I am running emulator on Ubuntu 18.04.



                                                            $ vim ~/.bashrc


                                                            Add the following lines at the end of file. I install my Android SDK at /opt/Android/Sdk



                                                            export ANDROID_HOME=/opt/Android/Sdk
                                                            export ANDROID_SDK_ROOT=/opt/Android/Sdk
                                                            export ANDROID_AVD_HOME=/home/<your name>/.android/avd
                                                            export LD_LIBRARY_PATH="/opt/Android/Sdk/emulator/lib64:$LD_LIBRARY_PATH"
                                                            export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins





                                                            share|improve this answer




























                                                              0












                                                              0








                                                              0







                                                              This is how solve few issues when I am running emulator on Ubuntu 18.04.



                                                              $ vim ~/.bashrc


                                                              Add the following lines at the end of file. I install my Android SDK at /opt/Android/Sdk



                                                              export ANDROID_HOME=/opt/Android/Sdk
                                                              export ANDROID_SDK_ROOT=/opt/Android/Sdk
                                                              export ANDROID_AVD_HOME=/home/<your name>/.android/avd
                                                              export LD_LIBRARY_PATH="/opt/Android/Sdk/emulator/lib64:$LD_LIBRARY_PATH"
                                                              export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins





                                                              share|improve this answer















                                                              This is how solve few issues when I am running emulator on Ubuntu 18.04.



                                                              $ vim ~/.bashrc


                                                              Add the following lines at the end of file. I install my Android SDK at /opt/Android/Sdk



                                                              export ANDROID_HOME=/opt/Android/Sdk
                                                              export ANDROID_SDK_ROOT=/opt/Android/Sdk
                                                              export ANDROID_AVD_HOME=/home/<your name>/.android/avd
                                                              export LD_LIBRARY_PATH="/opt/Android/Sdk/emulator/lib64:$LD_LIBRARY_PATH"
                                                              export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins






                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited Apr 11 '18 at 3:20









                                                              karel

                                                              60.2k13130154




                                                              60.2k13130154










                                                              answered Apr 10 '18 at 22:46









                                                              MZengMZeng

                                                              1




                                                              1























                                                                  0














                                                                  To any future readers who come across this - before you start (dangerously) messing around with symlinks to shared libraries, I strongly suggest that you run



                                                                  export QT_DEBUG_PLUGINS=1



                                                                  and then run your failing executable again in the Terminal. Read the actual error message thrown by QT, since none of the above solutions addressed the cause of this error in my case.



                                                                  My output after turning on QT_DEBUG_PLUGINS was:



                                                                  QFactoryLoader::QFactoryLoader() checking directory path "/opt/PostgreSQL/9.6/pgAdmin 4/bin/platforms" ...
                                                                  loaded library "/opt/PostgreSQL/9.6/pgAdmin 4/plugins/platforms/libqxcb.so"
                                                                  QLibraryPrivate::loadPlugin failed on "/opt/PostgreSQL/9.6/pgAdmin 4/plugins/platforms/libqxcb.so" : "Cannot load library /opt/PostgreSQL/9.6/pgAdmin 4/plugins/platforms/libqxcb.so: (/opt/PostgreSQL/9.6/lib/libz.so.1: version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16))"
                                                                  This application failed to start because it could not find or load the Qt platform plugin "xcb".

                                                                  Available platform plugins are: xcb.

                                                                  Reinstalling the application may fix this problem.
                                                                  Aborted (core dumped)


                                                                  so I then googled the version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16)) error and found the solution to that, which solved the problem.






                                                                  share|improve this answer




























                                                                    0














                                                                    To any future readers who come across this - before you start (dangerously) messing around with symlinks to shared libraries, I strongly suggest that you run



                                                                    export QT_DEBUG_PLUGINS=1



                                                                    and then run your failing executable again in the Terminal. Read the actual error message thrown by QT, since none of the above solutions addressed the cause of this error in my case.



                                                                    My output after turning on QT_DEBUG_PLUGINS was:



                                                                    QFactoryLoader::QFactoryLoader() checking directory path "/opt/PostgreSQL/9.6/pgAdmin 4/bin/platforms" ...
                                                                    loaded library "/opt/PostgreSQL/9.6/pgAdmin 4/plugins/platforms/libqxcb.so"
                                                                    QLibraryPrivate::loadPlugin failed on "/opt/PostgreSQL/9.6/pgAdmin 4/plugins/platforms/libqxcb.so" : "Cannot load library /opt/PostgreSQL/9.6/pgAdmin 4/plugins/platforms/libqxcb.so: (/opt/PostgreSQL/9.6/lib/libz.so.1: version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16))"
                                                                    This application failed to start because it could not find or load the Qt platform plugin "xcb".

                                                                    Available platform plugins are: xcb.

                                                                    Reinstalling the application may fix this problem.
                                                                    Aborted (core dumped)


                                                                    so I then googled the version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16)) error and found the solution to that, which solved the problem.






                                                                    share|improve this answer


























                                                                      0












                                                                      0








                                                                      0







                                                                      To any future readers who come across this - before you start (dangerously) messing around with symlinks to shared libraries, I strongly suggest that you run



                                                                      export QT_DEBUG_PLUGINS=1



                                                                      and then run your failing executable again in the Terminal. Read the actual error message thrown by QT, since none of the above solutions addressed the cause of this error in my case.



                                                                      My output after turning on QT_DEBUG_PLUGINS was:



                                                                      QFactoryLoader::QFactoryLoader() checking directory path "/opt/PostgreSQL/9.6/pgAdmin 4/bin/platforms" ...
                                                                      loaded library "/opt/PostgreSQL/9.6/pgAdmin 4/plugins/platforms/libqxcb.so"
                                                                      QLibraryPrivate::loadPlugin failed on "/opt/PostgreSQL/9.6/pgAdmin 4/plugins/platforms/libqxcb.so" : "Cannot load library /opt/PostgreSQL/9.6/pgAdmin 4/plugins/platforms/libqxcb.so: (/opt/PostgreSQL/9.6/lib/libz.so.1: version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16))"
                                                                      This application failed to start because it could not find or load the Qt platform plugin "xcb".

                                                                      Available platform plugins are: xcb.

                                                                      Reinstalling the application may fix this problem.
                                                                      Aborted (core dumped)


                                                                      so I then googled the version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16)) error and found the solution to that, which solved the problem.






                                                                      share|improve this answer













                                                                      To any future readers who come across this - before you start (dangerously) messing around with symlinks to shared libraries, I strongly suggest that you run



                                                                      export QT_DEBUG_PLUGINS=1



                                                                      and then run your failing executable again in the Terminal. Read the actual error message thrown by QT, since none of the above solutions addressed the cause of this error in my case.



                                                                      My output after turning on QT_DEBUG_PLUGINS was:



                                                                      QFactoryLoader::QFactoryLoader() checking directory path "/opt/PostgreSQL/9.6/pgAdmin 4/bin/platforms" ...
                                                                      loaded library "/opt/PostgreSQL/9.6/pgAdmin 4/plugins/platforms/libqxcb.so"
                                                                      QLibraryPrivate::loadPlugin failed on "/opt/PostgreSQL/9.6/pgAdmin 4/plugins/platforms/libqxcb.so" : "Cannot load library /opt/PostgreSQL/9.6/pgAdmin 4/plugins/platforms/libqxcb.so: (/opt/PostgreSQL/9.6/lib/libz.so.1: version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16))"
                                                                      This application failed to start because it could not find or load the Qt platform plugin "xcb".

                                                                      Available platform plugins are: xcb.

                                                                      Reinstalling the application may fix this problem.
                                                                      Aborted (core dumped)


                                                                      so I then googled the version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16)) error and found the solution to that, which solved the problem.







                                                                      share|improve this answer












                                                                      share|improve this answer



                                                                      share|improve this answer










                                                                      answered Jul 13 '18 at 3:54









                                                                      SlugFriscoSlugFrisco

                                                                      315




                                                                      315























                                                                          0














                                                                          It seems there can be various different things missing behind this.
                                                                          In my case (Debian 9.7), QT_DEBUG_PLUGINS=1 did help to trace back the missing libraries, and



                                                                          $ sudo apt-get install libxcb-render-util0 libxcb-image0 libxcb-keysyms1 libxcb-icccm4



                                                                          solved the problem.






                                                                          share|improve this answer




























                                                                            0














                                                                            It seems there can be various different things missing behind this.
                                                                            In my case (Debian 9.7), QT_DEBUG_PLUGINS=1 did help to trace back the missing libraries, and



                                                                            $ sudo apt-get install libxcb-render-util0 libxcb-image0 libxcb-keysyms1 libxcb-icccm4



                                                                            solved the problem.






                                                                            share|improve this answer


























                                                                              0












                                                                              0








                                                                              0







                                                                              It seems there can be various different things missing behind this.
                                                                              In my case (Debian 9.7), QT_DEBUG_PLUGINS=1 did help to trace back the missing libraries, and



                                                                              $ sudo apt-get install libxcb-render-util0 libxcb-image0 libxcb-keysyms1 libxcb-icccm4



                                                                              solved the problem.






                                                                              share|improve this answer













                                                                              It seems there can be various different things missing behind this.
                                                                              In my case (Debian 9.7), QT_DEBUG_PLUGINS=1 did help to trace back the missing libraries, and



                                                                              $ sudo apt-get install libxcb-render-util0 libxcb-image0 libxcb-keysyms1 libxcb-icccm4



                                                                              solved the problem.







                                                                              share|improve this answer












                                                                              share|improve this answer



                                                                              share|improve this answer










                                                                              answered Feb 1 at 15:15









                                                                              AntosAntos

                                                                              32




                                                                              32























                                                                                  -3














                                                                                  Copy plugins/platforms/libqxcb.so from your qt install to platforms/libqxcb.so in your application directory.






                                                                                  share|improve this answer






























                                                                                    -3














                                                                                    Copy plugins/platforms/libqxcb.so from your qt install to platforms/libqxcb.so in your application directory.






                                                                                    share|improve this answer




























                                                                                      -3












                                                                                      -3








                                                                                      -3







                                                                                      Copy plugins/platforms/libqxcb.so from your qt install to platforms/libqxcb.so in your application directory.






                                                                                      share|improve this answer















                                                                                      Copy plugins/platforms/libqxcb.so from your qt install to platforms/libqxcb.so in your application directory.







                                                                                      share|improve this answer














                                                                                      share|improve this answer



                                                                                      share|improve this answer








                                                                                      edited Oct 3 '13 at 16:31









                                                                                      guntbert

                                                                                      9,331133170




                                                                                      9,331133170










                                                                                      answered Oct 3 '13 at 16:10









                                                                                      AdamAdam

                                                                                      1




                                                                                      1






























                                                                                          draft saved

                                                                                          draft discarded




















































                                                                                          Thanks for contributing an answer to Ask Ubuntu!


                                                                                          • Please be sure to answer the question. Provide details and share your research!

                                                                                          But avoid



                                                                                          • Asking for help, clarification, or responding to other answers.

                                                                                          • Making statements based on opinion; back them up with references or personal experience.


                                                                                          To learn more, see our tips on writing great answers.




                                                                                          draft saved


                                                                                          draft discarded














                                                                                          StackExchange.ready(
                                                                                          function () {
                                                                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f308128%2ffailed-to-load-platform-plugin-xcb-while-launching-qt5-app-on-linux-without%23new-answer', 'question_page');
                                                                                          }
                                                                                          );

                                                                                          Post as a guest















                                                                                          Required, but never shown





















































                                                                                          Required, but never shown














                                                                                          Required, but never shown












                                                                                          Required, but never shown







                                                                                          Required, but never shown

































                                                                                          Required, but never shown














                                                                                          Required, but never shown












                                                                                          Required, but never shown







                                                                                          Required, but never shown







                                                                                          Popular posts from this blog

                                                                                          Human spaceflight

                                                                                          Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

                                                                                          File:DeusFollowingSea.jpg