""> >

Chapter 2
Building the plane: Compiling the program

This central chapter describes how to build FlightGear on several systems. In case you are on a Win32 (i. e. Windows95/98/ME/NT/2000/XP) platform or any of the other platforms which binary executables are available for, you may not want to go though that potentially troublesome process but skip that chapter instead and straightly go to the next one. (Not everyone wants to build his or her plane himself or herself, right?) However, there may be good reason for at least trying to build the simulator:

  • In case you are on a UNIX/Linux platform there may be no pre-compiled binaries available for your system. In practice it is common to install programs like this one on UNIX systems by recompiling them.
  • There are several options you can set during compile time only.
  • You may be proud you did.

On the other hand, compiling FlightGear is not a task for novice users. Thus, if you’re a beginner (we all were once) on a platform which binaries are available for, we recommend postponing this task and just starting with the binary distribution to get you flying.

As you will notice, this Chapter is far from being complete. Basically, we describe compiling for two operating systems only, Windows and Linux, and for only one compiler, the GNU C compiler. FlightGear has been shown to be built under different compilers (including Microsoft Visual C) as well as different systems (Macintosh) as well. The reason for these limitations are:

  • Personally, we have access to a Windows machine running the Cygnus compiler only.
  • According to the mailing lists, these seem to be the systems with the largest user base.
  • These are the simplest systems to compile FlightGear on. Other compilers may need special add-ons (workplace etc.) or even modification of the code.
  • The GNU compiler is free in the same sense of the GPL as FlightGear is.

You might want to check Section A, Missed approach, if anything fails during compilation. In case this does not help we recommend sending a note to one of the mailing lists (for hints on subscription see Chapter C).

There are several Linux distributions on the market, and most of them should work. Some come even bundled with (often outdated) versions of FlightGear. However, if you are going to download or buy a distribution, Debian (Woody) is suggested by most people. SuSE works well, too.

Contrary to Linux/Unix systems, Windows usually comes without any development tools. This way, you first have to install a development environment. On Windows, in a sense, before building the plane you will have to build the plant for building planes. This will be the topic of the following section, which can be omitted by Linux users.

2.1 Preparing the development environment under Windows

There is a powerful development environment available for Windows and this even for free: The Cygnus development tools, resp. Cygwin. Their home is at,

and it is always a good idea to check back what is going on there now and then.

Nowadays, installing Cygwin is nearly automatic. First, make sure the drive you want Cygwin, PLIB, SimGear and FlightGear to live on, has nearly 1 GB of free disk space. Create a temporary directory and download the installer from the site named above to that directory. (While the installer does an automatic installation of the Cygnus environment, it is a good idea to download a new installer from time to time.)

Invoke the installer now. It gives you three options. To avoid having to download stuff twice in case of a re-installation or installation on a second machine, we highly recommended to take a two-step procedure. First, select the option Download from Internet. Insert the path of your temporary directory, your Internet connection settings and then choose a mirror form the list. Near servers might be preferred, but may be sometimes a bit behind with mirroring. We found

a very recent and fast choice. In the next windows the default settings are usually a good start. Now choose Next, sit back and wait.

If you are done, invoke the installer another time, now with the option Install from local directory. After confirming the temporary directory you can select a root directory (acting as the root directory of your pseudo UNIX file system). Cygnus does not recommend taking the actual root directory of a drive, thus choose c:/Cygwin (while other drives than c: work as well). Now, all Cygwin stuff and all FlightGear stuff lives under this directory. In addition, select

Default text file type: Unix

In addition, you have the choice to install the compiler for all users or just for you.

The final window before installation gives you a selection of packages to install. It is hard, to provide a minimum selection of packages required for FlightGear and the accompanying libraries to install. We have observed the following (non minimum) combination to work:

  • Admin skip
  • Archive install
  • Base install
  • Database skip
  • Devel install
  • Doc install
  • Editors skip
  • Graphics install
  • Interpreters install
  • Libs install
  • Mail skip
  • Net skip
  • Shells install
  • Text install
  • Utils install
  • Web skip
  • XFree86 do not install!

Note XFree86 must be not installed for building FlightGear and the accompanying libraries. If it is installed you have to deinstall it first. Otherwise FlightGear’s configuration scripts will detect the XFree86 OpenGL libraries and link to them, while the code is not prepared to do so.

