Fedora 40 Packages and Compiling

From FlightGear wiki
Jump to navigation Jump to search

Users on apt-based systems can use the script download_and_compile.sh to download required development packages and compile FlightGear. Systems using dnf for package management cannot use this script. Once required packages are loaded using dnf, the download_and_compile.sh script can be used to compile and build FlightGear, but I find that at this point it is just as simple to directly type the required commands.

Here are the packages needed to build and use SimGear and FlightGear on Fedora along with some examples of build scenarios for reference.

Simply Use the Current Release

If one wishes to simply use FlightGear in its current supported form without re-compiling, the Fedora FlightGear packages are fine. To use simply download the Fedora FlightGear packages. It is not necessary to load these packages in order to compile and install your own versions from source, but it also is compatible with and does not prevent development work if they are installed.

sudo dnf -y install FlightGear
sudo dnf -y install FlightGear-data
sudo dnf -y install FlightGear-Atlas # Optional

This installs FlightGear commands such as fgfs in /usr/bin and FlightGear's data, fgdata, in /usr/share/flightgear.

Building FlightGear

If, however, one wishes to build various versions from source, several development packages are required.

Required Packages

sudo dnf -y install cmake
sudo dnf -y install gcc-c++
sudo dnf -y install boost-devel
sudo dnf -y install gtkglext-devel
sudo dnf -y install openal-soft-devel
sudo dnf -y install OpenSceneGraph-devel
sudo dnf -y install libcurl-devel
sudo dnf -y install plib-devel
sudo dnf -y install freeglut-devel

Build Examples

The required development packages listed above are sufficient for building SimGear, FlightGear, loading fgdata and installing a running flight simulator. FlightGear has several additional packages that may require additional development packages. using cmake and following its errors make it fairly straight forward to find and install additional packages for these additional FlighhtGear components.

The following sections describe example scenarios for compiling and installing various versions of FlightGear.

Note that one shell variable is used in these examples to control the number of parallel processes allowed by make. Using this parallelism speed up the compilation process.

export NPROC=`/usr/bin/nproc`

Three main versions are described.

Version 2020.3.19 is the current release version. One may wish to experiment and build patched versions to maintain compatibility with existing binary downloads. However it me be useful to use later development versions and contribute to the ongoing FlightGear development.

Version 2024.1 is intended to replace 2020.3 as the release version. Consider this a beta test version with most features frozen and intended for future release.

Version 2024.2, or next, is where features beyond 2024.1 continue development.

In each of the following examples, the directories used and the structures is quite flexible. The examples use the following build-directory structures: Each example is in a build directory under your HOME. The name is your choice. I use the FlightGear version under consideration in the example. This build directory contains at least two directories of source: simgear and flightgear. It may include fgdata, although that may be elsewhere. It may also include an install directory when system-level directories are not used. Simgear is built and installed first. Flightgear can then be built as it requires a completed simgear.

Current Release Version 2020.3 Private copy

This example builds a standalone FlightGear fully under your HOME directory.

Fetch sources from sourceforge.

mkdir $HOME/fg2020.3
cd $HOME/fg2020.3
git clone --single-branch --branch release/2020.3 https://git.code.sf.net/p/flightgear/simgear simgear
git clone --single-branch --branch release/2020.3 https://git.code.sf.net/p/flightgear/flightgear flightgear
git clone --single-branch --branch release/2020.3 git://git.code.sf.net/p/flightgear/fgdata fgdata

Make two empty directories in which to perform the build. These can be named arbitrarily and there may be more than one set for different configurations. Also make an empty directory to hold the installed version of FlightGear. Code will be in install/bin and install/lib. The fgdata directory is at the same level as the source and build directories and is found automagically by cmake.

mkdir fgbuild
mkdir sgbuild
mkdir install

For 2020.3, you must make one change to the cmake configuration files in both simgear and flightgear. This change is already in 2024.1 and 2024.2 so it is only needed for version 2020.3.

# Edit CMakeLists.txt in both flightgear and simgear directories
# For each, change the line
set(CMAKE_CXX_STANDARD 11)
to
set(CMAKE_CXX_STANDARD 17)

Build and install simgear. The cmake command is only needed for the initial configuration. Future edits and re-builds just need the make commands. If you wish to change configuration options, the easiest way is to delete everything and start over with a new cmake command or use a different sgbuild and fgbuild directory set.

cd $HOME/fg2020.3/sgbuild
cmake ../simgear -DCMAKE_INSTALL_PREFIX=$HOME/fg2020.3/install -DCMAKE_BUILD_TYPE=Release
make -j$NPROC
make install

Build and install flightgear. As with simgear, the cmake command is only needed for the initial configuration.

