Building FlightGear - Linux

From FlightGear wiki
Revision as of 12:14, 31 December 2017 by Hooray (talk | contribs) (→‎Requirements)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

1rightarrow.png See Building Flightgear for the main article about this subject.

WIP.png Work in progress
This article or section will be worked on in the upcoming hours or days.
See history for the latest developments.

This section describes how to build FlightGear on Linux system.

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.

openSUSE also provides binary packages of the latest development version, which are continuously updated. Follow this link to select your openSUSE version and install, or manually add games:FlightGear:Unstable to your YaST Software Repositories.

For Ubuntu, there is a PPA that provides the latest development version of FlightGear and SimGear and a recent version of FlightGear data. See this page for more info. To add the PPA, run sudo apt-add-repository ppa:saiarcot895/flightgear-edge.

Or if you develop on Ubuntu or Debian, consider trying the script described in Scripted Compilation on Linux Debian/Ubuntu.

Distro-specific instructions

Debian/Ubuntu

Gentoo

Requirements

Note  as of 12/2017, people may have to build using at least OSG 3.4 due to some compilation issues -for details, refer to Howto:Building FlightGear without HiDPI support

Edit 12/9/15 - These instructions are out of date! Do not use for compiling.

Before you can compile FlightGear, you need to have the following installed on your computer:

C++ compiler

These are: c++, cpp, gcc, g++ found under the /usr/bin directory. You will also need to have the tools autoconf and automake1.9 installed.

GIT

See FlightGear and Git.

OpenGL support

More specifically, your system needs the support for hardware accelerated graphics. You can check for this by running the following in a command line:

$ glxinfo | grep direct

Note: To run the above command, you need to have the tool mesa-utils installed.

You should then see:

direct rendering: Yes

This means you are good to go as far as OpenGL support is concerned.

If you see:

direct rendering: No

Don't panic yet. This may just mean some required libraries for hardware accelerated graphic are missing. Go ahead and try installing plib 1.8.5 and its dependencies first. If you still get the above message, then you will need to do some googling and troubleshoot yourself.

Dependencies

FlightGear is dependent on quite a few number of libraries. You do not need to compile all of them yourself, but you will at least need to have their development version installed. For example, the development version for package plib1.8.5 is plib1.8.5-dev.

The dependency is summarized in the following tree. Please note that each library has its own dependencies, and most of these are not shown here.

  • FlightGear
    • OpenAL
    • SimGear
      • PLIB. Since March 2008, you will need version 1.8.5 - your distro probably supplies 1.8.4 still.
      • OpenSceneGraph (check link for compatible versions)
      • You also need the development files for several basic libraries to build the software, among them the following (the package names are for Debian and derivatives(?)):
        • libfreetype6-dev
        • libjpeg62-dev
        • libungif4-dev
        • libtiff4-dev
        • libpng12-dev
        • libxmu-dev
        • libxi-dev
        • zlib1g-dev
        • libglut3-dev

If you attack the above dependencies in the order listed below, you should be good:

  1. glut Most distributions include glut packages, although you may have to hunt for them. Make sure you install both the glut and glut-devel packages, otherwise FlightGear may be able to compile but won't run correctly.
  2. zlib Most distributions install the basic zlib libraries by default, but not the development portions. If you don't have zlib.h, you probably need to install the zlib-devel package for your distribution.
  3. plib Portability libraries and scene graph.
  4. OpenSceneGraph
  5. simgear Simulation support libraries. If you are building FlightGear from Git, you need the Git version of SimGear. If you have strange build errors, one of the first things to check is that you have an up-to-date version of SimGear built and installed.

Compiling

Assuming you are root, do:

# cd /usr/local/src

Note: When tracking a fast changing software like FlightGear/Git it is highly advisable to install it in a separate directory. That way one can also easily build and reinstall without being root, which greatly reduces the risk of messing up one's system. To install in a directory of your choice add the --prefix argument to configure. E.g. ./configure --prefix=$HOME/FlightGear. I would recommend installing all of OSG, plib, SimGear and FlightGear with the same prefix.

Getting and compiling SimGear

Step 1:

Clone the SimGear git repository and set it up to track the 'next' branch.

$ git clone git://git.code.sf.net/p/flightgear/simgear simgear

or if the git port is firewalled on you network, use the http transport

$ git clone http://git.code.sf.net/p/flightgear/simgear simgear

By default after cloning you should have a local next branch that tracks the master next branch. It can be updated it with git pull.

Step 2:

The source code will be downloaded into a directory called simgear.

Next, go into the directory and make preparations for the compilation:

$ cd simgear
$ cmake .

Note that if you don't want to install simgear globally on the system but in a specific directory, you can do so by adding -DCMAKE_INSTALL_PREFIX=/path/to/your/fgInstallation to the cmake command

Step 3:

Compile and install SimGear by doing:

$ make; make install

Note: with gcc 4.2 or later,on some platforms, you can get compiling errors about alc.h like:

'<anonymous>' has incomplete type 

take a look at http://bugs.gentoo.org/166723

Getting and compiling FlightGear

Step 1:

Clone the FlightGear git repository and set it up to track the 'next' branch.

$ git clone git://git.code.sf.net/p/flightgear/flightgear

By default after cloning you should have a local next branch that tracks the master next branch. It can be updated it with git pull.

Step 2:

Next, go into the folder and make preparations for the compilation:

$ cd flightgear
$ ./autogen.sh
$ ./configure

Note that if you don't want to install simgear globally on the system but in a specific directory, you can do so by adding --prefix=/path/to/your/fgInstallation to the ./configure command. If you didn't install OSG globally or in the same prefix as SimGear and FlightGear, you have to pass the OSG directory to the configure-command like this:

$ ./configure --prefix=/path/to/fgInstallation --with-osg=/path/to/osg/installation --enable-osgviewer

In this case you have to tell your system where to find the OSG libraries before you can run flightgear:

$ export LD_LIBRARY_PATH=/path/to/osgInstallation/lib:$LD_LIBRARY_PATH

Step 3:

Now you can compile and install Flightgear by:

$ make; make install

Step 4:

Clone the data directory:

$ git clone git://git.code.sf.net/p/flightgear/fgdata

The data directory is large (almost 2.5GB) so it will take considerable time to download. There mirror of fgdata that might be faster to download from:

$ git clone git://mapserver.flightgear.org/fgdata

The mirror is synchronized with the master so either will do.

And install it in (or as) /usr/local/share/FlightGear

$ mv fgdata /usr/local/share/flightgear

External links

Instructions

Important note for GIT users

As of latest development in GIT, only cmake is now required for building both SimGear and FlightGear. So if you build GIT (for what any reason) please don't try to use autogen.sh as it is removed from repository.

For detailed instructions, see page Building using cmake.