88
edits
m (Add CentOS) |
(Update build for CMake) |
||
Line 14: | Line 14: | ||
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]]. | ||
= 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. | * 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]]. | * Debian users who prefer to build it without script may look at [[Building Flightgear - Debian]]. | ||
* Hints for [[Ubuntu]] users. | * Hints for [[Ubuntu]] users. | ||
== Gentoo == | |||
* Gentoo users can also use overlays to build FlightGear without much hassle: [[Building Flightgear - 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]]. | 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]]}} | {{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: | ||
Line 34: | Line 33: | ||
'''C++ compiler''' | '''C++ compiler''' | ||
These are: c++ | 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 62: | Line 61: | ||
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 = | |||
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'''. | 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'''. | ||
Line 93: | Line 92: | ||
# <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. | # <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. | ||
= Compiling = | |||
< | == 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>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 distribution | |||
FGFS_PREFIX_LIB=${FGFS_PREFIX}/lib64 | |||
== 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: | |||
= | 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 <code>${SIMGEAR_SRC}</code>, 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 [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: | |||
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 [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: | |||
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 <code>${FLIGHTGEAR_SRC}</code>, 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} | |||
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${FGFS_PREFIX_LIB}/ | |||
FG_ROOT=${FGFS_PREFIX_LIB}/Flightgear make --jobs=${NR_JOBS} -- test_suite || true | |||
make -- test | |||
$ | make -- install | ||
popd | |||
rm -Rf -- "${FGFS_PREFIX}/src/fg_build/" | |||
$ | |||
$ | |||
$ | |||
$ | |||
= External links = | |||
== Instructions == | |||
* [[MSYS]] | * [[MSYS]] | ||
* [[MinGW/cross-compiler]] | * [[MinGW/cross-compiler]] | ||
Line 222: | Line 217: | ||
* [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. | 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. | ||
edits