User:Daemonburrito/Building FlightGear - Linux

From FlightGear wiki
< User:Daemonburrito
Revision as of 05:48, 10 May 2014 by Daemonburrito (talk | contribs) (→‎Compiling: Out-of-source explanation and link to cmake wiki.)
Jump to navigation Jump to search

Compiling

Flightgear, Simgear, and OpenSceneGraph now use cmake. See the CMake wiki for additional documentation.

CMake allows users to create "out-of-source" builds, which means build files are created in a separate directory, and many variants can be maintained. To use out-of-source builds, simply create a new directory and pass the path to source to cmake.

Example "out-of-source" build with CMake

simgear $ mkdir ../build.simgear
simgear $ cd ../build.simgear
build.simgear $ cmake ../simgear

After CMake has run, you can make && make install.

Getting and compiling SimGear

Step 1:

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

$ git clone git://gitorious.org/fg/simgear.git

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

$ git clone http://gitorious.org/fg/simgear.git

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://gitorious.org/fg/flightgear.git

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://gitorious.org/fg/fgdata.git

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