How to Build LSB Applications

Don't leave your Linux software stuck on one distribution. Make it run anywhere with the standard that all the major distributions use.

Packaging

As I mentioned earlier, the LSB specifies that a package must be delivered in
the RPM file format. This does not mean that RPM has to be used to build or
package your application, although it may be the most practical option, depending on
whether you already are using it. Other options would be creating
the package in the Debian format, and then using alien to convert it to
RPM.
Or, you could use some other tool for creating the RPM file format. We have the
beginnings of a tool called mkpkg to create the RPM format file, but it
likely will require something to sit on top of it to make it
useful to any but the most die-hard hacker.

In our application battery, we currently build the application and install it
in a temporary root and then invoke RPM to package up the install application.
This may seem a little clunky, but it works without much pain and produces
more consistent results across all of the different versions of RPM
found in the wild.

Full source code for building and packaging this and the other applications
in the application battery can be found in the LSB Project CVS tree.

Does This Really Work?

Yes, it really does work, although to be fair, we still are running into
corner cases and various applications that don't always follow the rules for
clean, portable code. As part of the verification for
the LSB, we have created an application battery built from the tools
described here. This set of applications includes Apache, Samba, Lynx, Python,
xpdf and groff. We have tried to select a set of real applications that
provide coverage over as much of the LSB set of interfaces as possible.

What about C++ Applications?

LSB version 1.3 does not support C++, so the rule requiring the library to be
linked statically applies. We are adding support for C++ to LSB 2.0 to avoid
this. We provide the lsbdev-c++ package, which contains a version of
libstdc++ that was configured and built with lsbcc. This and GCC version 3.2
seem to produce good results. We have tried other combinations of compilers and
different versions of the C and C++ libraries but ran into various problems,
depending on the nature of the application.

Future Directions

For the LSB in general, we will continue to add additional libraries to the
specification as long as there is consensus that they are needed and have
reached a certain level of stability. This should help close the gap between
how distribution-provided and LSB-conforming applications are built.

For the LSB development environment, we will continue to make the tools
better and more transparent. The development environment is being
maintained actively, and feedback from people using these tools is appreciated. With
the addition of C++ in LSB 2.0, the development environment will be able to
drop the lsbdev-c++ package being used today in favor
of the C++ stub library, which will move into the base LSB development package.

Currently, you may have to set several options in an rpmrc or rpmmacros file
to make RPM produce LSB-conforming packages. It is our hope that we can
come up with an LSB mode for rpmbuild that can handle all of
this automatically. Hopefully, it will make it even easier to build
existing packages that conform to the LSB.

Acknowledgements

First off, thanks to the Free Standards Group and its members for
providing the support to the LSB Project that has enabled us to accomplish
as much as we have. Secondly, thanks to the core group of developers
working on the development environment for the LSB, including Chris Yeoh,
Marvin Heffler and especially Mats Wichmann for their patience and persistence
during the more experimental phases of this project.

Stuart R. Anderson (anderson@freestandards.org) made the mistake of being
overheard while saying “I know how to fix that”, and he has been the lead
developer of the LSB Written Specification ever since. When not working on
the LSB, Stuart keeps busy enlightening South Carolina to open-source
ideas by converting companies one at a time.

Trending Topics

Upcoming Webinar

Getting Started with DevOps - Including New Data on IT Performance from Puppet Labs 2015 State of DevOps Report

August 27, 2015
12:00 PM CDT

DevOps represents a profound change from the way most IT departments have traditionally worked: from siloed teams and high-anxiety releases to everyone collaborating on uneventful and more frequent releases of higher-quality code. It doesn't matter how large or small an organization is, or even whether it's historically slow moving or risk averse — there are ways to adopt DevOps sanely, and get measurable results in just weeks.