Building FlightGear - Devuan: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Update for 2018.3.2 (OSG v3.4.1))
(Complete overhaul; new system for handling FlightGear versions; updated for 2019.1)
Line 1: Line 1:
HowTo build [[FlightGear]] <u>Stable</u> ([[Changelog_2018.3|2018.3]]) or bleeding edge development version, hereinafter simply called <u>[[FlightGear_Git#Repositories_and_branches | Next]]</u>, on [https://devuan.org/ Devuan] GNU/Linux Stable (ASCII). Users of Testing or Unstable at least have to change package names (version numbering) accordingly.<br />
HowTo build [[FlightGear]] on [https://devuan.org/ Devuan] GNU/Linux Stable (ASCII). Instructions probably apply to [https://debian.org/ Debian] GNU/Linux Stretch, too.
Instructions probably apply on [https://debian.org/ 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_-_Linux | Building FlightGear on Linux]].
The meaning of this article is to be a short, ''checklist'' like, overview of the specific steps to compile FlightGear and components on Devuan. For more detailed information please refer to the main article [[Building_FlightGear_-_Linux | Building FlightGear on Linux]].


[[File:Zeichen_144_icon.png|21px]] 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.
[[File:Zeichen_144_icon.png|21px]] 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.
Line 10: Line 9:
A bunch of packages (as well as some of their dependencies) are required to compile FlightGear:
A bunch of packages (as well as some of their dependencies) are required to compile FlightGear:


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




; Dependencies
'''Dependencies'''
  su -c "apt-get install \
  su -c "apt-get install \
   freeglut3-dev          libopenscenegraph-dev  qml-module-qtquick-window2 \
   freeglut3-dev          qml-module-qtquick-window2 \
   libboost-dev          libqt5opengl5-dev      qt5-default \
   libboost-dev          libqt5opengl5-dev      qt5-default \
   libcurl4-openssl-dev  libqt5svg5-dev          qtbase5-private-dev \
   libcurl4-openssl-dev  libqt5svg5-dev          qtbase5-private-dev \
   libdbus-1-dev          libxi-dev              qtdeclarative5-private-dev \
   libdbus-1-dev          libxi-dev              qtdeclarative5-private-dev \
   libfreetype6-dev      libxmu-dev              qttools5-dev \
   libfreetype6-dev      libxmu-dev              qttools5-dev \
   libglew-dev            pkg-config \
   libglew-dev            libopenal-dev          libopenscenegraph-3.4-dev \
   libopenal-dev          qml-module-qtquick2"
   pkg-config            qml-module-qtquick2"


: If you prefer you might replace "libcurl4-openssl-dev" by "libcurl4-gnutls-dev".
: If you prefer you might replace "libcurl4-openssl-dev" by "libcurl4-gnutls-dev".


: [[File:Zeichen_144_icon.png|21px]] 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", "libopenscenegraph-3.4-dev", "libopenscenegraph-dev" and "simgear-dev".
: [[File:Zeichen_144_icon.png|21px]] 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.
<!-- libopenscenegraph-3.4-dev, libopenscenegraph-dev, libopenthreads-dev -->




== Build and install ==
== 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 <code>/usr/local/FG-Stable</code> or <code>$HOME/FG-Stable</code>. 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 <code>make</code> commands. We'll use <code>$FG_INSTALL_DIR</code> as a [http://www.cmiss.org/cmgui/wiki/SettingEnvironmentVariablesInBash placeholder] for this directory. <br />
Some things require customisation. We'll use [http://www.cmiss.org/cmgui/wiki/SettingEnvironmentVariablesInBash environment variables] for them: <br />
Another placeholder will be <code>$FG_SRC_DIR</code>, 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 <code>export</code> them (in every terminal you're using them) for the process:
: '''FG_VERSION''' - The version of FlightGear to build and install. This is either <code>next</code> (for the bleeding edge development branch) or a release number in the form <code>release/2019.1</code>. For a list of valid releases see [https://sourceforge.net/p/flightgear/flightgear/ref/next/branches/ here]. <br />
export FG_INSTALL_DIR=$HOME/FG-Stable && mkdir $FG_INSTALL_DIR
: '''FG_SRC_DIR''' - The absolute path to the directory which is supposed to hold the source codes. In case your user belongs to the group ''staff'', <code>/usr/local/src/</code> would be an appropriate location. But any location is fine, too, e.g. <code>$HOME/src/</code>. In any case the user has to have write access there.<br />
export FG_SRC_DIR=$HOME/src && mkdir $FG_SRC_DIR
: '''FG_INSTALL_DIR''' - The absolute path to where FlightGear is going to be installed. Again, <code>/usr/local/</code> is appropriate, if your user belongs to ''staff''. But any location where the user has write access is ok, e.g. <code>$HOME/FlightGear/</code>. <br />


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 [[#FlightGear data|fetch]] it while building the sources. <br />
# Examples, adapt to your own needs:
For some basic info on git commands for FlightGear users we have a [[Git_for_Laymen#How_do_I_use_the_git_repository_to_update_Flightgear_stuff.3F|git for laymen]] section. <br />
export FG_VERSION=release/2019.1
export FG_SRC_DIR=/usr/local/src/
export FG_INSTALL_DIR=/usr/local/
: Remember to export these variables in each console you use in the process.
From here on it should™ be possible to just copy and paste the entire content of each code box at once into the console.
# Create specified directories if they do not exist:
mkdir -p $FG_SRC_DIR
mkdir -p $FG_INSTALL_DIR


For more/advanced cmake options and SimGear's and FlightGear's optional features see the [[Building_using_CMake#Optional_Features|cmake]] article.
For more/advanced cmake options and SimGear's and FlightGear's optional features see the [[Building_using_CMake#Optional_Features|cmake]] article.


[[File:Zeichen_144_icon.png|21px]] Do '''not''' mix instructions for <u>Stable</u> and <u>Next</u>! Not even for fgdata, mixing versions will almost certainly break the installation.
[[File:Zeichen_144_icon.png|21px]] Do '''not''' mix versions for SimGear, FlighGear and fgdata! Mixing versions will almost certainly break the installation.




=== [[plib]] ===
=== [[plib]] ===
<u>Stable</u> and <u>Next</u>: <br />
While just installing package libplib-dev should work, it's  [http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg20793.html recommended] to build it from source. In this case libplib-dev ''must not'' be installed during the installation process of Simgear and Flightgear!
While just installing package "libplib-dev" should work, it's  [http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg20793.html recommended] to build it from source. In this case "libplib-dev" ''must not'' be installed!
  cd $FG_SRC_DIR
  cd $FG_SRC_DIR
  <nowiki>git clone git://git.code.sf.net/p/libplib/code libplib.git</nowiki>
  <nowiki>git clone git://git.code.sf.net/p/libplib/code libplib.git</nowiki>
Line 54: Line 61:
  mkdir $FG_SRC_DIR/build-plib && cd $FG_SRC_DIR/build-plib
  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
  cmake -D CMAKE_INSTALL_PREFIX:PATH="$FG_INSTALL_DIR" $FG_SRC_DIR/libplib.git
  make -j$(nproc) && make install
  make -j$(nproc)
make install




<!--
=== [[OpenSceneGraph]] ===
=== [[OpenSceneGraph]] ===
<u>Stable</u> and <u>Next</u>: <br />
Required only for building "next": <br />
Recommended version is 3.4.1 while the Devuan/Debian repo provides only 3.4.0. Plus, at this time, SimGear does not compile against 3.4.0 so we have to compile it ourselfes.
Recommended version is 3.4.1 while the Devuan/Debian repo only provides 3.4.0. Plus, at this time, SimGear does not compile against 3.4.0 so we have to compile it ourselfes.


  cd $FG_SRC_DIR
  cd $FG_SRC_DIR
Line 65: Line 74:
  mkdir $FG_SRC_DIR/build-osg && cd $FG_SRC_DIR/build-osg
  mkdir $FG_SRC_DIR/build-osg && cd $FG_SRC_DIR/build-osg
  cmake -D LIB_POSTFIX="" -D CMAKE_INSTALL_PREFIX:PATH="$FG_INSTALL_DIR" $FG_SRC_DIR/OpenSceneGraph.git
  cmake -D LIB_POSTFIX="" -D CMAKE_INSTALL_PREFIX:PATH="$FG_INSTALL_DIR" $FG_SRC_DIR/OpenSceneGraph.git
  make -j$(nproc) && make install
  make -j$(nproc)
 
make install
-->


=== [[SimGear]] ===
=== [[SimGear]] ===
<u>Stable</u> and <u>Next</u>:
  cd $FG_SRC_DIR
  cd $FG_SRC_DIR
  <nowiki>git clone git://git.code.sf.net/p/flightgear/simgear simgear.git</nowiki>
  <nowiki>git clone git://git.code.sf.net/p/flightgear/simgear simgear.git</nowiki>
<u>Stable</u> only:
  cd simgear.git
  cd simgear.git
  git checkout release/2018.3
  git checkout $FG_VERSION
 
<u>Stable</u> and <u>Next</u>:
  mkdir $FG_SRC_DIR/build-sg && cd $FG_SRC_DIR/build-sg
  mkdir $FG_SRC_DIR/build-sg && cd $FG_SRC_DIR/build-sg
  cmake CFLAGS="--std=c++11" -D CMAKE_BUILD_TYPE=Release \
  cmake CFLAGS="--std=c++11" -D CMAKE_BUILD_TYPE=Release \
       -D CMAKE_INSTALL_PREFIX:PATH="$FG_INSTALL_DIR" $FG_SRC_DIR/simgear.git
       -D CMAKE_INSTALL_PREFIX:PATH="$FG_INSTALL_DIR" $FG_SRC_DIR/simgear.git
  make -j$(nproc) && make install
  make -j$(nproc)
make install
<!-- -D ENABLE_SWIFT:BOOl=OFF -->




=== FlightGear source ===
=== FlightGear source ===
<u>Stable</u> and <u>Next</u>:
  cd $FG_SRC_DIR
  cd $FG_SRC_DIR
  <nowiki>git clone git://git.code.sf.net/p/flightgear/flightgear flightgear.git</nowiki>
  <nowiki>git clone git://git.code.sf.net/p/flightgear/flightgear flightgear.git</nowiki>
<u>Stable</u> only:
  cd flightgear.git
  cd flightgear.git
  git checkout release/2018.3
  git checkout $FG_VERSION
 
<u>Stable</u> and <u>Next</u>:
  mkdir $FG_SRC_DIR/build-fg && cd $FG_SRC_DIR/build-fg
  mkdir $FG_SRC_DIR/build-fg && cd $FG_SRC_DIR/build-fg
  cmake CFLAGS="--std=c++11" -D CMAKE_BUILD_TYPE=Release \
  cmake CFLAGS="--std=c++11" -D CMAKE_BUILD_TYPE=Release \
       -D FG_DATA_DIR:PATH="$FG_INSTALL_DIR/share/fgdata" \
       -D FG_DATA_DIR:PATH="$FG_INSTALL_DIR/share/fgdata" \
       -D CMAKE_INSTALL_PREFIX:PATH="$FG_INSTALL_DIR" $FG_SRC_DIR/flightgear.git
       -D CMAKE_INSTALL_PREFIX:PATH="$FG_INSTALL_DIR" $FG_SRC_DIR/flightgear.git
  make -j$(nproc) && make install
  make -j$(nproc)
make install
<!-- -D ENABLE_HID_INPUT=OFF -->




=== FlightGear data ===
=== FlightGear data ===
<u>Stable</u> and <u>Next</u>:
  mkdir -p $FG_INSTALL_DIR/share && cd $FG_INSTALL_DIR/share
  mkdir -p $FG_INSTALL_DIR/share && cd $FG_INSTALL_DIR/share
  <nowiki>git clone git://git.code.sf.net/p/flightgear/fgdata fgdata</nowiki>
  <nowiki>git clone git://git.code.sf.net/p/flightgear/fgdata fgdata</nowiki>
<u>Stable</u> only:
  cd fgdata
  cd fgdata
  git checkout release/2018.3
  git checkout $FG_VERSION




== Trial run and finishing process ==
== Trial run and finishing process ==
When all the builds are done and the data download has finished it is time for a test run:
When all the builds are done and the data download has finished it is time for a test run. In case your FG_INSTALL_DIR is <code>/usr/local/</code>, just run <code>fgfs --launcher</code>.
 
In case it's anywhere else on the system, things are a tad more complicated:
  export LD_LIBRARY_PATH=$FG_INSTALL_DIR/lib/:$LD_LIBRARY_PATH
  export LD_LIBRARY_PATH=$FG_INSTALL_DIR/lib/:$LD_LIBRARY_PATH
  $FG_INSTALL_DIR/bin/fgfs --launcher
  $FG_INSTALL_DIR/bin/fgfs --launcher
: The <code>fgfs</code> 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 <code>$HOME/.bashrc</code> to have this as a persistent setting (may cause problems, if one has installed more than one version of FlightGear!).
: The <code>fgfs</code> 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.
: Have in mind, the <code>$FG_INSTALL_DIR</code> and <code>$FG_SRC_DIR</code> variables are available for this session only. For future use of these lines, replace them by the real paths.
: Since [http://www.linfo.org/path_env_var.html $PATH] most likely does not cover the FG_INSTALL_DIR the full path to the fgfs binary is required to run it.
: Even though it's a tad more laborious than installing it to <code>/usr/local/</code>, this approach has the advantage of easlily managing several FlightGear installations.
 
To make it permanent and less complicated one option would be to create an alias:
echo -e "alias flightgear='LD_LIBRARY_PATH=$FG_INSTALL_DIR/lib\
  $FG_INSTALL_DIR/bin/fgfs --launcher' \n" >> $HOME/.bashrc
source $HOME/.bashrc
: Now running <code>flightgear</code> will start the simulator.
 
To keep the source code git repos up to date have a look at our [[Git_for_Laymen#How_do_I_use_the_git_repository_to_update_Flightgear_stuff.3F|git for laymen]] section.
 
Please report issues or any kind of feedback to the [[Talk:Building_FlightGear_-_Devuan|talk page]].
 


To avoid the need to give the path to the <code>fgfs</code> command each time, you might consider to create a symlink at a place that is listed in $PATH:
== Uninstalling ==
  ln -s $FG_INSTALL_DIR/bin/fgfs $HOME/bin/fgfs
To uninstall Flightgear and its components from e.g. <code>/usr/local/</code>, run <code>make uninstall</code> inside each software's build directory:
cd $FG_SRC_DIR/build-fg && make uninstall
cd $FG_SRC_DIR/build-sg && make uninstall
cd $FG_SRC_DIR/build-plib && make uninstall
  rm -R $FG_INSTALL_DIR/share/fgdata
<!-- cd $FG_SRC_DIR/build-osg && make uninstall -->




{{Building}}
{{Building}}

Revision as of 10:46, 8 November 2019

HowTo build FlightGear on Devuan GNU/Linux Stable (ASCII). Instructions probably apply to 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 Devuan. For more detailed information please refer to the main article Building FlightGear on Linux.

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          qml-module-qtquick-window2 \
  libboost-dev           libqt5opengl5-dev       qt5-default \
  libcurl4-openssl-dev   libqt5svg5-dev          qtbase5-private-dev \
  libdbus-1-dev          libxi-dev               qtdeclarative5-private-dev \
  libfreetype6-dev       libxmu-dev              qttools5-dev \
  libglew-dev            libopenal-dev           libopenscenegraph-3.4-dev \
  pkg-config             qml-module-qtquick2"
If you prefer you might replace "libcurl4-openssl-dev" by "libcurl4-gnutls-dev".
Zeichen 144 icon.png 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

Some things require customisation. We'll use environment variables for them:

FG_VERSION - The version of FlightGear to build and install. This is either next (for the bleeding edge development branch) or a release number in the form release/2019.1. For a list of valid releases see here.
FG_SRC_DIR - The absolute path to the directory which is supposed to hold the source codes. In case your user belongs to the group staff, /usr/local/src/ would be an appropriate location. But any location is fine, too, e.g. $HOME/src/. In any case the user has to have write access there.
FG_INSTALL_DIR - The absolute path to where FlightGear is going to be installed. Again, /usr/local/ is appropriate, if your user belongs to staff. But any location where the user has write access is ok, e.g. $HOME/FlightGear/.
# Examples, adapt to your own needs:
export FG_VERSION=release/2019.1
export FG_SRC_DIR=/usr/local/src/
export FG_INSTALL_DIR=/usr/local/
Remember to export these variables in each console you use in the process.

From here on it should™ be possible to just copy and paste the entire content of each code box at once into the console.

# Create specified directories if they do not exist:
mkdir -p $FG_SRC_DIR
mkdir -p $FG_INSTALL_DIR

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

Zeichen 144 icon.png Do not mix versions for SimGear, FlighGear and fgdata! Mixing versions will almost certainly break the installation.


plib

While just installing package libplib-dev should work, it's recommended to build it from source. In this case libplib-dev must not be installed during the installation process of Simgear and Flightgear!

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

cd $FG_SRC_DIR
git clone git://git.code.sf.net/p/flightgear/simgear simgear.git
cd simgear.git
git checkout $FG_VERSION
mkdir $FG_SRC_DIR/build-sg && cd $FG_SRC_DIR/build-sg
cmake CFLAGS="--std=c++11" -D CMAKE_BUILD_TYPE=Release \
      -D CMAKE_INSTALL_PREFIX:PATH="$FG_INSTALL_DIR" $FG_SRC_DIR/simgear.git
make -j$(nproc)
make install


FlightGear source

cd $FG_SRC_DIR
git clone git://git.code.sf.net/p/flightgear/flightgear flightgear.git
cd flightgear.git
git checkout $FG_VERSION
mkdir $FG_SRC_DIR/build-fg && cd $FG_SRC_DIR/build-fg
cmake CFLAGS="--std=c++11" -D CMAKE_BUILD_TYPE=Release \
      -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

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


Trial run and finishing process

When all the builds are done and the data download has finished it is time for a test run. In case your FG_INSTALL_DIR is /usr/local/, just run fgfs --launcher.

In case it's anywhere else on the system, things are a tad more complicated:

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.
Since $PATH most likely does not cover the FG_INSTALL_DIR the full path to the fgfs binary is required to run it.
Even though it's a tad more laborious than installing it to /usr/local/, this approach has the advantage of easlily managing several FlightGear installations.

To make it permanent and less complicated one option would be to create an alias:

echo -e "alias flightgear='LD_LIBRARY_PATH=$FG_INSTALL_DIR/lib\
 $FG_INSTALL_DIR/bin/fgfs --launcher' \n" >> $HOME/.bashrc
source $HOME/.bashrc
Now running flightgear will start the simulator.

To keep the source code git repos up to date have a look at our git for laymen section.

Please report issues or any kind of feedback to the talk page.


Uninstalling

To uninstall Flightgear and its components from e.g. /usr/local/, run make uninstall inside each software's build directory:

cd $FG_SRC_DIR/build-fg && make uninstall
cd $FG_SRC_DIR/build-sg && make uninstall
cd $FG_SRC_DIR/build-plib && make uninstall
rm -R $FG_INSTALL_DIR/share/fgdata