Writing app for multiple Linuxes
-
I've been tasked with getting our Qt app to run on both Centos 5 & 6. What is the best way to go about doing this? I've been trying to get it to build on Centos 5 but the Qt isn't very up to date. So I'd like to use Centos 6, but can I build a single binary that will run on both 5 & 6, using Qt v4.8 and its version of Qt Creator? It would be ideal, of course, if this same binary would also run on other distros, like Ubuntu.
-
You could build statically, that would make it run on any linux distro (but be aware of licensing). Or stick with the lib version from COS 5, then it would run on both without problems (hopefully).
You can also take a look at how Qt Creator does it - it always comes with it's own Qt libs bundled. I don't remember how they manage it, but since they do, there certainly IS a way :)
-
You install the most up to date version of Qt on each machine (rather than use whatever version of Qt is shipped with the OS). It should install to /usr/local/Trolltech/Qt-<version number>
Compile and link your app to this Qt version. Copy the Qt shared libs your app uses (keeping the sym links - it's best to tar them first, copy the tar file then untar them) to say a 'lib' directory, copy your compiled binary to a 'bin' directory, and put them both in a directory you will ship.
Then the end users just have to set their PATH to point to <your_dir>/bin and LD_LIBRARY_PATH to <your_dir>/lib.
At least, that's what I do, and it works happily for Centos 4, 5 and Ubuntu 10.
-
The "LSB":http://www.linuxfoundation.org/collaborate/workgroups/lsb is supposed to make that straight forward. Qt is defined there as part of the desktop area, so that should help. Of course the Qt in there is rather old... (IIRC 4.2 or something), so you might want to go for something else.
I usually just decide which distributions to support and then do the building on the oldest distribution and the majority of testing on the newest. That works most of the time, but you really need to document which libraries you need and make sure all of them are available.
I use "schroot":http://alioth.debian.org/projects/buildd-tools a lot, which allows to have several distributions installed into chroot environments (think: directories:-). Those are a huge help to find library compatibility issues and run at native speed -- much faster than VMs.