Dynamically linked Qt app for Linux - what is the criterion of compatibility amonge Linux versions



  • Hi. I went into some problem with deployment of dynamically linked QT program for Linux.
    Giuded by recommemded technic (http://doc.qt.io/qt-5/linux-deployment.html) I've craeted the package with startup script in Kubuntu 14-4.
    It starts with no problems in different installations of ubuntu family linuxes of the same 14 version with no explicitly installed Qt.
    Used to windows I have been hoped for some backward campatibility and try to install my app in Kubuntu 15, but that faild in the starange way.
    It fails throught the script but starts successfully when simply clicking on executable. It turns out that Kubuntu 15 have all nessesary libs preinstalled

    I've sligtly modified the script to investigate the cause of fault :

    • #!/bin/sh
      appname=basename $0 | sed s,\.sh$,,
      dirname=dirname $0
      tmp="${dirname#?}"
      if [ "${dirname%$tmp}" != "/" ]; then
      dirname=$PWD/$dirname
      fi
      LD_LIBRARY_PATH=$dirname
      export LD_LIBRARY_PATH
      ldd $dirname/$appname
      $dirname/$appname "$@" *

    Linux here:

    valera@valera-VirtualBox:~$ uname -a
    Linux valera-VirtualBox 3.19.0-15-generic #15-Ubuntu SMP Thu Apr 16 23:32:01 UTC 2015 i686 athlon i686 GNU/Linux
    valera@valera-VirtualBox:~$

    output:

    *valera@valera-VirtualBox:~/brama_cp_l_1.1.1-2_i386$ ./Brama_L.sh
    linux-gate.so.1 => (0xb76e9000)
    libQt5Widgets.so.5 => /home/valera/brama_cp_l_1.1.1-2_i386/./libQt5Widgets.so.5 (0xb6fa5000)
    libQt5Gui.so.5 => /home/valera/brama_cp_l_1.1.1-2_i386/./libQt5Gui.so.5 (0xb68ed000)
    libQt5Core.so.5 => /home/valera/brama_cp_l_1.1.1-2_i386/./libQt5Core.so.5 (0xb63a4000)
    libstdc++.so.6 => /home/valera/brama_cp_l_1.1.1-2_i386/./libstdc++.so.6 (0xb62bc000)
    libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb6282000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb60c7000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb60a9000)
    libgobject-2.0.so.0 => /home/valera/brama_cp_l_1.1.1-2_i386/./libgobject-2.0.so.0 (0xb6057000)
    libgthread-2.0.so.0 => /home/valera/brama_cp_l_1.1.1-2_i386/./libgthread-2.0.so.0 (0xb6054000)
    librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb604b000)
    libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb5f23000)
    libXext.so.6 => /home/valera/brama_cp_l_1.1.1-2_i386/./libXext.so.6 (0xb5f0f000)
    libX11.so.6 => /home/valera/brama_cp_l_1.1.1-2_i386/./libX11.so.6 (0xb5ddb000)
    libGL.so.1 => /home/valera/brama_cp_l_1.1.1-2_i386/./libGL.so.1 (0xb5d7b000)
    libm.so.6 => /home/valera/brama_cp_l_1.1.1-2_i386/./libm.so.6 (0xb5d35000)
    libicui18n.so.54 => /home/valera/brama_cp_l_1.1.1-2_i386/./libicui18n.so.54 (0xb5abc000)
    libicuuc.so.54 => /home/valera/brama_cp_l_1.1.1-2_i386/./libicuuc.so.54 (0xb5913000)
    libicudata.so.54 => /home/valera/brama_cp_l_1.1.1-2_i386/./libicudata.so.54 (0xb40e8000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb40e3000)
    /lib/ld-linux.so.2 (0xb76ea000)
    libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0xb40d9000)
    libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb4067000)
    libxcb.so.1 => /home/valera/brama_cp_l_1.1.1-2_i386/./libxcb.so.1 (0xb4044000)
    libglapi.so.0 => /home/valera/brama_cp_l_1.1.1-2_i386/./libglapi.so.0 (0xb402c000)
    libXdamage.so.1 => /home/valera/brama_cp_l_1.1.1-2_i386/./libXdamage.so.1 (0xb4028000)
    libXfixes.so.3 => /home/valera/brama_cp_l_1.1.1-2_i386/./libXfixes.so.3 (0xb4022000)
    libX11-xcb.so.1 => /home/valera/brama_cp_l_1.1.1-2_i386/./libX11-xcb.so.1 (0xb401f000)
    libxcb-glx.so.0 => /home/valera/brama_cp_l_1.1.1-2_i386/./libxcb-glx.so.0 (0xb4006000)
    libxcb-dri2.so.0 => /home/valera/brama_cp_l_1.1.1-2_i386/./libxcb-dri2.so.0 (0xb4000000)
    libxcb-dri3.so.0 => /home/valera/brama_cp_l_1.1.1-2_i386/./libxcb-dri3.so.0 (0xb3ffc000)
    libxcb-present.so.0 => /home/valera/brama_cp_l_1.1.1-2_i386/./libxcb-present.so.0 (0xb3ff8000)
    libxcb-sync.so.1 => /home/valera/brama_cp_l_1.1.1-2_i386/./libxcb-sync.so.1 (0xb3ff1000)
    libxshmfence.so.1 => /home/valera/brama_cp_l_1.1.1-2_i386/./libxshmfence.so.1 (0xb3fed000)
    libXxf86vm.so.1 => /home/valera/brama_cp_l_1.1.1-2_i386/./libXxf86vm.so.1 (0xb3fe7000)
    libdrm.so.2 => /home/valera/brama_cp_l_1.1.1-2_i386/./libdrm.so.2 (0xb3fd9000)
    libXau.so.6 => /home/valera/brama_cp_l_1.1.1-2_i386/./libXau.so.6 (0xb3fd5000)
    libXdmcp.so.6 => /home/valera/brama_cp_l_1.1.1-2_i386/./libXdmcp.so.6 (0xb3fcd000)
    Segmentation fault (core dumped) *

    Here is output of ldd for executable itself:

    valera@valera-VirtualBox:~/brama_cp_l_1.1.1-2_i386$ ldd ./Brama_L
    linux-gate.so.1 => (0xb7715000)
    libQt5Widgets.so.5 => /usr/lib/i386-linux-gnu/libQt5Widgets.so.5 (0xb6fa0000)
    libQt5Gui.so.5 => /usr/lib/i386-linux-gnu/sse2/libQt5Gui.so.5 (0xb6a11000)
    libQt5Core.so.5 => /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5 (0xb64d1000)
    libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb63dc000)
    libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb63bf000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb6204000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb61e7000)
    libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 (0xb6189000)
    libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb6061000)
    libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xb5f16000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb5ec9000)
    libpng12.so.0 => /lib/i386-linux-gnu/libpng12.so.0 (0xb5e9d000)
    libharfbuzz.so.0 => /usr/lib/i386-linux-gnu/libharfbuzz.so.0 (0xb5e3e000)
    libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb5e23000)
    libGL.so.1 => /usr/lib/i386-linux-gnu/mesa/libGL.so.1 (0xb5d75000)
    libicui18n.so.52 => /usr/lib/i386-linux-gnu/libicui18n.so.52 (0xb5b55000)
    libicuuc.so.52 => /usr/lib/i386-linux-gnu/libicuuc.so.52 (0xb59d4000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb59ce000)
    librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb59c5000)
    /lib/ld-linux.so.2 (0xb7716000)
    libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0xb59bb000)
    libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb5949000)
    libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb5927000)
    libfreetype.so.6 => /usr/lib/i386-linux-gnu/libfreetype.so.6 (0xb5876000)
    libgraphite2.so.3 => /usr/lib/i386-linux-gnu/libgraphite2.so.3 (0xb5859000)
    libexpat.so.1 => /lib/i386-linux-gnu/libexpat.so.1 (0xb5830000)
    libglapi.so.0 => /usr/lib/i386-linux-gnu/libglapi.so.0 (0xb5817000)
    libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xb5802000)
    libXdamage.so.1 => /usr/lib/i386-linux-gnu/libXdamage.so.1 (0xb57fd000)
    libXfixes.so.3 => /usr/lib/i386-linux-gnu/libXfixes.so.3 (0xb57f6000)
    libX11-xcb.so.1 => /usr/lib/i386-linux-gnu/libX11-xcb.so.1 (0xb57f3000)
    libxcb-glx.so.0 => /usr/lib/i386-linux-gnu/libxcb-glx.so.0 (0xb57db000)
    libxcb-dri2.so.0 => /usr/lib/i386-linux-gnu/libxcb-dri2.so.0 (0xb57d5000)
    libxcb-dri3.so.0 => /usr/lib/i386-linux-gnu/libxcb-dri3.so.0 (0xb57d0000)
    libxcb-present.so.0 => /usr/lib/i386-linux-gnu/libxcb-present.so.0 (0xb57cc000)
    libxcb-sync.so.1 => /usr/lib/i386-linux-gnu/libxcb-sync.so.1 (0xb57c5000)
    libxshmfence.so.1 => /usr/lib/i386-linux-gnu/libxshmfence.so.1 (0xb57c2000)
    libXxf86vm.so.1 => /usr/lib/i386-linux-gnu/libXxf86vm.so.1 (0xb57bc000)
    libdrm.so.2 => /usr/lib/i386-linux-gnu/libdrm.so.2 (0xb57ac000)
    libicudata.so.52 => /usr/lib/i386-linux-gnu/libicudata.so.52 (0xb413f000)
    libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb413b000)
    libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb4134000)

    	**Launching it directly yields  SUCCESS!!!!!!!!!!!!!!!!**
    

    Obviously OS allways engages system dynamic linker ld-linux.so.2 paying no attention for my
    LD_LIBRARY_PATH redirection (probably this directive is for linker itself). It's ok but furthermore -
    the list of library it demands appears slightly different. When I repeat the procedure of package
    library collection in Kubuntu 15 - it works in both cases: with script and directly. It seems like the
    linker treats the needs of my program for libs in ambiguous way, trying to deside itself what the
    app really needs. The question is: In the world where is so many linuxes

    • what is the criterion of compatibility for dinamically linked programs? Is it bound to the Linux distro -
      exactly the same version where it was created? May be it is not strictly about QT, may be even offtopic here,
      but I hope this subject could be interesting for many people. I've made workaround for this issue - modified
      the script to try both way:direct launcing and with changed LD_LIBRARY_PATH, but it's ugly ant not relyable,
      as for me, rather I want to understand this "mechanics". I would be grateful for any useful advice. Links for some
      clear documentation would be the best for me.


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