As a final step you should include the binary directory (for instance:
c:/Cygwin/bin) into your path by adding path=c:\Cygwin\bin in your autoexec.bat under Windows 95/98/ME. Under WindowsNT/2000/XP, use the Extended tab under the System properties page in Windows control panel. There you’ll find a button Environment variables, where you can add the named directory.

Now you are done. Fortunately, all this is required only once. At this point you have a nearly UNIX-like (command line) development environment. Because of this, the following steps are nearly identical under Windows and Linux/Unix.

2.2 Preparing the development environment under Windows

Linux, like any UNIX, usually comes with a compiler pre-installed. On the other hand, you still have to make sure several required libraries being present.

First, make sure you have all necessary OpenGL libraries. Fortunately, most of the recent Linux distributions (i.e. SuSE-7.3) put these already into the right place. (There have been reports, though, that on Slackware you may have to copy the libraries to /usr/local/lib and the headers to /usr/local/include by hand after building glut-3.7). Be sure to install the proper packages: Besides the basic X11 stuff you want to have - SuSE as an example - the following packages: mesa, mesa-devel, mesasoft, xf86_glx, xf86glu, xf86glu-devel, mesaglut, mesaglut-devel and plib.

Also you are expected to have a bunch of tools installed that are usually required to compile the Linux kernel. So you may use the Linux kernel source package top determine the required dependencies. The following packages might prove to be useful when fiddling with the FlightGear sources: automake, autoconf, libtool, bison, flex and some more, that are not required to build a Linux kernel.

Please compare the release of the Plib library with the one that ships with your Linux distribution. It might be the case that FlightGear requires a newer one that is not yet provided by your vendor.

2.3 One-time preparations for Linux and Windows users

There are a couple of 3rd party libraries which your Linux or Windows system may or may have not installed, i.e. the ZLIB library and the Metakit library. You can either check your list of installed packages or just try building SimGear: It should exit and spit an error message (observe this!) if one of these libraries is missing.

If you make this observation, install the missing libraries, which only is required once (unless you don’t re-install you development environment).

Both libraries come bundled with SimGear, which links to them, bus does not automatically install them. For installing either of them, get the most recent file SimGear-X.X.X.tar.gz from

Download it to /usr/local/source. Change to that directory and unpack SimGear using

tar xvfz SimGear-X.X.X.tar.gz.

You will observe a directory src-libs which contains the two names libraries.

2.3.1 Installation of ZLIB

cd into SimGear-X.X.X/scr-libs and unpack ZLIB using

tar xvfz zlib-X.X.X.tar.gz.

Next, change to the newly created directory zlib-X.X.X and type

make install

Under Linux, you have to become root for being able to make install, for instance via the su command.

2.3.2 Installation of Metakit

cd into SimGear-X.X.X/scr-libs and unpack Metakit using

tar xvfz metakit-X.X.X.tar.gz.

Next, change to directory zlib-X.X.X/builds (!) and type (where the configure option --with-tcl=no is at least required on a Cygwin system):

./configure --with-tcl=no
make install

Under Linux, you have to become root for being able to make install, for instance via the su command.

You may want to consult the Readme files under SimGear-X.X.X/scr-libs in case you run into trouble.

2.4 Compiling FlightGear under Linux/Windows

The following steps are identical under Linux/Unix and under Windows with minor modifications. Under Windows, just open the Cygwin icon from the Start menu or from the desktop to get a command line.

