Deploy Qt Application Binary on Linux compatible with LSB

I developed a small application in Qt Creator on Ubuntu 12.04 that I want to run on any other Linux distribution (mostly different versions of CentOS and ubuntu), like any portable windows application.

I want to be able to simply share the application binary and run the application. I can successfully do this on Windows by simply creating a project in QT Creator and then placing the necessary libraries in the application directory and then transferring them to other Windows systems.

I searched everything and found out that I should try to build a project using LSB (Linux Standard Base) compatibility so that it works on other linux distributions. Is this the right way to do this?

I am very new to Qt as well as Linux (I don't know what Shell Scripting is). Thus, I do not know how I should perform compatibility with LSB.

I refer to the following links: Distributing Qt-based binaries on Linux and Deploying Qt applications on Linux , but cannot figure out what I can do.

I also found this question here , which talks about a very similar situation like mine, but since I'm new, I don't know how I should do this.

Also, given that the first two articles were written 6 years ago, shouldn't there be an easier way to deploy Qt applications on the Linux platform? I also saw something about static binding, is that the way to go? Isn't there a way that all of this can be done through Qt Creator itself?

If there is no hope of creating a portable Qt application for Linux, then there is a way, say, a shell script or something that combines all the steps necessary to compile a Qt project on another computer and run it. Let's say download the Qt-SDK, if not, run qmake and make, and then the just compiled application, if it does not already exist, so that the user can run the program simply by running the script.

+4
source share
3 answers

Your problem here is not in the base Linux base, but in the presence or not of the specific version of Qt that you need (or later).

Just like on a Windows machine, the user can have any Qt installed, or they may not have it at all. On Windows it is easier to check for a specific version of Qt than on Linux, so it’s easier to write installation tools that automate the experience.

There are several ways to solve your problem:

  • Tell the user that your program requires a specific version of Qt or higher, and let the user deal with this problem.
  • Learn how to create packages for each distribution for which you want to target, and create specific packages.
  • Use a program like 0Install or Elf Statifier to create a package / executable file containing all the necessary libraries.

The latter is similar to what many Windows and Mac programs do (they include the entire library that they need the installer for), but this is not the most preferred way for Linux, which depends heavily on shared libraries.

+2
source

Creating a binary application compatible with any other Linux distribution is almost impossible, because you will never know in advance which libraries are available in the X distribution or which version of this library is available. Even among a single distribution (for example, Ubuntu), a binary application is almost never compatible with feedback, since everything built on Ubuntu 12.04 will have dependencies on the version libraries that are installed on this version of Ubuntu, and an attempt to run this binary on Ubuntu 10.04 will most likely, not simply because it does not have enough of the latest version of glibc or any other necessary library.

However, the idea can be much more effective if you limit yourself to a finite list of distributions and versions of these distributions. You can then find out which libraries are available for these distributions and aim for the lowest common denominator. I used a binary application that was supposed to support several distributions (Ubuntu, Fedora, OpenSUSE, SLED, Mandriva), and, as I would, install the oldest distribution that I aimed at my build machine. Thus, the binary application will be associated with the oldest versions of the libraries available for these distributions. If there is no new main version of such a library (which happens quite rarely, and even then distributions usually distribute the previous main version for a while for compatibility purposes), then your compiled binary will then be compatible with all your target distributions.

Therefore, a quick tip that I would give for your situation was using the oldest version of Ubuntu LTS, which is still supported (10.04 at the moment) for your development, and you should be safe enough for the latest popular distributions. For an application that you have already developed on Ubuntu 12.04, you do not have to simply recompile the same source on 10.04. Understand that you will never achieve 100% compatibility with a compiled C ++ Qt application.

If Qt is not all that important to you, you can use a higher level or interpreted language such as Python, Java, Perl, or Ruby. With these languages, you can usually rely on the implementation of a language that is already installed in the target distribution.

+2
source

Deploying an application on Linux is a nightmare, fortunately there are some solutions. Check out these projects to create a portable binary with all the dependencies associated with it:

http://statifier.sourceforge.net/statifier/main.html

http://www.magicermine.com/index.html

http://www.pgbovine.net/cde.html

Another solution is the portable 0install package:

http://0install.net/

I recommend this solution. Personally, I had problems with the first 3 packers.

+1
source

All Articles