Building FlightGear - Devuan

Revision as of 23:51, 7 July 2018 by Flughund (talk | contribs) (update on dependencies: libqt5svg5-dev)

HowTo build FlightGear Stable (2018.2) or bleeding edge development version, hereinafter simply called Next, on Devuan GNU/Linux Stable (Ascii). Users of Testing or Unstable at least have to change package names (version numbering) accordingly.
Instructions probably apply on Debian GNU/Linux Stretch, too.

The meaning of this article is to be a short, checklist like, overview of the specific steps to compile FlightGear and components on Debian. For more detailed information please refer to the main article Building FlightGear on Linux.

If you don't want to get your hands dirty, have a look at Scripted Compilation on Linux Debian/Ubuntu.

Zeichen 144 icon.png For beginners with compiling it is highly recommended to follow this guide step by step. Any modification to most of the here used commands will cause trouble.


Requirements and Preparations

A bunch of packages (as well as some of their dependencies) are required to compile FlightGear:

Tools
su -c "apt-get install cmake g++ gcc git make sed"


Dependencies
su -c "apt-get install  \
  freeglut3-dev       libboost-dev   libcurl4-openssl-dev   libdbus-1-dev \
  libfreetype6-dev    libglew-dev    libopenal-dev  libopenscenegraph-dev \
  libqt5opengl5-dev   libqt5svg5-dev libxi-dev      libxmu-dev \
  pkg-config          qml-module-qtquick2           qml-module-qtquick-window2 \
  qt5-default         qtbase5-private-dev           qtdeclarative5-private-dev"
If you prefer you might replace "libcurl4-openssl-dev" by "libcurl4-gnutls-dev".
  During installation development packages of libraries which are going to be compiled must not be installed. They can safely be re-installed after compilation. Namely these are "libplib-dev" and "simgear-dev".


Build and install

Because we are going to install versions different to the ones in the Debian repositories, it is recommended to install FlightGear in a place independent of the base system, such as /usr/local/FG-Stable or $HOME/FG-Stable. This way also has the advantage of easily managing several FlightGear versions, even with different versions of OpenSceneGraph and/or plib, simply by altering the installation prefix. I suggest to make this directory writeable by the user so there is no need to become root for the make commands. We'll use $FG_INSTALL_DIR as a placeholder for this directory.
Another placeholder will be $FG_SRC_DIR, it stands for the absolute path to the directory which is supposed to keep the folders of the various source codes. So, in the instructions below, you have to replace these with the local paths or even export them (in every terminal you're using them) for the process:

export FG_INSTALL_DIR=$HOME/FG-Stable && mkdir $FG_INSTALL_DIR
export FG_SRC_DIR=$HOME/src && mkdir $FG_SRC_DIR

Have in mind that the data is a relatively large download (GIT about 2.3 GiB (required disk space 4 GiB) / Stable about 1.5 GiB). So, to save some time, it is a good idea to fetch it while building the sources.
For some basic info on git commands for FlightGear users we have a git for laymen section.

For more/advanced cmake options and SimGear's and FlightGear's optional features see the cmake article.

  Do not mix instructions for Stable and Next! Not even for fgdata, mixing versions will almost certainly break the installation.


plib

Stable and Next:
While just installing package "libplib-dev" should work, it's recommended to build it from source.

cd $FG_SRC_DIR
git clone git://git.code.sf.net/p/libplib/code libplib.git
cd libplib.git
echo "1.8.6" > version
sed s/PLIB_TINY_VERSION\ \ 5/PLIB_TINY_VERSION\ \ 6/ -i src/util/ul.h
git commit --all --message "Increase tiny version to 6."
mkdir $FG_SRC_DIR/build-plib && cd $FG_SRC_DIR/build-plib
cmake -D CMAKE_INSTALL_PREFIX:PATH="$FG_INSTALL_DIR" $FG_SRC_DIR/libplib.git
make -j$(nproc) && make install


SimGear

Stable and Next:

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

Stable only:

cd simgear.git
git checkout release/2018.2

Stable and Next:

mkdir $FG_SRC_DIR/build-sg && cd $FG_SRC_DIR/build-sg
cmake CFLAGS="--std=c++11" -D CMAKE_INSTALL_PREFIX:PATH="$FG_INSTALL_DIR" \
      $FG_SRC_DIR/simgear.git
make -j$(nproc) && make install


FlightGear source

Stable and Next:

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

Stable only:

cd flightgear.git
git checkout release/2018.2

Stable and Next:

mkdir $FG_SRC_DIR/build-fg && cd $FG_SRC_DIR/build-fg
cmake CFLAGS="--std=c++11" -D FG_DATA_DIR:PATH="$FG_INSTALL_DIR/share/fgdata" \
      -D CMAKE_INSTALL_PREFIX:PATH="$FG_INSTALL_DIR" $FG_SRC_DIR/flightgear.git
make -j$(nproc) && make install


FlightGear data

Stable and Next:

mkdir -p $FG_INSTALL_DIR/share && cd $FG_INSTALL_DIR/share
git clone git://git.code.sf.net/p/flightgear/fgdata fgdata

Stable only:

cd fgdata
git checkout release/2018.2


Trial run and finishing process

When all the builds are done and the data download has finished it is time for a test run:

export LD_LIBRARY_PATH=$FG_INSTALL_DIR/lib/:$LD_LIBRARY_PATH
$FG_INSTALL_DIR/bin/fgfs --launcher
The fgfs binary needs to find our self compiled libraries at runtime and therefore we have to tell the linker (ld) where to find them. That is what the first line here does. You might want to add this line to your $HOME/.bashrc to have this as a persistent setting (may cause problems, if one has installed more than one version of FlightGear!).
Have in mind, the $FG_INSTALL_DIR and $FG_SRC_DIR variables are available for this session only. For future use of these lines, replace them by the real paths.

To avoid the need to give the path to the fgfs command each time, you might consider to create a symlink at a place that is listed in $PATH:

ln -s $FG_INSTALL_DIR/bin/fgfs $HOME/bin/fgfs