To begin with, the FlightGear build process is based on four packages which you need to built and installed in this order:

  • PLIB
  • SimGear
  • FlightGear, program
  • FlightGear, base (data - no compilation required)
  1. First, choose an install directory for FlightGear. This will not be the one your binaries will live in but the one for your source code and compilation files. We suggest


    mkdir source

  2. Now, you have to install a support library PLIB which is absolutely essential for the building process. PLIB contains most of the basic graphics rendering, audio, and joystick routines. Download the latest stable version of PLIB from

    to /usr/local/source. Change to that directory and unpack PLIB using

    tar xvfz plib-X.X.X.tar.gz.

    cd into plib-X.X.X and run

    make install.

    Under Linux, you have to become root for being able to make install, for instance via the su command.

    Confirm you now have PLIB’s header files (as ssg.h etc.) under
    /usr/include/plib (and nowhere else).

  3. Next, you have to install another library SimGear containing the basic simulation routines. Get the most recent file SimGear-X.X.X.tar.gz from

    Download it to /usr/local/source. Change to that directory and unpack SimGear using

    tar xvfz SimGear-X.X.X.tar.gz.

    cd into SimGear-X.X.X and run

    make install

    Again, under Linux, you have to become root for being able to make install, for instance via the su command.

  4. Now, you’re prepared to build FlightGear itself, finally. Get
    FlightGear-X.X.X.tar.gz from

    and download it to /usr/local/source. Unpack FlightGear using

    tar xvfz FlightGear-X.X.X.tar.gz.

    cd into FlightGear-X.X.X and run


    configure knows about numerous options, with the more relevant ones to be specified via switches as

    • --with-network-olk: Include Oliver Delise’s multi-pilot networking support,
    • --with-new-environment: Include new experimental environment subsystem,
    • --with-weathercm: Use WeatherCM instead of FGEnvironment,
    • --with-plib=PREFIX: Specify the prefix path to PLIB,
    • --with-metakit=PREFIX: Specify the prefix path to Metakit,
    • --with-simgear=PREFIX: Specify the prefix path to SimGear,
    • --prefix=/XXX: Install FlightGear in the directory XXX.
    • --disable-jsbsim: Disable JSBSimm FDM (in case of trouble compiling it).
    • --disable-yasim: Disable YASim FDM (in case of trouble compiling it).
    • --disable-larcsim: Disable LaRCsim FDM (in case of trouble compiling it).
    • --disable-uiuc: Disable UIUC FDM (in case of trouble compiling it).

    A good choice would be --prefix=/usr/local/FlightGear. In this case FlightGear’s binaries will live under /usr/local/FlightGear/bin. (If you don’t specify a --prefix the binaries will go into /usr/local/bin while the base package files are expected under /usr/local/lib/FlightGear.)

    Assuming configure finished successfully, run

    make install.

    Again, under Linux, you have to become root for being able to make install, for instance via the su command.

    Note: You can save a significant amount of space by stripping all the debugging symbols off the executable. To do this, make a

    cd /usr/local/FlightGear/bin

    to the directory in the install tree where your binaries live and run

    strip *.

This completes building the executable and should result in a file fgfs (Unix) or fgfs.exe (Windows) under /usr/local/FlightGear/bin

Note: If for whatever reason you want to re-build the simulator, use the command make distclean either in the SimGear-X.X.X or in the FlightGear-X.X.X directory to remove all the build. If you want to re-run configure (for instance because of having installed another version of PLIB etc.), remove the files config.cache from these same directories before.

2.5 Compiling FlightGear under Mac OS X

For compiling under Mac OS X you will need

  • Mac X OS 10.1+ with developer tools installed.
  • 500MB disk (minimum) free disk space.
  • Fearlessness of command line compiling.

This will need a bit more bravery than building under Windows or Linux. First, there are less people who tested it under sometimes strange configurations. Second, the process as described here itself needs a touch more experience by using CVS repositories.

First, download the development files. They contain files that help simplify the build process, and software for automake, autoconf, and plib: walisser/fg/fgdev.tar.gz


Once you have this extracted, make sure you are using TCSH as your shell, since the setup script requires it.

Important for Jaguar users:

If you run Mac OS X 10.2 or later, gcc 3.1 is the default compiler. However, only version 2.95 works with FlightGear as of this writing. To change the default compiler, run this command (as root). You’ll only have to do this once and it will have a global effect on the system.

