Qt Application Linux Deployment

  • Hi

    I know that this is an issue with numerous posts related to it. However in none of those posts I could find a proper "best practice" way to deploy an application on Linux.

    I've struggled for many hours with this, up to the point where the last remaining issues are only related to the required dependencies which needs to be distributed with the application.

    This is what I do:

    • Build Qt 4.8.4 on the target 64 bit platforms (I've tried both Fedora 18, CentOs 6.5 and Ubuntu 10.04).
    • Build the application against my custom built Qt version.
    • I then have a script that does the following (based on the "Qt deployment guidelines":http://qt-project.org/doc/qt-4.8/deployment-x11.html):

    It runs ldd on my application as well as all my plugins. The script copies all found dependencies into a /install_version/libs directory.

    It also runs ldd on the required Qt libs in order for all their dependencies to copied to the libs directory as well.

    The script then removes the RPATH from the Qt libs.

    The script creates a launch.sh file for the application which sets the LD_LIBRARY_PATH as described in the "deployment guidelines":http://qt-project.org/doc/qt-4.8/deployment-x11.html in the Qt documentation.

    Finally, the script packages everything using makeself

    When I install my packages on the same machine it works as expected. However when I install the package on a newer version of the OS it does not work. For example, the package I built on Ubuntu 10.04 crashes with seg faults on Ubuntu 12.04. Interestingly enough, I found that if I remove everything from the /libs folder except the Qt libs and my own libs, the install works 100% on Ubuntu 12.04. I assume that this is a fluke because the Qt dependencies which are present on the 12.04 install is binary compatible with that of 10.04. However this package will break as soon as one of the dependencies are not binary compatible any more...

    Thus, my question is this:
    Which dependencies are required in the /libs folder? Or is there a better way to do this (apart from RPM and DEB packages)?

    I checked the Qt Creator installation for example, in there they also have the minimum number of libs in there (they don't distribute libgc for example...)

    Any feedback on this topic would be much appreciated.

  • Hi JP,

    I'm currently battling with the exact same issue, so unfortunately have nothing to offer (but I'd like to see what others are saying).

    I could just have subscribed to this thread, but have to ask, are you a South African? Not many of us around here as far as I know :)

  • Hi

    Yes, I'm from Pretoria. Cool, have checked out your blog in the past, did not realize you're from SA as well.

    Anyway, have you had any luck with this deployment issue?


  • Unfortunately not, been very busy with other things (it's another pet project I'm working on so not a priority). Hopefully someone with more experience will come along soon, but from what I've seen, it seems like this is pretty much what *nix deployment is like: a mission.

  • Hi Jaco,

    I'm still battling and want to ask you if you'd mind terribly sharing your script (the one mentioned in your first post)?

    If you'd prefer not sharing it out in the open, we can make a plan (if you prefer not to, it's also OK, I just thougth I'd ask :) )

    Seems there really isn't an easy way to go around Linux deployments...

  • Hi

    Apologies for my long response time. The script is quite specific and not commented well. I'd be happy to share it offline. Let me know if you still interested.


  • Yes, for sure...any ideas are welcome :)

    PM'ed you my email address.

    Have an excellent weekend!

  • If not solved, Please refer to http://blog.naver.com/hseok74/120193947673 .

  • Moderators

    I haven't had a whole lot of trouble with Linux releases. I use Gentoo for reference but it shouldn't matter.

    Try the following:

    1. Install the package as usual on a target machine where it is not working
    2. Open a bash shell and "export LD_LIBRARY_PATH="/your/path/to/libs"
      That means the path to your install ./libs directory based on what I read above.
    3. run ldd ./yourapp

    Check the output and see which libraries it is trying to use. If you see things like /usr/lib64/xxx that is probably not what you intended since you are trying for a self-contained application with all it's dependencies in the app directory itself.

    I can try to help further if you post the resulting ldd output.

    edit: you can also do the following instead of exporting ld_library_path:

    bash$ LD_LIBRARY_PATH="/your/path/to/libs" ./yourapp

    I think exporting it would be better for testing purposes though not something you would want to do to an end user's system. :)

Log in to reply

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