[CMake] Packaging Best Practices for Linux

Dan Kegel dank at kegel.com
Wed May 16 20:12:36 EDT 2012


On Wed, May 16, 2012 at 4:20 PM, Craig Scott
<craig.scott at southerninnovation.com> wrote:
> Don't give up just yet! There are other options which might meet your
> needs. No-one appears yet to have mentioned the LSB (Linux Standards Base)
> and it is designed to solve problems just like yours. Admittedly, it will
> take a little bit of (one-time) work, but as someone who has done this with
> production code at a previous employer, we found it was well worth it. After
> getting things working, we only had to distribute a single package to cover
> all linux distributions (yes, even Debian-based ones such as Ubuntu).

Yes, when we built the Linux ports of Picasa and Chrome, we found
the LSB somewhat useful.
This was back in the bad old days when we could only depend
on lsb 3.1; if you can rely on lsb 4, there might be fewer holes.
See https://www.linuxbase.org/lsb-cert/productdir.php?by_lsb
for which distros support which versions. (Hint: RHEL 5 is lsb 3.1.)

But shipping really portable linux binaries is kind of an advanced topic,
harder than just providing source that works on current distros.

Instead of using LSB-specific compilers, we built our
binaries on debian 3.0, and used a couple explicit lsb dependencies
to reduce the package dependency list.  That got most of
the benefit without depending on strange compilers or
pointing to possibly missing strange dynamic loaders.

The real work was in dealing with the packages that are not
yet part of the LSB; we had to bundle those and/or (in the case
of openssl and picasa) search at runtime for the dang thing.

There used to be a live database showing what functions
were supported by which versions of LSB, see
http://ispras.linuxbase.org/
It's currently 'down for maintenance'.

Try running your app through the LSB app checker, maybe.
That's a local app, and might point out a few libraries or
functions that aren't portable.

We also found that we couldn't add a dependency on the whole LSB,
since that pulled in a mail client, which pulled in a whole desktop
environment, or something horrible like that.


More information about the CMake mailing list