Qt 5 - Linux app deployment - can you dynamically link dependencies?



  • I have a Linux Qt 5 app I'm trying to deploy on other Linux systems. I'm using VirtualBox machines develop and test. My app runs with the dependencies on the devoper machine, but not on a non-developer test machine. I have a script which loads the dependencies identified by using the ldd command. Are there any dependencies not listed by the ldd command? I'm trying to dynamically link the dependencies. Is that possible? Or do I have to configure and build from the source code with the static option? Any help would be appreciated. Thanks.


  • Moderators

    Yes, dynamic libs should work. In Qt5, you need to copy platform plugin to <biniary dir>/platforms/ in addition to other dependencies.



  • Here's the dependencies I am using:

    linux-gate.so.1
    libQt5Widgets.so.5
    libQt5Gui.so.5
    libQt5Core.so.5
    libstdc++.so.6
    libgcc_s.so.1
    libc.so.6
    libpthread.so.0
    libgobject-2.0.so.0
    libglib-2.0.so.0
    libX11.so.6
    libm.so.6
    libGL.so.1
    libicui18n.so.49
    libicuuc.so.49
    libdl.so.2
    libgthread-2.0.so.0
    librt.so.1
    /lib/ld-linux.so.2
    libffi.so.6
    libpcre.so.3
    libxcb.so.1
    libglapi.so.0
    libXext.so.6
    libXdamage.so.1
    libXfixes.so.3
    libX11-xcb.so.1
    libxcb-glx.so.0
    libXxf86vm.so.1
    libdrm.so.2
    libicudata.so.49
    libXau.so.6
    libXdmcp.so.6

    Here's the script I'm using:

    #!/bin/sh

    if [ getconf LONG_BIT = "64" ]
    then
    LIBS=./data/libs_64
    BIN=./data/bin/Lottery_64
    else
    LIBS=./data/libs_32
    BIN=./data/bin/Lottery_32
    fi

    Run your app

    export LD_LIBRARY_PATH=$LIBS:"$LD_LIBRARY_PATH"
    $BIN $@

    The script works on the developer machine where Qt 5 is installed, but on the test machine where Qt 5 is not installed I click the script, choose run, and nothing happens. Both machines are 32 bit Linux Mint 14 in VirtualBox. The dependencies are contained in libs_32. I have the platforms folder in the Lottery_32 directory. Are there any dependencies I'm missing? I checked them against the ldd command on the app.


  • Moderators

    That is not the usual way of doing things, but it's your choice. I don't see anything missing, but it could be that the libraries depend on other stuff. Build in debug and see if you can attach gdb to the app.



  • What is the usual way of doing it? I'm new to Qt in Linux. I've developed in Windows before. This is my first Linux Qt app.


  • Moderators

    Dependencies are traditionally handled by package managers. That is why you can easily install apps with a simple .deb or .rpm file. All shared libraries are really shared this way, by all applications. Saves space and makes the OS faster.

    You won't find Qt5 in repositories yet, though.


Log in to reply
 

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