cd $HOME/fg2020.3/fgbuild
cmake ../flightgear -DCMAKE_INSTALL_PREFIX=$HOME/fg2020.3/install -DCMAKE_BUILD_TYPE=Release
make -j$NPROC
make install

Set your path to find your new version of flightgear:

export PATH=$HOME/fg2020.3/install/bin:$PATH

Current Release Version 2020.3 Public copy for everyone on your system

This example builds a public system available to any users on your system. Programs and libraries will install to /usr/local. Fgdata is installed to /usr/local/share.

Each user should already have /usr/local/bin in their $PATH by default.

Fetch sources from sourceforge.

mkdir $HOME/fg2020.3
cd $HOME/fg2020.3
git clone --single-branch --branch release/2020.3 https://git.code.sf.net/p/flightgear/simgear simgear
git clone --single-branch --branch release/2020.3 https://git.code.sf.net/p/flightgear/flightgear flightgear
git clone --single-branch --branch release/2020.3 git://git.code.sf.net/p/flightgear/fgdata fgdata
sudo mv fgdata /usr/local/share
sudo chown -R root:root /usr/local/share/fgdata

Make two empty directories in which to perform the build. These can be named arbitrarily and there may be more than one set for different configurations.

mkdir fgbuild
mkdir sgbuild

As before for 2020.3, you must once again make one change to the cmake configuration files in both simgear and flightgear as in the example above.

# Edit CMakeLists.txt in both flightgear and simgear directories
# For each, change the line
set(CMAKE_CXX_STANDARD 11)
to
set(CMAKE_CXX_STANDARD 17)

Build and install simgear.

cd $HOME/fg2020.3/sgbuild
cmake ../simgear -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release
make -j$NPROC
sudo make install

Build and install flightgear. We need an additional configuration option to tell flightgear where to find fgdata.

cd $HOME/fg2020.3/fgbuild
cmake ../flightgear -DFG_DATA_DIR=/usr/local/share/fgdata -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release
make -j$NPROC
sudo make install

Current Release Version 2020.3 Public Copy to override a binary release

The fgdata download is quite large. You may have already installed the Fedora dnf packages for FlightGear and wish to rebuild the code, but use the existing fgdata in /usr/share/flightgear. This is similar to the previous example except that you point flightgear at the already existing fgdata release. No other changes are needed.

cd $HOME/fg2020.3/fgbuild
cmake ../flightgear -DFG_DATA_DIR=/usr/share/flightgear -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release
make -j$NPROC
sudo make install

The default PATH for users already has /usr/local/bin ahead of /usr/bin and so the newly rebuilt version of fgfs, the FlightGear exutable will be found before the dnf-installed version.

Proposed release candidate 2024.1

This version can be configured many ways as can 2020.3. This example gives the simple case of a single private version in your HOME directory.

mkdir $HOME/fg2024.1
cd $HOME/fg2024.1
git clone --single-branch --branch release/2024.1 https://git.code.sf.net/p/flightgear/simgear simgear
git clone --single-branch --branch release/2024.1 https://git.code.sf.net/p/flightgear/flightgear flightgear
git clone --single-branch --branch release/2024.1 git://git.code.sf.net/p/flightgear/fgdata fgdata
mkdir fgbuild
mkdir sgbuild
mkdir install
cd $HOME/fg2024.1/sgbuild
cmake ../simgear -DCMAKE_INSTALL_PREFIX=$HOME/fg2024.1/install -DCMAKE_BUILD_TYPE=Release
make -j$NPROC
make install
cd $HOME/fg2024.1/fgbuild
cmake ../flightgear -DCMAKE_INSTALL_PREFIX=$HOME/fg2024.1/install -DCMAKE_BUILD_TYPE=Release
make -j$NPROC
make install
export PATH $HOME/fg2024.1/install/bin:$PATH

Next development version 2024.2

This version is for development of new features beyond the frozen features in 2024.1. Join the FlightGear development team. Discuss changes with core developers on the developer mailing list.

mkdir $HOME/fg2024.2
cd $HOME/fg2024.2
git clone https://git.code.sf.net/p/flightgear/simgear simgear
git clone https://git.code.sf.net/p/flightgear/flightgear flightgear
git clone git://git.code.sf.net/p/flightgear/fgdata fgdata
mkdir fgbuild
mkdir sgbuild
mkdir install
cd $HOME/fg2024.2/sgbuild
cmake ../simgear -DCMAKE_INSTALL_PREFIX=$HOME/fg2024.2/install -DCMAKE_BUILD_TYPE=Release
make -j$NPROC
make install
cd $HOME/fg2024.2/fgbuild
cmake ../flightgear -DCMAKE_INSTALL_PREFIX=$HOME/fg2024.2/install -DCMAKE_BUILD_TYPE=Release
make -j$NPROC
make install
export PATH $HOME/fg2024.2/install/bin:$PATH