close
The Wayback Machine - https://web.archive.org/web/20071013034536/http://www.gamedev.net:80/reference/programming/features/linuxprogramming2/page2.asp
Image






ImageImage
Upcoming Events
ImageIndieGamesCon 2007
10/10 - 10/11 @ Eugene, OR

ImageVirtual Worlds Fall Conference
10/10 - 10/11 @ San Jose, CA

ImageCGA Europe: East 2007
10/17 - 10/19 @ Kyyiv, Ukraine

ImageE for All Expo
10/18 - 10/21 @ Los Angeles, CA

More events...


ImageImage
Quick Stats
146981 people currently visiting GDNet.
2074 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!



Link to us

  search:   

Linux Game Development Part 2
Distributable Binaries


Contents
Image  Introduction
Image  The Problem
Image  The Solution: Steps 1-2
Image  The Solution: Steps 3-4

Image  Printable version
Image  Discuss this article

The Series
Image  Part 1: Introduction
Image  Part 2: Distributable Binaries
Image  Part 3: Installers
Image  Part 4: Testing

The Problem

Creating an executable that works on almost all Linux distributions is a challenge. There are a number of factors that contribute to the problem:

  • Different distributions use different library versions. Dynamic libraries, which are called shared objects in Linux and have a .so extension, are not like DLLs in Windows. Newer versions of a library might use all new symbol versions, which would be unresolved in an older library version.
  • Different distributions may build libraries differently. Many open source libraries, particularly those built from source using �configure�, provide a wide array of build options. You cannot make any assumptions about how a library was built on any particular distribution.
  • Some distributions may not have all the libraries installed that you need. The standard C/C++ libraries, namely glibc and libstdc++, are probably installed, but other game libraries like SDL, Ogg/Vorbis, and OpenAL may not be.
  • Many libraries are dependent on the presence of other libraries. For example, if you link your executable against the OpenAL library, you may discover that the OpenAL library (depending on how it was built) requires other libraries like ALSA, arts or esd (even though you did not explicitly link against these libraries).
No wonder many companies avoid developing for Linux. How do you handle the complexity so that you can provide an executable that runs on every distribution?

The Options

There are basically three options (and a few hybrids that I won�t cover here):

Option #1: open your source code. This is the easiest solution for the developer, and it allows the end user to build a version of the executable that is tailor-made for their computer. Of course, not all users can or want to build a program from source. Most of them just want to install and run your program with a minimum of effort. Also, opening the source code is not always an option for a commercial company. So let�s move on.

Option #2: build distribution-specific versions of your game. Essentially, you would provide a distribution-dependent package like rpm or deb to deliver your game, and allow the distribution�s package manager to resolve the library dependencies for you. While this sounds good in theory, in practice this can be a nightmare for both the developer and the end user. From the end user�s standpoint, it can be a very frustrating experience trying to find and install all of the dependent packages that the package manager says it needs, especially when there are conflicts � this is not the first impression you want a potential customer to have with your game. From the developer standpoint, you would have to provide not only a package for every distribution that you want to support but also a package for every version of that distribution you want to support. New versions can be released several times a year. Plus there are so many distributions (and every one is different) that you can�t possibly support them all in this manner. It would be a full-time job. And if you choose to only support a handful of the more popular distributions, you will effectively shut out many potential customers who use other distributions. So this isn�t an ideal commercial solution either.

Option #3: bundle the specific libraries you need along with your application. The basic idea is this: since you cannot rely on the presence of a particular versioned library on an end user�s system, just include it with your application. That way, your application will always have the libraries it needs in order to run. Linux purists may cringe at this option, but in my opinion, it really is the best way for a commercial company to deliver a binary application that will run on almost any distribution. Gerry Jo Jellestad, a very knowledgeable member of the Linux gaming community who has been credited on games developed by Caravel Games and Grubby Games, recommended this solution to me and provided me with the information I needed to implement it. Many other commercial companies have also chosen this solution, so you can do worse than follow their lead.

For the rest of this article, I will cover what you need to know to build and distribute your application using Option #3.


Image
The Solution: Steps 1-2