Deploy a Qt Application Binary on Linux, compatible with LSB - linux

I have developed a small application in Qt Creator on Ubuntu 12.04 which I want should run on any other linux distro (mostly different versions of CentOS and ubuntu), just like any portable application on windows does.
I want to be able to simply share the binary file of the Application, and run the application.
I am able to successfully do this in windows, by just building the project in QT Creator and then putting the required libraries in the Application directory and then transfering them to other windows systems.
I searched all over and found out that I should be trying to build the project using LSB(Linux Standard Base) Compatibility, so that it runs on other linux distros. Is that the right way to do this?
I am very new to Qt and also to Linux (dont know much of Shell Scripting).
Thus, I dont know how I should proceed to make the Application LSB Compliant.
I have refered to, the following links:
Distributing Qt-based binaries on Linux and
Deploying Qt applications on Linux but have not beem able to understand what I am suposed to do.
I also found this question here which states a very similar situation as mine, but because I am a novice, I dont know how I should do this.
Moreover, considering that the first two articles were written 6 years back, shouldn't there be a simpler way to deploy Qt apps on the linux platform now?
I also saw something about static linking, is that the way to go?
Isn't there a way by which all of this can be done through Qt Creator itself?
If there is no hope of creating a portable Qt Application for Linux, then is there a way, say a shell script or something that would combine all the steps required to compile the Qt project on another computer and run it. Say, download Qt-SDK if not present, run qmake and make and then the newly compiled application, if not already there, so that the user can run the program just by running one script.

Your problem here is not the Linux Standard Base, but rather the presence or not of the specific version of Qt you need (or a later one).
Exactly like on a Windows machine, a user may have any of Qt installed, or they may not have it at all. On Windows it is easier to check for the presence of a certain version of Qt than it is on Linux, thus it is easier to write install tools that automate the experience.
To solve your problem there are a few ways:
Inform the user that your program requires a certain version of Qt or higher, and let the user handle the problem
Learn how to create packages for every distribution you want to target and create specific packages
Use a program like 0Install or Elf Statifier to create a package/executable containing all the necessary libraries.
The latter is similar to what many Windows and Mac programs do (they include every library they need within the installer), but it is not the preferred way on Linux, which relies heavily on shared libraries.

Making a binary application compatible with any other Linux distro is practically impossible since you will never know in advance which libraries are available in distro X, or what version of that library is available. Even among a single distro (e.g. Ubuntu), binary application are almost never backward-compatible, since anything built on Ubuntu 12.04 will have dependencies on versions libraries which are installed on that version of Ubuntu, and trying to run that binary on Ubuntu 10.04 will most probably fail simply because it doesn't have a recent enough version of glibc or some other necessary library.
However, the idea can be much more implementable if you limit yourself to a finite list of distros and versions of those distros. You can then know which libraries are available for those distros, and aim for the lowest common denominator. I used to maintain a binary application which had to support several distros (Ubuntu, Fedora, OpenSUSE, SLED, Mandriva), and the way I would do it is install the oldest distro I was targeting on my build machine. That way, the binary application would be linked to the oldest versions of the libraries available on those distros. Unless there's a new major version of such a library (which happens quite rarely, and even then, distros usually distribute the previous major version for a while for compatibility purposes), your compiled binary will then be compatible with all your targeted distros.
Therefore, the quick piece of advice I would give for your situation, use the oldest LTS version of Ubuntu which is still supported (10.04 at the moment) for your development, and you should be pretty safe for most recent popular distros. For the application you already developped on Ubuntu 12.04, you should have no problem simply recompiling the same source on 10.04. Understand that you will never however achieve 100% compatibility with a compiled C++ Qt application.
If Qt is not all that important to you, you could use a higher-level or interpreted language such as Python, Java, Perl or Ruby. With such languages, you can usually count on the language implementation already being installed on the target distro.

Deploy an application in Linux is a nightmare, luckily there are some solutions. Check this projects to build a portable binary with all their dependencies bundled:
http://statifier.sourceforge.net/statifier/main.html
http://www.magicermine.com/index.html
http://www.pgbovine.net/cde.html
Another solution is make a portable 0install package:
http://0install.net/
I recomend this solution. Personally I have been problems with the 3 first packagers.

