Difference between revisions of "Building Flightgear - CentOS"

From FlightGear wiki
Jump to: navigation, search
m (Fix OSG build: lib64)
Line 51: Line 51:
 
       -DOSG_USE_LOCAL_LUA_SOURCE:BOOL=OFF \
 
       -DOSG_USE_LOCAL_LUA_SOURCE:BOOL=OFF \
 
       -DCMAKE_INSTALL_PREFIX="${FGFS_PREFIX}" \
 
       -DCMAKE_INSTALL_PREFIX="${FGFS_PREFIX}" \
 +
      -DLIB_POSTFIX=64 \
 
       -DCMAKE_VERBOSE_MAKEFILE=TRUE
 
       -DCMAKE_VERBOSE_MAKEFILE=TRUE
 
  make --jobs=${NR_JOBS}
 
  make --jobs=${NR_JOBS}

Revision as of 13:46, 18 January 2020

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.

Preparation

A "Minimal Install" of CentOS 8 (64 bits) is needed.

Requirements

All the commands are run in bash as normal user (not root). The user need sudo access to install packages and add some repos.

The following repos need to be added and enabled:

sudo dnf config-manager --set-enabled PowerTools
sudo dnf install epel-release

The following packages need to be install on the the system before starting the build of FlightGear. The packages can be install using the dnf command:

sudo dnf install freeglut-devel.x86_64 openal-soft.x86_64 freetype-devel.x86_64 libjpeg-turbo-devel.x86_64 jasper-libs.x86_64 libxml2-devel.x86_64 libcurl-devel.x86_64 \
   cairo-devel.x86_64 poppler-glib.x86_64 librsvg2-devel.x86_64 gtk2-devel.x86_64 lua-libs.x86_64 lua.x86_64 fltk.x86_64 libpng-devel.x86_64 libtiff-devel.x86_64 \
   libXrandr-devel.x86_64 libXinerama-devel.x86_64 zlib-devel.x86_64 expat-devel.x86_64 boost.x86_64 openal-soft-devel.x86_64 cmake.x86_64 \
   mesa-libEGL-devel.x86_64 jasper-devel.x86_64 gstreamer1-devel.x86_64 SDL2-devel.x86_64 poppler-glib-devel.x86_64 lua-devel.x86_64 fltk-devel.x86_64 boost-devel.x86_64 \
   dbus-devel.x86_64 libevent-devel.x86_64 glew-devel.x86_64

The plib package is not available for CentOS 8. The package from CentOS 7 can be used instead. After downloading the following packages:

The 2 packages can be installed manually using the following command:

sudo rpm --install plib-1.8.5-15.el7.x86_64.rpm 
sudo rpm --install plib-devel-1.8.5-15.el7.x86_64.rpm

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,...
  • OPENSCENEGRAPH_VERSION: Version of OpenSceneGraph. For example: OPENSCENEGRAPH_VERSION=3.6.4.

OpenSceneGraph

OpenSceneGraph is not available as a RPM for CentOS 8 and, for this reason, needs to be build from sources. The latest stable version of OpenSceneGraph can be downloaded from here. The downloaded file must be placed under the directory ${FGFS_PREFIX}/src such that the full path of the file will be ${FGFS_PREFIX}/src/OpenSceneGraph-OpenSceneGraph-${OPENSCENEGRAPH_VERSION}.

The following commands can be used to build OpenSceneGraph:

cd -- "${FGFS_PREFIX}/src/"
rm -Rf -- "${FGFS_PREFIX}/src/OpenSceneGraph_build/"
mkdir -- "${FGFS_PREFIX}/src/OpenSceneGraph_build/"
OPENSCENEGRAPH_SRC=${FGFS_PREFIX}/src/OpenSceneGraph-OpenSceneGraph-${OPENSCENEGRAPH_VERSION}
rm -Rf -- "${OPENSCENEGRAPH_SRC}/"
tar axvf "${FGFS_PREFIX}/src/OpenSceneGraph-OpenSceneGraph-${OPENSCENEGRAPH_VERSION}.tar.gz"
pushd -- "${FGFS_PREFIX}/src/OpenSceneGraph_build/"
cmake "${OPENSCENEGRAPH_SRC}" \
      -DCMAKE_BUILD_TYPE=Release \
      -DBUILD_OSG_EXAMPLES:BOOL=ON \
      -DOSG_USE_LOCAL_LUA_SOURCE:BOOL=OFF \
      -DCMAKE_INSTALL_PREFIX="${FGFS_PREFIX}" \
      -DLIB_POSTFIX=64 \
      -DCMAKE_VERBOSE_MAKEFILE=TRUE
make --jobs=${NR_JOBS}
make -- install
popd
rm -Rf -- "${OPENSCENEGRAPH_SRC}/"
rm -Rf -- "${FGFS_PREFIX}/src/OpenSceneGraph_build/"

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 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
make --jobs=${NR_JOBS}
make -- test
make -- install
popd
rm -Rf -- "${FGFS_PREFIX}/src/fg_build/"