Supporting Multiple Linux Distributions for software developers
Novell Cool Solutions: Feature
By Bill Bodine, Richard Smith
Digg This -
Posted: 22 Dec 2004
Bill Bodine, Senior Software Engineer, Novell, Inc
Richard Smith, Developer Content Manager, Novell, Inc
We are often asked what it would take to support SUSE Linux with an application that currently is running and supported on another Linux distribution. In many cases the other Linux distribution is Red Hat. The topic of taking an application that currently runs on Red Hat specifically and enabling that application for SUSE Linux can be approached from two angles.
How do I as a developer ensure that any Linux code I write can be run on as many distributions as possible?
An article by Paul MacKay covers the critical issues of writing applications that want to have binary compatibility across distributions. The issues he covers are:
- Language development issues (little and big endian, floats vs. doubles, etc.)
- LSB/FHS - Since this is going to be the best way of ensuring binary compatibility of an application across distributions he covers it briefly in this article. Novell Developer Services are very focused on helping partners make their applications be LSB compliant, particularly since all the major distributions have announced support for LSB 2.0. This is a unifying standard that promises to help the Linux community as a whole. (See http://www.linuxbase.org, or Building Applications with the Linux Standard Base, ISBN 0-13-145695-4)
- Packaging - rpms are discussed in terms of how a developer should package an application so that it can be installed on as many distributions as possible.
- Enabling the application for other management tools than those on Red Hat, ie. YAST.
Given an application that has been tested and currently runs on Red Hat, what are the chances of that application running, without changes, on SUSE Linux, and if there are issues, what are they?
Our experience, and those of other software developers we have queried, is that most applications that are running on a Red Hat distribution will also run on a SUSE distribution. Now this is not always the case; there are a number of issues that might surface that would need addressing. If there is a problem it typically will have something to do with one of the following issues:
- Glibc - If an application has dependencies on a version of Glibc that cannot be met by a version released with another distribution, then problems can occur. However, since RHEL 3 provides version 2.3.2-xx.x of Glibc and SLES 9 provides version 2.3.3-xx (a newer release), this should not keep applications tested on Red Hat from running on SLES 9 as well.
- libstdc++ and libgcc_s - If an application is dynamically linked to these shared libraries, then it is possible for version differences to exist. If applications are statically linked to these libraries then of course problems do not exist.
- Missing libraries - If an application has dependencies on shared libraries that are included in the Red Hat distribution that are not included in SLES 9 (which is highly unlikely), then of course this will cause problems. However, once the missing libraries are identified, they can be installed on the new distribution.
- Incorrectly built binaries and libraries - If an application has defined errno and h_errno as extern's rather than including the appropriate header files (errno.h, netdb.h), then it is possible, when compiling a multi-threaded application, to have problems since these are now functions rather than just integer variables as they were before. If an application does not load because of this, it is possible to set some environment variables that will mask around the problem. However, the real fix is to adjust the code to include the header files.
- If the Red Hat gcc 2.96 compiler was used to build the application and if the changes made by Red Hat are used by the application then it will likely not run on SLES 9 or any other distribution, for that matter, including other Red Hat releases. To fix this, the application needs to be modified to not rely on the gcc 2.96 modifications made by Red Hat. (see http://gcc.gnu.org/gcc-2.96.html)
So, you can see that there are a number things a developer can do to build applications that will support multiple Linux distributions without the need for separate code bases. During the next few months we will be providing articles that go into much more depth about how to do this most effectively.
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com