Related

Distribute wxWidgets applications on Linux platforms

I started to learn wxWidgets some days ago and I found it really good, but when I tried to "export" it to another platform, it didn't work. I expected that, but when I searched how to distribute wxWidgets apps, I didn't find that much, except to install all the wxWidgets library on that platform.
I use Debian 10, while the other platform where I need to export my app uses Lubuntu. It says that it needs a wxgtk3.0 library, but I guess that library will need even more libraries.
How do I export my wxWidgets application without asking the user to manually install and build all the library on its platform? Maybe even using .deb package (if really needed). Thanks in advance.
Please understand that every single distribution uses it own format comparing to Windows where there is an Installation Wizard or OSX where there is a Bundle.
Now, you can create a deb file where you set everything up.
So you can create an rpm (which is basically the same thing as deb, just for different distribution).
This is the best way as it ensures that all dependencies and their versions are satisfied.
Hope this helps!
Many Linux distributions have wxWidgets packages, so one possibility would be to simply ask users to install these packages when they need to use your application. This is not really different from installing GTK libraries or even X11 (or Wayland) that your application also depends on -- the only difference is that these libraries are almost surely already installed on any Linux desktop system, while wxWidgets ones might not be.
Another alternative is to link your application statically with wxWidgets libraries. This will make it much bigger and will prevent the users from upgrading the libraries on their system to improve the application behaviour, but can be simpler for the users to install. Note that if you choose the static linking route, you typically need to build your application on the oldest distribution you want to support (which is probably not Debian 10, which is relatively recent), as this is a simple way to ensure that it doesn't require newer versions of the (other, non-wx) libraries than the ones already present on the user's system.

Program package to work with all the Linux distribution

I'm currently working on a Linux project. This project needs to run under every Linux distribution (without installing any package/libraries/others for the clients) and it's a bit hard to do it well.
I already tried to do it myself, see this, i have also tried to use CDE but it didn't work well since i got an error with some distribution. For example:
Ubuntu 8.04: Impossible to read the header ELF
Debian 7.8: version of GLIBC_2.14 not found
So, i would like to know if there is a way to get a package of my program who can run under every Linux distribution.
Thanks
Edit: I would like to avoid the static compilation, since my program is pretty big.
There are big differences between linux distributions, especially version of libraries and package management system.
The only way how to do it is to build/compile your project against all libraries you need to use statically, and distribute them with your project.
For example skype and ejabberd do it this way.

How to bundle an application for Linux

