Moving program to other system



  • Hello,

    I have created simple widget based GUI application in my CentOS 32 bit Linux. Now I'm trying to move binary to another fresh CentOS 32 system that has no QT installed.

    Got error

    :error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
    

    I was trying to fix that by installing qt libs:

    sudo yum install qt-devel
    

    But still got the same error


  • Moderators

    @column Take a look at http://doc.qt.io/qt-5/linux-deployment.html
    You need copy needed Qt libraries together with your app, or if the Linux distribution is exactly the same install needed Qt libraries (you don't need qt-devel if you don't plan to build Qt apps on that machine).



  • @column given the size/complexity of your application, you may want to take a look at linuxdeployqt tool.



  • @jsulm
    In article you provided I found I can link my binary statically. In this case I will not need any libraries at all. It sound good, but I can't find ./configure executable in my system needed in command below:

    cd /path/to/Qt
    ./configure -static -prefix /path/to/Qt <other parameters>
    make
    

  • Moderators

    @column You need Qt source code.
    Keep in mind that compiling Qt isn't an easy task. It is easier to deploy your app together with needed libraries as described in the link.



  • @column another approach could be trial and error, not the most efficient but effective in the end. So far you have this error in the "fresh CentOS 32 system that has no QT installed"

    :error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory

    You need to copy that file libQt5Widgets.so.5 in the same folder of your executable, or in some folder in the library path. And you keep trying, running the executable and if you got an error, copying the referred library file until you got all the required files in your fresh machine



  • @Pablo-J.-Rogina
    I placed libQt5Widgets.so.5 file near executable, but I still have error :

    : error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
    

    I suppose I should somehow set path to library?



  • @column

    I assume "near executable" means in same folder, right?

    One of the things I think i have noticed under Linux is that if you try to load a shared library and that library has other dependent file libraries it requires, then (I think) you tend to get the error message "no such file or directory" on the original library, when in fact it's a dependent library which is missing.

    Run a ldd libQt5Widgets.so.5 on the library. This will list out the dependents it also requires. Are there perchance other files which are missing in that list?


  • Moderators

    @column said in Moving program to other system:

    I placed libQt5Widgets.so.5

    From where did you take it? You should not take it from QtCreator directory, but from the Qt setup you used to build your app.



  • @jsulm
    I found two files of libQt5Widgets.so.5 :

    ./opt/Qt/Tools/QtCreator/lib/qtcreator/libQt5Widgets.so.5
    ./opt/Qt/5.5/gcc/lib/libQt5Widgets.so.5

    I build and run my application from QT Creator. What do you mean "QT setup"?



  • @JonB

    I copyed missing libs:

    -rwxr-xr-x.  1 g g 25336904 Mar  5 08:11 libicudata.so.54
    -rwxr-xr-x.  1 g g  3152461 Mar  5 08:10 libicui18n.so.54
    -rwxr-xr-x.  1 g g  1949914 Mar  5 08:10 libicuuc.so.54
    -rwxr-xr-x.  1 g g  5527300 Mar  5 08:08 libQt5Core.so.5
    -rwxr-xr-x.  1 g g  7011644 Mar  5 08:07 libQt5Gui.so.5
    -rwxr-xr-x.  1 g g  7576944 Mar  5 06:39 libQt5Widgets.so.5
    

    and now ldd looks:

    ldd libQt5Widgets.so.5
    linux-gate.so.1 =>  (0x0029b000)
    libQt5Gui.so.5 => /home/g/rewe/./libQt5Gui.so.5 (0x017c8000)
    libQt5Core.so.5 => /home/g/rewe/./libQt5Core.so.5 (0x0029c000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x0019c000)
    libgobject-2.0.so.0 => /lib/libgobject-2.0.so.0 (0x001b7000)
    libgthread-2.0.so.0 => /lib/libgthread-2.0.so.0 (0x00204000)
    librt.so.1 => /lib/librt.so.1 (0x00209000)
    libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x007e5000)
    libXext.so.6 => /usr/lib/libXext.so.6 (0x00212000)
    libX11.so.6 => /usr/lib/libX11.so.6 (0x048fd000)
    libGL.so.1 => /usr/lib/libGL.so.1 (0x038cd000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x031cc000)
    libm.so.6 => /lib/libm.so.6 (0x00224000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x0024e000)
    libc.so.6 => /lib/libc.so.6 (0x01097000)
    libicui18n.so.54 => /home/g/rewe/./libicui18n.so.54 (0x03d84000)
    libicuuc.so.54 => /home/g/rewe/./libicuuc.so.54 (0x03353000)
    libicudata.so.54 => /home/g/rewe/./libicudata.so.54 (0xb5ee3000)
    libdl.so.2 => /lib/libdl.so.2 (0x0026c000)
    /lib/ld-linux.so.2 (0x0093b000)
    libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00271000)
    libglapi.so.0 => /usr/lib/libglapi.so.0 (0x0122e000)
    libselinux.so.1 => /lib/libselinux.so.1 (0x00902000)
    libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0x00921000)
    libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x00924000)
    libX11-xcb.so.1 => /usr/lib/libX11-xcb.so.1 (0x00299000)
    libxcb-glx.so.0 => /usr/lib/libxcb-glx.so.0 (0x05289000)
    libxcb-dri2.so.0 => /usr/lib/libxcb-dri2.so.0 (0x00929000)
    libXxf86vm.so.1 => /usr/lib/libXxf86vm.so.1 (0x0092e000)
    libdrm.so.2 => /usr/lib/libdrm.so.2 (0x06c17000)
    libexpat.so.1 => /lib/libexpat.so.1 (0x0127b000)
    libXau.so.6 => /usr/lib/libXau.so.6 (0x00933000)
    
    
    

    but still have rror while executing binary :

    error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
    

  • Lifetime Qt Champion

    Hi,

    You also need to alter the LD_LIBRARY_PATH environment variable to make it look in the current folder.

    As @Pablo-J-Rogina already suggested, you should really take a look at the linuxdeployqt project, it provides a really nice tool to deploy Qt applications.


  • Moderators

    @column said in Moving program to other system:

    What do you mean "QT setup"?

    I mean your Qt installation.
    The correct one is ./opt/Qt/5.5/gcc/lib/libQt5Widgets.so.5, not the one from QtCreator.



  • @SGaist
    After setting LD_LIBRARY_PATH I got error after executing binary:

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

    How to fix this problem?


  • Moderators

    @column said in Moving program to other system:

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

    How to fix this problem?

    Add platforms/libqxcb.so to your application directory. The platforms folder must be on the same level as libQt5Core.so.5, and libqxcb.so must be inside platforms.

    Or, use linuxdeployqt, as @Pablo-J-Rogina and @SGaist have suggested to you.


Log in to reply
 

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