sudo gcc select 2

  1. Setup the build environment:
    cd fgdev
    source bin/prepare.csh
  2. Install the latest versions of the automake and autoconf build tools:
    cd $BUILDDIR/src/automake-X.X.X
    ./configure --prefix=$BUILDDIR
    make install

    cd $BUILDDIR/src/autoconf-X.XX
    ./configure --prefix=$BUILDDIR
    make install

  3. Download PLIB
    cd $BUILDDIR/src
    setenv CVSROOT
    /cvsroot/plib (one line!)
    cvs login
    Press <enter> for password
    cvs -z3 checkout plib
  4. Build PLIB
    cd $BUILDDIR/src/plib
    ./configure --prefix=$BUILDDIR
    make install
  5. Get the SimGear sources
    cd $BUILDDIR/src
    setenv CVSROOT
    /var/cvs/SimGear-0.0 (one line)
    cvs login
    Enter <guest> for password
    cvs -z3 checkout SimGear
  6. Build Metakit
    cd $BUILDDIR/src/SimGear/src-libs
    tar -zxvf metakit-X.X.X-32.tar.gz
    cd metakit-X.X.X/builds
    ../unix/configure --prefix=&BUILDDIR
    --enable-static --disable-dynamic (one line)
    make install
  7. Build SimGear
    cd $BUILDDIR/src/SimGear
    ./configure --prefix=$BUILDDIR
    make install
  8. Get the FlightGear sources
    cd $BUILDDIR/src
    setenv CVSROOT
    /var/cvs/FlightGear-0.X (one line!)
    cvs login
    Enter <guest> for password
    cvs -z3 checkout FlightGear
  9. Build FlightGear
    cd $BUILDDIR/src/FlightGear
    patch -p0 < ../jsb.diff
    ./configure --prefix=$BUILDDIR
    --with-threads --without-x (one line)
    make install
  10. Get the base data files (if you don’t have them already)
    cd $BUILDDIR
    setenv CVSROOT
    /home/cvsroot (one line)
    cvs login
    Password is ”cvsguest”
    cvs -z3 checkout fgfsbase
  11. Move data files (if you have them already)
    just make a symlink or copy data files to ”fgfsbase” in $BUILDDIR
    alternatively adjust --fg-root=xxx parameter appropriately
  12. Run FlightGear
    cd $BUILDDIR

2.6 Compiling on other systems

Compiling on other UNIX systems - at least on IRIX and on Solaris, is pretty similar to the procedure on Linux - given the presence of a working GNU C compiler. Especially IRIX and also recent releases of Solaris come with the basic OpenGL libraries. Unfortunately the ”glut” libraries are mostly missing and have to be installed separately (see the introductory remark to this chapter). As compilation of the ”glut” sources is not a trivial task to everyone, you might want to use a pre-built binary. Everything you need is a static library ”libglut.a” and an include file ”glut.h”. An easy way to make them usable is to place them into /usr/lib/ and /usr/include/GL/. In case you insist on building the library yourself, you might want to have a look at FreeGLUT

which should compile with minor tweaks. Necessary patches might be found in

Please note that you do not want to create 64 bit binaries in IRIX with GCC (even if your CPU is a R10/12/14k) because GCC produces a broken ”fgfs” binary (in case the compiler doesn’t stop with ”internal compiler error”). Things might look better if Eric Hofman manages to tweak the FlightGear sources for proper compiling with MIPSPro compiler (it’s already mostly done).

There should be a workplace for Microsoft Visual C++ (MSVC6) included in the official FlightGear distribution. Macintosh users find the required CodeWarrior files as a .bin archive at walisser/fg/.

Numerous (although outdated, at times) hints on compiling on different systems are included in the source code under docs-mini.

2.7 Installing the base package

If you succeeded in performing the steps named above, you will have a directory holding the executables for FlightGear. This is not yet sufficient for performing FlightGear, though. Besides those, you will need a collection of support data files (scenery, aircraft, sound) collected in the so-called base package. In case you compiled the latest official release, the accompanying base package is available from

This package is usually quite large (around 25 MB), but must be installed for FlightGear to run. There is no compilation required for it. Just download it to /usr/local and install it with

tar xvfz fgfs-base-X.X.X.tar.gz.

Now you should find all the FlightGear files under /usr/local/Flightgear in the following directory structure::




. . .


. . .


2.8 For test pilots only: Building the CVS snapshots

It you are into adventures or feel you’re an advanced user, you can try one of the recent bleeding edge snapshots at

In this case you have to get the most recent Snapshot from SimGear at

as well. But be prepared: These are for development and may (and often do) contain bugs.

If you are using these CVS snapshots, the base package named above will usually not be in sync with the recent code and you have to download the most recent developer’s version from

We suggest downloading this package fgfs_base-snap.X.X.X.tar.gz to a temporary directory. Now, decompress it using

tar xvfz fgfs_base-snap.X.X.X.tar.gz.

Finally, double-check you got the directory structure named above.