Building FlightGear - Linux: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(change case on fgdata path)
No edit summary
 
(45 intermediate revisions by 16 users not shown)
Line 4: Line 4:


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.
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 [http://software.opensuse.org/download.html?lang=en&project=games:FlightGear:Unstable&package=fgrun 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 [https://launchpad.net/~saiarcot895/+archive/flightgear-edge this page] for more info. To add the PPA, run <tt>sudo apt-add-repository ppa:saiarcot895/flightgear-edge</tt>.


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


== Requirements ==
= Distro-specific instructions =
== Debian/Ubuntu ==
* You can use the [[Scripted Compilation on Linux Debian/Ubuntu]] script to have FlightGear compiled in one shot under both Ubuntu and Debian systems.
* Debian users who prefer to build it without script may look at [[Building Flightgear - Debian]].
* Ubuntu users can follow these instructions to build FlightGear on [[Building Flightgear - Ubuntu | Ubuntu]].
* Raspbian users can follow these instructions to build FlightGear on [[Building Flightgear - Raspbian | Raspbian Buster]].
* Hints for [[Ubuntu]] users.
 
== Gentoo ==
* Gentoo users can also use overlays to build FlightGear without much hassle: [[Building Flightgear - Gentoo]].
 
== CentOS ==
CentOS users can follow these instructions to build FlightGear on [[Building Flightgear - CentOS | CentOS 8]].
 
= 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]]}}
 
Before you can compile FlightGear, you need to have the following installed on your computer:
Before you can compile FlightGear, you need to have the following installed on your computer:


'''C++ compiler'''
'''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.
These are: c++, g++ found under the <code>/usr/bin</code> directory.  You will also need to have the tools '''CMake''' installed.


'''GIT'''
'''GIT'''
Line 22: Line 43:
More specifically, your system needs the support for hardware accelerated graphics.  You can check for this by running the following in a [[command line]]:
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
<syntaxhighlight lang="bash">
$ glxinfo | grep direct
</syntaxhighlight>


Note: To run the above command, you need to have the tool '''mesa-utils''' installed.
Note: To run the above command, you need to have the tool '''mesa-utils''' installed.
Line 36: Line 59:
  direct rendering: No
  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.
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 ==
= 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'''.
 
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 <tt>plib1.8.5</tt> is <tt>plib1.8.5</tt>'''-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.
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
* <tt>FlightGear</tt>
** [http://kcat.strangesoft.net/openal.html OpenAL]
** [https://openal.org<tt>OpenAL</tt>]
** SimGear
** <tt>SimGear</tt>
*** [http://plib.sourceforge.net/ PLIB]. Since march 2008, you will need version 1.8.5 - your distro probably supplies 1.8.4 still.
*** [http://plib.sourceforge.net/ <tt>PLIB</tt>]. Since March 2008, you will need version 1.8.5 - your distro probably supplies 1.8.4 still.
**** For versions pre march/2008: (Free)GLUT or SDL (We recommend the use of SDL over Free/GLUT, [http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg16153.html however since march 2008, FreeGLUT as well as SDL are both considered depreciated, please only use --enable-osgviewer during configuration instead])  
**** For versions pre March 2008: (Free)<tt>GLUT</tt> or <tt>SDL</tt> (We recommend the use of <tt>SDL</tt> over <tt>Free/GLUT</tt>, [http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg16153.html however since March 2008, <tt>FreeGLUT</tt> as well as <tt>SDL</tt> are both considered deprecated], please only use <code>--enable-osgviewer</code> during configuration instead)  
***  [[OpenSceneGraph]]  (check link for compatible versions)
***  <tt>[[OpenSceneGraph]]</tt> (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(?)):
*** 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
**** <tt>libfreetype6-dev</tt>
**** libjpeg62-dev
**** <tt>libjpeg62-dev</tt>
**** libungif4-dev
**** <tt>libungif4-dev</tt>
**** libtiff4-dev
**** <tt>libtiff4-dev</tt>
**** libpng12-dev
**** <tt>libpng12-dev</tt>
**** libxmu-dev
**** <tt>libxmu-dev</tt>
**** libxi-dev
**** <tt>libxi-dev</tt>
**** zlib1g-dev
**** <tt>zlib1g-dev</tt>
**** libglut3-dev
**** <tt>libglut3-dev</tt>


If you attack the above dependencies in the order listed below, you should be good:
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.
# <tt>glut</tt> Most distributions include glut packages, although you may have to hunt for them. Make sure you install both the <tt>glut</tt> and <tt>glut-devel</tt> packages, otherwise FlightGear may be able to compile but won't run correctly.
 
# <tt>zlib</tt> Most distributions install the basic <tt>zlib</tt> libraries by default, but not the development portions. If you don't have <tt>zlib.h</tt>, you probably need to install the <tt>zlib-devel</tt> package for your distribution.  
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.  
# <tt>plib</tt> Portability libraries and scene graph.  
 
# <tt>[[OpenSceneGraph]]</tt>
3. Plib - portability libraries and scene graph.  
# <tt>simgear</tt> 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.
 
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.
 
==== APT-GET List ====
This is a list of all the apt-get commands I had to do while compiling FG, SG, and OSG on a mostly clean Ubuntu 64 system. It is a list of all the libraries you and your computer needs to compile FG, SG, OSG, and PLib. All you have to do is copy the full command, paste it in Terminal, enter your password, and it will download all the packages for you, and install them too. The full command is at the bottom, and I hope someone finds it useful :) sub-dependencies (dependencies of the dependencies) are not included as they are installed automatically by apt-get. If anyone sees something missing, please add it.
git - to get SG and FG <br />
subversion - to get OSG <br />
build-essential - to build (includes GCC, and other build tools) <br />
cmake - OSG Uses this <br />
cmake-curses-gui -- OSG Uses this <br />
libpng-dev - to enable FG to use PNG textures<br />
libfreetype6-dev - fonts<br />
libjpeg-dev<br />
libungif4-dev<br />
libtiff-dev<br />
libxmu-dev<br />
libxi-dev<br />
libglut3-dev<br />
libalut-dev - sound<br />
libboost-dev - makes coding for some developers easier<br />
automake - needed by ./autogen.sh files<br />
autoconf - needed by ./autogen.sh files<br />
libfltk1.1-dev - You will need this if you will be using FGRun<br />
-----------
<pre>
sudo apt-get install git subversion build-essential cmake cmake-curses-gui libpng-dev libfreetype6-dev
libjpeg-dev libungif4-dev libtiff-dev libxmu-dev libxi-dev libglut3-dev libalut-dev
libboost-dev automake autoconf libfltk1.1-dev
</pre>
-----------
Total size is about 230 MB, depending on what you already have from other applications.
 
This list might seem a bit short, but the sub-dependencies all add up :) The dependencies will be listed by apt-get when you use the command.
-----------
NOTE: On a Linux Mint 9 (Ubuntu 10.04) system this is the command I used:
<pre>
sudo apt-get install git-core subversion build-essential cmake cmake-curses-gui libpng-dev libfreetype6-dev libjpeg-dev libungif4-dev libtiff-dev libxmu-dev libxi-dev libglut3-dev libalut-dev libboost-dev automake autoconf libfltk1.1-dev libplib-dev libopenscenegraph-dev
</pre>
libopenscenegraph-dev
You just need to copy that long line into a terminal and you should have all the packages you need to compile Flighgear and Simgear.
 
== 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.
= Compiling =
To install in a directory of your choice add the <tt>--prefix</tt> argument to configure. E.g. <tt>./configure --prefix=$HOME/FlightGear</tt>. I would recommend installing all of OSG, plib, SimGear and FlightGear with the same prefix.


=== Getting and compiling SimGear ===
== Definitions ==
The following environment variables must be set because they will be used in shell commands:
* <code>NR_JOBS</code>: Number of jobs for parallel compilation. For example: <code>NR_JOBS=$(/usr/bin/nproc)</code>.
* <code>FGFS_PREFIX</code>: Prefix of the FlightGear installation. For example: <code>FGFS_PREFIX=${HOME}/FlightGear</code>. All the source code must be located under the directory <code>${FGFS_PREFIX}/src</code> and the installation will be done under the directory <code>${FGFS_PREFIX}</code> as <code>${FGFS_PREFIX}/bin</code>, <code>${FGFS_PREFIX}/include</code>, <code>${FGFS_PREFIX}/lib</code>,...
* <code>cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo</code> can be replaced by <code>cmake -DCMAKE_BUILD_TYPE=Release</code> for better performances.
* <code>FGFS_PREFIX_LIB</code>: The default <code>lib</code> directory is different between RedHat and Debian based distributions. Usually on Debian based distributions
FGFS_PREFIX_LIB=${FGFS_PREFIX}/lib
Usually on RedHat based distributions
FGFS_PREFIX_LIB=${FGFS_PREFIX}/lib64


'''Step 1:'''
== SimGear ==
The source code of SimGear can be provided:
* as an official release that can be downloaded from [https://sourceforge.net/projects/flightgear/files/ here]. The environment variable <code>SIMGEAR_VERSION</code> must be set to the relevant version of SimGear, for example <code>SIMGEAR_VERSION=2019.1.1</code> and then using the following commands to extract the source code:


Clone the SimGear git repository and set it up to track the 'next' branch.
cd -- "${FGFS_PREFIX}/src/"
  git clone git://gitorious.org/fg/simgear.git
  SIMGEAR_SRC=${FGFS_PREFIX}/src/simgear-${SIMGEAR_VERSION}
rm -Rf -- "${SIMGEAR_SRC}/"
tar axvf "${FGFS_PREFIX}/src/simgear-${SIMGEAR_VERSION}.tar.bz2"


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.
* as a clone of the SimGear Git repo by using the following commands:


'''Step 2:'''
cd -- "${FGFS_PREFIX}/src/"
git clone https://git.code.sf.net/p/flightgear/simgear flightgear-simgear
SIMGEAR_SRC=${FGFS_PREFIX}/src/flightgear-simgear


The source code will be downloaded into a directory called '''simgear'''.
* if you have already a clone of the SimGear Git repo, the local copy can be updated using the following commands:


Next, go into the directory and make preparations for the compilation:
cd -- "${FGFS_PREFIX}/src/"
  cd simgear
  SIMGEAR_SRC=${FGFS_PREFIX}/src/flightgear-simgear
  ./autogen.sh
  pushd -- "${SIMGEAR_SRC}/"
  ./configure
  git pull
popd


'''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
Now that the source code of SimGear is available under the directory <code>${SIMGEAR_SRC}</code>, the build can be started using the following commands:


'''Step 3:'''
cd -- "${FGFS_PREFIX}/src/"
rm -Rf -- "${FGFS_PREFIX}/src/sg_build/"
mkdir -- "${FGFS_PREFIX}/src/sg_build/"
pushd -- "${FGFS_PREFIX}/src/sg_build/"
cmake "${SIMGEAR_SRC}" \
      -DCMAKE_BUILD_TYPE=RelWithDebInfo \
      -DCMAKE_INSTALL_PREFIX="${FGFS_PREFIX}" \
      -DCMAKE_VERBOSE_MAKEFILE=TRUE
make --jobs=${NR_JOBS}
make -- test
make -- install
popd
rm -Rf -- "${FGFS_PREFIX}/src/sg_build/"


Compile and install SimGear by doing:
== FlightGear ==
  make; make install
The data for FlightGear can be provided:
* as an official release that can be downloaded from [https://sourceforge.net/projects/flightgear/files/ here].
rm -f -- "${FGFS_PREFIX_LIB}/FlightGear"
rm -Rf -- "${FGFS_PREFIX_LIB}/FlightGear-${FLIGHTGEAR_VERSION}/"
mkdir --parents -- "${FGFS_PREFIX_LIB}/FlightGear-${FLIGHTGEAR_VERSION}/"
pushd -- "${FGFS_PREFIX_LIB}/FlightGear-${FLIGHTGEAR_VERSION}/"
tar axvf "${FGFS_PREFIX}/src/FlightGear-${FLIGHTGEAR_VERSION}-data.tar.bz2"
popd
pushd -- "${FGFS_PREFIX_LIB}/"
ln --symbolic -- "FlightGear-${FLIGHTGEAR_VERSION}/fgdata/" FlightGear
  popd


* as a clone of the FlightGear Git repo by using the following commands:


''Note:'' with gcc 4.2 or later,on some platforms, you can get compiling errors about alc.h like:
pushd -- "${FGFS_PREFIX_LIB}/"
git clone --depth 1 https://git.code.sf.net/p/flightgear/fgdata flightgear-fgdata
ln --symbolic -- "flightgear-fgdata/" FlightGear
popd


'<anonymous>' has incomplete type
* if you have already a clone of the FlightGear Git repo, the local copy can be updated using the following commands:
take a look at http://bugs.gentoo.org/166723


=== Getting and compiling FlightGear ===
pushd -- "${FGFS_PREFIX_LIB}/flightgear-fgdata/"
git pull
popd


'''Step 1:'''
The source code of FlightGear can be provided:
* as an official release that can be downloaded from [https://sourceforge.net/projects/flightgear/files/ here]. The version of SimGear and FlightGear must match. The environment variable <code>FLIGHTGEAR_VERSION</code> must be set to the relevant version of FlightGear, for example <code>FLIGHTGEAR_VERSION=2019.1.1</code> and then using the following commands to extract the source code:


Clone the FlightGear git repository and set it up to track the 'next' branch.
cd -- "${FGFS_PREFIX}/src/"
  git clone git://gitorious.org/fg/flightgear.git
  FLIGHTGEAR_SRC=${FGFS_PREFIX}/src/flightgear-${FLIGHTGEAR_VERSION}
rm -Rf -- "${FLIGHTGEAR_SRC}/"
tar axvf "${FGFS_PREFIX}/src/flightgear-${FLIGHTGEAR_VERSION}.tar.bz2"


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.
* as a clone of the FlightGear Git repo by using the following commands:


'''Step 2:'''
cd -- "${FGFS_PREFIX}/src/"
git clone https://git.code.sf.net/p/flightgear/flightgear flightgear-flightgear
FLIGHTGEAR_SRC=${FGFS_PREFIX}/src/flightgear-flightgear


Next, go into the folder and make preparations for the compilation:
* if you have already a clone of the FlightGear Git repo, the local copy can be updated using the following commands:
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.
cd -- "${FGFS_PREFIX}/src/"
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:
  FLIGHTGEAR_SRC=${FGFS_PREFIX}/src/flightgear-flightgear
  ./configure --prefix=/path/to/fgInstallation --with-osg=/path/to/osg/installation --enable-osgviewer
pushd -- "${FLIGHTGEAR_SRC}/"
In this case you have to tell your system where to find the OSG libraries before you can run flightgear:
git pull
  export LD_LIBRARY_PATH=/path/to/osgInstallation/lib:$LD_LIBRARY_PATH
popd


'''Step 3:'''
Now that the source code of FlightGear is available under the directory <code>${FLIGHTGEAR_SRC}</code>, the build can be started using the following commands:


Now you can compile and install Flightgear by:
cd -- "${FGFS_PREFIX}/src/"
  make; make install
rm -Rf -- "${FGFS_PREFIX}/src/fg_build/"
mkdir -- "${FGFS_PREFIX}/src/fg_build/"
pushd -- "${FGFS_PREFIX}/src/fg_build/"
cmake "${FLIGHTGEAR_SRC}" \
      -DCMAKE_BUILD_TYPE=RelWithDebInfo \
      -DCMAKE_INSTALL_PREFIX="${FGFS_PREFIX}" \
      -DCMAKE_VERBOSE_MAKEFILE=TRUE \
      -DENABLE_FGQCANVAS=ON
make --jobs=${NR_JOBS}
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${FGFS_PREFIX_LIB}/
FG_ROOT=${FGFS_PREFIX_LIB}/FlightGear make --jobs=${NR_JOBS} -- test_suite
  FG_ROOT=${FGFS_PREFIX_LIB}/FlightGear make -- test
make -- install
popd
rm -Rf -- "${FGFS_PREFIX}/src/fg_build/"


'''Step 4:'''
= External links =
 
== Instructions ==
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
 
== Distro-specific instructions ==
=== Debian/Ubuntu ===
* You can use the [[Scripted Compilation on Linux Debian/Ubuntu]] script to have Flightgear compiled in one shot under both Ubuntu and Debian systems.
* Debian users who prefer to build it without script may look at [[Building Flightgear - Debian]].
=== Gentoo ===
* Gentoo users can also use overlays to build FlightGear without much hassle: [[Building Flightgear - Gentoo]].
 
== External links ==
=== Instructions ===
*  [[MSYS]]  
*  [[MSYS]]  
*  [[MinGW/cross-compiler]]  
*  [[MinGW/cross-compiler]]  
Line 206: Line 219:
* [http://www.oflebbe.de/oflebbe/FlightGear/index.html MSVC8 aka Visual 2005]
* [http://www.oflebbe.de/oflebbe/FlightGear/index.html MSVC8 aka Visual 2005]
* [http://macflightgear.sourceforge.net/home/documents/ Mac OS X]
* [http://macflightgear.sourceforge.net/home/documents/ Mac OS X]
= 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|Building using cmake]].


{{Building}}
{{Building}}
[[fr:Compiler FlightGear sous GNU/Linux]]

Latest revision as of 22:18, 29 January 2021

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

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

CentOS

CentOS users can follow these instructions to build FlightGear on CentOS 8.

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

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

C++ compiler

These are: c++, g++ found under the /usr/bin directory. You will also need to have the tools CMake 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

Definitions

The following environment variables must be set because they will be used in shell commands:

  • NR_JOBS: Number of jobs for parallel compilation. For example: NR_JOBS=$(/usr/bin/nproc).
  • FGFS_PREFIX: Prefix of the FlightGear installation. For example: FGFS_PREFIX=${HOME}/FlightGear. All the source code must be located under the directory ${FGFS_PREFIX}/src and the installation will be done under the directory ${FGFS_PREFIX} as ${FGFS_PREFIX}/bin, ${FGFS_PREFIX}/include, ${FGFS_PREFIX}/lib,...
  • cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo can be replaced by cmake -DCMAKE_BUILD_TYPE=Release for better performances.
  • FGFS_PREFIX_LIB: The default lib directory is different between RedHat and Debian based distributions. Usually on Debian based distributions
FGFS_PREFIX_LIB=${FGFS_PREFIX}/lib

Usually on RedHat based distributions

FGFS_PREFIX_LIB=${FGFS_PREFIX}/lib64

SimGear

The source code of SimGear can be provided:

  • as an official release that can be downloaded from here. The environment variable SIMGEAR_VERSION must be set to the relevant version of SimGear, for example SIMGEAR_VERSION=2019.1.1 and then using the following commands to extract the source code:
cd -- "${FGFS_PREFIX}/src/"
SIMGEAR_SRC=${FGFS_PREFIX}/src/simgear-${SIMGEAR_VERSION}
rm -Rf -- "${SIMGEAR_SRC}/"
tar axvf "${FGFS_PREFIX}/src/simgear-${SIMGEAR_VERSION}.tar.bz2"
  • as a clone of the SimGear Git repo by using the following commands:
cd -- "${FGFS_PREFIX}/src/"
git clone https://git.code.sf.net/p/flightgear/simgear flightgear-simgear
SIMGEAR_SRC=${FGFS_PREFIX}/src/flightgear-simgear
  • if you have already a clone of the SimGear Git repo, the local copy can be updated using the following commands:
cd -- "${FGFS_PREFIX}/src/"
SIMGEAR_SRC=${FGFS_PREFIX}/src/flightgear-simgear
pushd -- "${SIMGEAR_SRC}/"
git pull
popd

Now that the source code of SimGear is available under the directory ${SIMGEAR_SRC}, the build can be started using the following commands:

cd -- "${FGFS_PREFIX}/src/"
rm -Rf -- "${FGFS_PREFIX}/src/sg_build/"
mkdir -- "${FGFS_PREFIX}/src/sg_build/"
pushd -- "${FGFS_PREFIX}/src/sg_build/"
cmake "${SIMGEAR_SRC}" \
      -DCMAKE_BUILD_TYPE=RelWithDebInfo \
      -DCMAKE_INSTALL_PREFIX="${FGFS_PREFIX}" \
      -DCMAKE_VERBOSE_MAKEFILE=TRUE
make --jobs=${NR_JOBS}
make -- test
make -- install
popd
rm -Rf -- "${FGFS_PREFIX}/src/sg_build/"

FlightGear

The data for FlightGear can be provided:

  • as an official release that can be downloaded from here.
rm -f -- "${FGFS_PREFIX_LIB}/FlightGear"
rm -Rf -- "${FGFS_PREFIX_LIB}/FlightGear-${FLIGHTGEAR_VERSION}/"
mkdir --parents -- "${FGFS_PREFIX_LIB}/FlightGear-${FLIGHTGEAR_VERSION}/"
pushd -- "${FGFS_PREFIX_LIB}/FlightGear-${FLIGHTGEAR_VERSION}/"
tar axvf "${FGFS_PREFIX}/src/FlightGear-${FLIGHTGEAR_VERSION}-data.tar.bz2"
popd
pushd -- "${FGFS_PREFIX_LIB}/"
ln --symbolic -- "FlightGear-${FLIGHTGEAR_VERSION}/fgdata/" FlightGear
popd
  • as a clone of the FlightGear Git repo by using the following commands:
pushd -- "${FGFS_PREFIX_LIB}/"
git clone --depth 1 https://git.code.sf.net/p/flightgear/fgdata flightgear-fgdata
ln --symbolic -- "flightgear-fgdata/" FlightGear
popd
  • if you have already a clone of the FlightGear Git repo, the local copy can be updated using the following commands:
pushd -- "${FGFS_PREFIX_LIB}/flightgear-fgdata/"
git pull
popd

The source code of FlightGear can be provided:

  • as an official release that can be downloaded from here. The version of SimGear and FlightGear must match. The environment variable FLIGHTGEAR_VERSION must be set to the relevant version of FlightGear, for example FLIGHTGEAR_VERSION=2019.1.1 and then using the following commands to extract the source code:
cd -- "${FGFS_PREFIX}/src/"
FLIGHTGEAR_SRC=${FGFS_PREFIX}/src/flightgear-${FLIGHTGEAR_VERSION}
rm -Rf -- "${FLIGHTGEAR_SRC}/"
tar axvf "${FGFS_PREFIX}/src/flightgear-${FLIGHTGEAR_VERSION}.tar.bz2"
  • as a clone of the FlightGear Git repo by using the following commands:
cd -- "${FGFS_PREFIX}/src/"
git clone https://git.code.sf.net/p/flightgear/flightgear flightgear-flightgear
FLIGHTGEAR_SRC=${FGFS_PREFIX}/src/flightgear-flightgear
  • if you have already a clone of the FlightGear Git repo, the local copy can be updated using the following commands:
cd -- "${FGFS_PREFIX}/src/"
FLIGHTGEAR_SRC=${FGFS_PREFIX}/src/flightgear-flightgear
pushd -- "${FLIGHTGEAR_SRC}/"
git pull
popd

Now that the source code of FlightGear is available under the directory ${FLIGHTGEAR_SRC}, the build can be started using the following commands:

cd -- "${FGFS_PREFIX}/src/"
rm -Rf -- "${FGFS_PREFIX}/src/fg_build/"
mkdir -- "${FGFS_PREFIX}/src/fg_build/"
pushd -- "${FGFS_PREFIX}/src/fg_build/"
cmake "${FLIGHTGEAR_SRC}" \
      -DCMAKE_BUILD_TYPE=RelWithDebInfo \
      -DCMAKE_INSTALL_PREFIX="${FGFS_PREFIX}" \
      -DCMAKE_VERBOSE_MAKEFILE=TRUE \
      -DENABLE_FGQCANVAS=ON
make --jobs=${NR_JOBS}
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${FGFS_PREFIX_LIB}/
FG_ROOT=${FGFS_PREFIX_LIB}/FlightGear make --jobs=${NR_JOBS} -- test_suite
FG_ROOT=${FGFS_PREFIX_LIB}/FlightGear make -- test
make -- install
popd
rm -Rf -- "${FGFS_PREFIX}/src/fg_build/"

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.