I am writing a (closed-source) application and will provide binaries for all three major platforms (MacOS X, Linux and Windows). It uses Qt under the LGPL license so I am required to dynamically link with the Qt libraries. I understand how to bundle the application for MacOS and Windows by simply providing the Qt dynamic library with the application, but I am unsure how to do this properly for Linux.
It's traditional to provide the application as a package (.deb and .rpm) and allow the package system to resolve the dependencies. Should use this method? If so which distros should I be aiming for (I am assuming Ubuntu and Fedora)? If anyone has any experience with this, I'd be interested in hearing it.
deb, rpm and tarballs are the right ways to go. There are a few non-standard ways that I know of which you might want to consider as well which are more distro agnostic.
Makeself - Self extracting shell scripts that contain your application. This is quite widely used by closed source software distributors.
ZeroInstall - useful for non-root installations.
Listaller - Merged with autoinstall and it seems to be unstable as of now.
You need to provide at least 3 packages for Linux; a .deb for Debian-based systems, a .rpm for RPM-based systems, and a tarball for everything else. Some find it necessary to refine it to provide three or four different .rpm packages, for Fedora, SuSE, Mandriva, and RHEL, depending on the exact library requirements the software has.
There are many ways to do so... but if you want a distribution generic way to bundle an application for Linux, you may check this ( http://codevarium.gameka.com.br/deploying-cc-linux-applications-supporting-both-32-bit-and-64-bit/ ) tutorial. It shows how to copy all the dependencies to a library folder and make a shell script to properly execute the bundle.

How can I compile my Windows program into a single Linux binary that runs with Wine?

Just today i checked my ubuntu with installing wine in it ,
Delphi 3 to 7 worked perfectly (Rad studios did not work because they use .net scraps).
But all of the application i made worked perfectly!!!!!
And i heard that it also works well in mac with WineBottler
Is it possible to create a header linux executable and put my vcl application and requird wine stuff into it and distribute as a single executable (.bin)
there is(was) a solution for Linux from Borland, called Kylix. Kylix is based on some older Qt-stuff.
But I would give FreePascal/Lazarus a try, it's pretty cool! and the compiler compiles for many different platforms.
I guess this is what winelib is for. However I have never tried it. (Wasn't Kylix Delphi + winelib compiled for Linux?)
Since Wine is now stable (reached the 1.0 version some time ago), it could make sense to ask the user to install it using its Linux packages manager. It's very fast and easy. So Wine will be always up to date, according to the distribution used.
Then it's very easy to install any Windows program with Wine.
Since Delphi executables are mostly self-contained (if you don't use the BDE or some external database libraries), your clients will install your Delphi application alla "Windows" way, that is, by running a Setup program from Wine.
And it will work fine, as is.
Using WineLib is not a good idea, even not advised by Wine developers, as far as I remember. At least for closed-source software: in one or two years, perhaps you won't release another version of your program, but Wine and WineLib will have evolved a lot... If you use Wine as an external package, your client can be sure there will be some end user enhancements.
If your software is purely Open Source, then using WineLib could make sense. But even the WineLib headers can evolved, so perhaps your source won't evolve at the same speed...

RHEL5 Qt compiler/linker/qmake issues... advice?

I have about a few problems with a new install of the Qt SDK. I probably only need advice, but specific answers are also welcome. Before I begin a mini-story, I am running RHEL5 on academic license under VirtualBox on OSX 10.6. Using Qt version 4.5.3. This is my situation...
1.) I couldn't compile because g++ wasn't found. I fixed this by creating a link: g++ -> g++34. This allowed me to compile but it generated more errors at link-time. I had installed the framework in my home directory unintentionally so I uninstalled/reinstalled the entire SDK to /usr/local/qt.
2.) At this point I could compile but the linker complained about a missing freetype package. I had that already installed but wasn't sure why it couldn't be found. So I installed a few packages that I thought might be missing like libqt4-devel and libqt4-devel-debug. I also installed a few other general programming packages for later use.
3.) Somehwere in this process I can no longer run qmake. I ran it before and I have it installed at /usr/local/qt/qt/bin/qmake. I could create a link to it (though I shouldn't have to OR I could ensure that the location was in the PATH var). However, at this point Qt Creator says there's no Qt installation found. I re-pointed it to the installation location (using Tools/Options) but it still won't run qmake or anything else for that matter...
I only need this linux install to compile and test my Qt projects which I am developing in OSX. So my question is, should I just wipe this RHEL install and start over? And if so, should I use something else like Ubuntu? I am having plenty of hassles that I don't want to deal with as is. Note, this project will require good OpenGL support.
Is there a particular reason that you don't simply use the Qt package that's part of RHEL?
If for some reason you need to build your own, you can get all of the build dependancies with:
$ yum install yum-utils
$ yum-builddep <whatever the qt package's name is>
#scotchi is right, and you should try to use the Qt package that comes with your system unless you need a very different version. I don't know what version of Qt comes with RHEL but if its not up-to-date enough for you (and it might not be, see below) then you could consider changing OS versions. I would only do this after trying his suggestion though, because you may be able to get things working without the hassle of a full OS install.
Now, as to why you might want to switch: RHEL is, as its name ("Enterprise Linux") indicates aimed at companies who want to run servers, or large deployments of desktops. It emphasizes stability and reliability over being cutting edge. Fairly often the version of the compiler and development libraries lag a little behind the curve. This is what their clients want: a stable platform they can develop against and run programs on for a period of time, not constantly needing to keep up with the latest changes, and thoroughly tested. But for people doing development at home it may not be necessary to stay that conservative. I don't know if this is for work, school or personal programming, but it sounds to me like you should move to one of the more desktop-oriented distros. Ubuntu is great, as is Fedora. If you prefer a RHEL-like environment, then choose Fedora.

Resources