[Solved] Qt5.2.1 Platform issue on deployment, could not find xcb plugin. Linux



  • So I am trying to deploy my application to a machine have does not have Qt installed. I followed the instructions "X11 Deployment":http://qt-project.org/doc/qt-4.8/deployment-x11.html for shared libs.

    Program works on dev system (Mint) but on a machine without Qt (Ubuntu 12.04) this error occurs:
    @Failed to load platform plugin "xcb". Available platforms are:

    Aborted (core dumped)
    @

    My application folder looks like this (ls -R)
    @libQt5Core.so.5 libQt5Gui.so.5 libQt5Widgets.so.5 mg_linux.sh
    libQt5DBus.so.5 libQt5Svg.so.5 mg_linux platforms

    ./platforms:
    libqxcb.so@

    I have checked the dependencies are installed with ldd on the executable and the libqxcb.so

    I have looked through other solutions, such as
    https://qt-project.org/forums/viewthread/22292/#155301
    From which I thought goblincodings post/blog seemed relevant. For a test I downloaded his "app":http://goblincoding.com/2013/11/07/deploying-qt-5-applications-on-ubuntu-12-04/, ran the scripts for dependancies and still got an error:
    @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.@

    but this time it says xcb is availiable, which makes me think I have two probelms. Do I need to explicitly state the xcb is located in the platforms folder? Or should the release compile flag force this behaviour.

    Thanks


  • Moderators

    Hi,

    As a general rule, you should use the Qt 5 documentation, not the Qt 4 one. In this case though, the Linux deployment page hasn't changed in a long time.

    Did you copy the script in http://qt-project.org/doc/qt-5/linux-deployment.html that sets LD_LIBRARY_PATH? (this variable tells your system where to find the libraries for your app)



  • Yes, I did follow the Qt 5 documentation, I just linked the wrong one here.

    I have copied the script and renamed it. I know LD_LIBRARY_PATH is set correctly as program doesn't complain about missing libraries when run from script (gives xcb error). Running direclty gives an error about a missing lib.


  • Moderators

    [quote]
    @
    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.
    @
    [/quote]I've encountered this unintuitive message before. In my case, Ubuntu found libqxcb.so but failed to load it because one of its dependencies was missing.

    Follow the quick-and-dirty method in this guide to identify the missing dependenc(ies): http://qt-project.org/wiki/Deploy_an_Application_on_Windows It's written for Windows but also works on Linux. Just replace *.dll with *.so


  • Lifetime Qt Champion

    Hi,

    To add to JKSH, you can run ldd on your xcb plugin to see what libraries are linked and you'll also see if something is missing



  • Thanks for your responses. Think I am having some progress, or am doing it totally wrong.

    -So I orignally was using libqxcb.so from ~/Qt/5.2.1/gcc_64/plugins/platforms with no success. I thought perhaps this might be the incorrect library so I ran ldd on the source machine a picked out a version from where it was picking it's libs, /usr/lib/x86_64, this had more dependancies so I included them in the application directory.-
    -Now I get a different error-
    @
    ~Desktop/graph-deploy/./mg_linux: symbol lookup error: ~Desktop/graph-deploy/./mg_linux: undefined symbol: _ZN19QAbstractScrollArea19setSizeAdjustPolicyENS_16SizeAdjustPolicyE
    @
    -running cfilt identfies this as-
    @
    QAbstractScrollArea::setSizeAdjustPolicy(QAbstractScrollArea::SizeAdjustPolicy)
    @
    -Any ideas? Or have I gone the wrong way?-

    -Also I compiled the original on Mint 15 and am trying to get it to run on Ubuntu 12.04. Will this be an issue?-

    -I did notice that running-
    @ldd -d -r@

    -on the original libqxcb I was using returned no missing libraries but many undefined symbol references.-

    EDIT: ignore this rubbish!

    Needed to solve the symbol errors for the file libqxcb.so from /Qt/5.2.1/gcc_64/plugins/platforms



  • Thanks JKSH for putting me on the way to the solution!
    [quote author="JKSH" date="1393037410"]
    Follow the quick-and-dirty method in this guide to identify the missing dependenc(ies): http://qt-project.org/wiki/Deploy_an_Application_on_Windows It's written for Windows but also works on Linux. Just replace *.dll with *.so[/quote]

    Here is a Linux version of the above for those who may have a similar problem.

    Firstly copy the required platform plugin libqxcb.so to a test directory ~/test_libs from /pathToQt/plugins/platforms in my case the pathToQt was ~/Qt/5.2.1/gcc_64/

    Then copy all of the libraries from /pathToQt/lib to ~/test_libs

    Set the LD_LIBRARY_PATH
    @
    LD_LIBRARY_PATH=~/test_libs
    export LD_LIBRARY_PATH
    @

    Then run
    @
    cd ~/test_libs
    ldd -r -d libqxcb.so
    @

    This should have no errors or undefined symbol messages.

    Then you can delete libraries from ~/test_libs whilst rerunning ldd to work out the required libs, or delete all the libraries that ldd does not list from the directory ~/test_libs.

    In my case libqxcb.so required the following libraries
    libicudata.so.51
    libicui18n.so.51
    libicuuc.so.51
    libQt5Core.so.5
    libQt5DBus.so.5
    libQt5Gui.so.5

    So I think my problem was that some incompatible libraries were found on the system so ldd didn't complain about them being missing.


  • Moderators

    I'm glad that you've found a solution! Thank you for sharing your technique too.



  • Hi
    I am using CentOS 6.5 x86_64

    I created a GUI Application executable named "Graphitev1" using Qt5.2.1
    It is a Widget based application.

    Below are dependency for my executable:
    @
    ldd Graphitev1
    linux-vdso.so.1 => (0x00007fff2d5ff000)

        libQt5PrintSupport.so.5 => /home/vedams/Qt5.2.1/5.2.1/gcc_64/lib/libQt5PrintSupport.so.5 (0x00007f4dc6bef000)
    
        libQt5Widgets.so.5 => /home/vedams/Qt5.2.1/5.2.1/gcc_64/lib/libQt5Widgets.so.5 (0x00007f4dc63a8000)
    
        libQt5Gui.so.5 => /home/vedams/Qt5.2.1/5.2.1/gcc_64/lib/libQt5Gui.so.5 (0x00007f4dc5d22000)
    
        libQt5Core.so.5 => /home/vedams/Qt5.2.1/5.2.1/gcc_64/lib/libQt5Core.so.5 (0x00007f4dc5654000)
    
        libGL.so.1 => /usr/lib64/libGL.so.1 (0x0000003195800000)
    
        libpthread.so.0 => /lib64/libpthread.so.0 (0x000000318a800000)
    
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003196400000)
    
        libm.so.6 => /lib64/libm.so.6 (0x000000318b400000)
    
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003195000000)
    
        libc.so.6 => /lib64/libc.so.6 (0x000000318a000000)
    
        libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x000000318c800000)
    
        libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x000000318b800000)
    
        libX11.so.6 => /usr/lib64/libX11.so.6 (0x000000318e000000)
    
        libicui18n.so.51 => /home/vedams/Qt5.2.1/5.2.1/gcc_64/lib/libicui18n.so.51 (0x00007f4dc5226000)
    
        libicuuc.so.51 => /home/vedams/Qt5.2.1/5.2.1/gcc_64/lib/libicuuc.so.51 (0x00007f4dc4ea0000)
    
        libdl.so.2 => /lib64/libdl.so.2 (0x000000318a400000)
    
        libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x000000318cc00000)
    
        librt.so.1 => /lib64/librt.so.1 (0x000000318ac00000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003189c00000)
    
        libglapi.so.0 => /usr/lib64/libglapi.so.0 (0x0000003197000000)
    
        libXext.so.6 => /usr/lib64/libXext.so.6 (0x000000318e800000)
    
        libXdamage.so.1 => /usr/lib64/libXdamage.so.1 (0x0000003191400000)
    
        libXfixes.so.3 => /usr/lib64/libXfixes.so.3 (0x0000003192000000)
    
        libX11-xcb.so.1 => /usr/lib64/libX11-xcb.so.1 (0x000000318f000000)
    
        libxcb-glx.so.0 => /usr/lib64/libxcb-glx.so.0 (0x0000003196c00000)
    
        libxcb-dri2.so.0 => /usr/lib64/libxcb-dri2.so.0 (0x0000003195c00000)
    
        libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x000000318dc00000)
    
        libXxf86vm.so.1 => /usr/lib64/libXxf86vm.so.1 (0x0000003196000000)
    
        libdrm.so.2 => /usr/lib64/libdrm.so.2 (0x0000003196800000)
    
        libselinux.so.1 => /lib64/libselinux.so.1 (0x000000318bc00000)
    
        libicudata.so.51 => /home/vedams/Qt5.2.1/5.2.1/gcc_64
    

    /lib/libicudata.so.51 (0x00007f4dc3752000)

        libXau.so.6 => /usr/lib64/libXau.so.6 (0x000000318d800000)
    

    @

    Now i am copying this executable "Graphitev1" with dependency in another CentOS 6.5 x86_64 machine and below is contents:

    @

    ls -lh
    -rwxrwxr-x. 1 vedams vedams 4.7M May 19 18:11 Graphitev1
    lrwxrwxrwx. 1 vedams vedams 18 May 19 18:19 libicudata.so.51 -> libicudata.so.51.1
    -rwxr-xr-x. 1 vedams vedams 22M May 19 18:11 libicudata.so.51.1
    lrwxrwxrwx. 1 vedams vedams 18 May 19 18:19 libicui18n.so.51 -> libicui18n.so.51.1
    -rwxr-xr-x. 1 vedams vedams 2.6M May 19 18:11 libicui18n.so.51.1
    lrwxrwxrwx. 1 vedams vedams 16 May 19 18:18 libicuuc.so.51 -> libicuuc.so.51.1
    -rwxr-xr-x. 1 vedams vedams 1.8M May 19 18:11 libicuuc.so.51.1
    lrwxrwxrwx. 1 vedams vedams 19 May 19 18:18 libQt5Core.so.5 -> libQt5Core.so.5.2.1
    -rwxr-xr-x. 1 vedams vedams 4.8M May 19 18:11 libQt5Core.so.5.2.1
    lrwxrwxrwx. 1 vedams vedams 19 May 19 18:17 libQt5DBus.so.5 -> libQt5DBus.so.5.2.1
    -rwxr-xr-x. 1 vedams vedams 523K May 19 18:11 libQt5DBus.so.5.2.1
    lrwxrwxrwx. 1 vedams vedams 18 May 19 18:17 libQt5Gui.so.5 -> libQt5Gui.so.5.2.1
    -rwxr-xr-x. 1 vedams vedams 4.6M May 19 18:11 libQt5Gui.so.5.2.1
    lrwxrwxrwx. 1 vedams vedams 27 May 19 18:16 libQt5PrintSupport.so.5 -> libQt5PrintSupport.so.5.2.1
    -rwxr-xr-x. 1 vedams vedams 412K May 19 18:11 libQt5PrintSupport.so.5.2.1
    lrwxrwxrwx. 1 vedams vedams 22 May 19 18:12 libQt5Widgets.so.5 -> libQt5Widgets.so.5.2.1
    -rwxr-xr-x. 1 vedams vedams 6.3M May 19 18:11 libQt5Widgets.so.5.2.1
    -rwxr-xr-x. 1 vedams vedams 1.4M May 19 18:11 libqxcb.so
    @

    now i exported the LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD

    now when i ran the application, i got the error

    @

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

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

    Please tell me in simple manner , how to resolve this error
    I m getting lost in above thread and following other links



  • libqxcb.so needs to reside in a folder called platforms within the application source.

    I found it very annoying when I had this error meassge to solve.



  • Thanks a lot Ajp1989.Its working
    But can yu please explain the reason behind this

    And can yu give the standard procedure to pack applcation to deliver it to client.Currently for testing purpose i hardcoded lot of things.
    By Target Machine and development machines are CentOS-6.5 x86_64
    And i am developing a Desktop Widget based Application



  • Hi, I also had problems before when deploying to Ubuntu machines. I wrote about it in 2 blog posts: "how to deploy":http://www.tripleboot.org/?p=138 (scroll down to Linux GCC...) and "why you need":http://www.tripleboot.org/?p=536 that platforms directory.



  • Thanks,surely i will look into your blog


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.