Scripted Compilation on Linux Debian/Ubuntu: Difference between revisions

Jump to navigation Jump to search
add prerequisites section since dnc doesn't automatically pull these needed tools if they are not already installed.
(Revised instructions that avoid the well-known fatal “RPC failed (...) The remote end hung up unexpectedly” error when cloning FGData, without compromising security (using git:// doesn't offer any authentication of the server → unacceptable))
(add prerequisites section since dnc doesn't automatically pull these needed tools if they are not already installed.)
(25 intermediate revisions by 2 users not shown)
Line 17: Line 17:
Apart from its main purpose, <tt>download_and_compile.sh</tt> can be used to find hopefully up-to-date build-dependency information for FlightGear and related software. You would do so by inspecting [https://sourceforge.net/p/flightgear/fgmeta/ci/next/tree/download_and_compile.sh the script] at the point where it installs packages.<ref name="note-inspecting-download-and-compile-sh-to-gather-build-dependency-information">Look for strings such as <tt>zlib1g-dev</tt>, <tt>libglew-dev</tt> or <tt>qt5-default</tt>.</ref>
Apart from its main purpose, <tt>download_and_compile.sh</tt> can be used to find hopefully up-to-date build-dependency information for FlightGear and related software. You would do so by inspecting [https://sourceforge.net/p/flightgear/fgmeta/ci/next/tree/download_and_compile.sh the script] at the point where it installs packages.<ref name="note-inspecting-download-and-compile-sh-to-gather-build-dependency-information">Look for strings such as <tt>zlib1g-dev</tt>, <tt>libglew-dev</tt> or <tt>qt5-default</tt>.</ref>


== Disk space requirements and build time ==
== Prerequisites ==
 
Before embarking on building your own FlightGear binaries, you must have already installed the necessary tools to compile the source code with. These preliminary tools are
 
* build-essential
* git
* subversion
* cmake
* automake
 
They can be installed quite simply by running the following command line.
 
$ sudo apt-get install build-essential git subversion cmake automake
 
Once these tools are installed, the download_and_compile.sh script can be run. It will install possibly needed additional tools and libraries as it runs.
 
== <span id="disk-space-requirements-and-build-time"></span> Disk space requirements and build time ==


As of April 2019, building FlightGear requires about 12 [https://en.wikipedia.org/wiki/Gibibyte GiB] of disk space. Note that this includes downloaded source code for [[SimGear]] and FlightGear, generated build files and the large [[FGData]] repository (about 6 GiB for that one).
As of April 2019, building FlightGear requires about 12 [https://en.wikipedia.org/wiki/Gibibyte GiB] of disk space. Note that this includes downloaded source code for [[SimGear]] and FlightGear, generated build files and the large [[FGData]] repository (about 6 GiB for that one).
Line 104: Line 120:
Of course, it is always possible to make commands shorter by setting up aliases (see tips at the end of [https://sourceforge.net/p/flightgear/mailman/message/36634426/ this message]), by adding the directory containing <tt>download_and_compile.sh</tt> to your <tt>PATH</tt> or by creating a symbolink link pointing to <tt>download_and_compile.sh</tt> in a directory that is part of your <tt>PATH</tt>. This is not necessary, though; do it only if you feel the need (when enabled, persistent shell history is often enough for such things).
Of course, it is always possible to make commands shorter by setting up aliases (see tips at the end of [https://sourceforge.net/p/flightgear/mailman/message/36634426/ this message]), by adding the directory containing <tt>download_and_compile.sh</tt> to your <tt>PATH</tt> or by creating a symbolink link pointing to <tt>download_and_compile.sh</tt> in a directory that is part of your <tt>PATH</tt>. This is not necessary, though; do it only if you feel the need (when enabled, persistent shell history is often enough for such things).


{{Note|The following commands should be run from an empty directory<ref name="dedicated-directory-won-t-stay-empty-forever">Well, empty before the first time; later, <tt>download_and_compile.sh</tt> is going to populate it with plenty of FlightGear files and subdirectories, of course.</ref> in a partition that has enough free space ([[FGData]] currently takes about 5 [https://en.wikipedia.org/wiki/Gibibyte GiB] and you'll need several more gibibytes to download the [[SimGear]] plus FlightGear sources, and build them. As of April 2019, a complete build including SimGear, FlightGear and FGData requires approximately 12 GiB of disk space). As explained in [[#getting-started-with-download-and-compile-sh-notations|Notations]], we are going to choose the directory <tt>~/flightgear/dnc-managed</tt> for this purpose, in order to express that the whole directory tree is managed by <tt>download_and_compile.sh</tt>. This is just an example; feel free to choose another directory if you want.
{{Note|The following commands should be run from an empty directory<ref name="dedicated-directory-won-t-stay-empty-forever">Well, empty before the first time; later, <tt>download_and_compile.sh</tt> is going to populate it with plenty of FlightGear files and subdirectories, of course.</ref> in a partition that has enough free space (see [[#disk-space-requirements-and-build-time | Disk space requirements and build time]]). As explained in [[#getting-started-with-download-and-compile-sh-notations|Notations]], we are going to choose the directory <tt>~/flightgear/dnc-managed</tt> for this purpose, in order to express that the whole directory tree is managed by <tt>download_and_compile.sh</tt>. This is just an example; feel free to choose another directory if you want.


'''Don't run the commands from a non-dedicated directory,''' because it will be filled with files and directories created by <tt>download_and_compile.sh</tt> and the FlightGear, SimGear, etc. build systems. That would be a complete mess! In particular, ''don't'' run the commands from the directory containing your [[FGMeta]] clone.}}
'''Don't run the commands from a non-dedicated directory,''' because it will be filled with files and directories created by <tt>download_and_compile.sh</tt> and the FlightGear, SimGear, etc. build systems. That would be a complete mess! In particular, ''don't'' run the commands from the directory containing your [[FGMeta]] clone.}}
Line 264: Line 280:
There we are! You now have a clean, up-to-date [[FGData]] clone in <tt>~/flightgear/dnc-managed/install/flightgear/fgdata</tt> (remember: <tt>~/flightgear/dnc-managed</tt> is the directory from which you ran <tt>download_and_compile.sh</tt>). Note this place: the full path of the <tt>~/flightgear/dnc-managed/install/flightgear/fgdata</tt> directory is your [[$FG_ROOT]].
There we are! You now have a clean, up-to-date [[FGData]] clone in <tt>~/flightgear/dnc-managed/install/flightgear/fgdata</tt> (remember: <tt>~/flightgear/dnc-managed</tt> is the directory from which you ran <tt>download_and_compile.sh</tt>). Note this place: the full path of the <tt>~/flightgear/dnc-managed/install/flightgear/fgdata</tt> directory is your [[$FG_ROOT]].


Now open the <tt>[[$FG_ROOT]]/.git/config</tt> file that lives inside your FGData clone (i.e., <tt>~/flightgear/dnc-managed/install/flightgear/fgdata/.git/config</tt> in our example). You should see a paragraph resembling this:
Now, change the protocol to use for future updates of your FGData clone:<ref name="changing-the-protocol-for-a-git-remote-manual-method">Another way would be to manually change the relevant line starting with <code><nowiki>url = ssh://SFusername@</nowiki></code> for the <code>origin</code> remote in the <tt>.git/config</tt> file that lives inside your repository clone (i.e., <tt>~/flightgear/dnc-managed/install/flightgear/fgdata/.git/config</tt> in our example).</ref>
  [remote "origin"]
(cd install/flightgear/fgdata && \
        url = ssh://''SFusername''@git.code.sf.net/p/flightgear/fgdata
  git remote set-url origin <nowiki>https://git.code.sf.net/p/flightgear/fgdata</nowiki>)
        fetch = +refs/heads/*:refs/remotes/origin/*
(you can check at any time the protocol(s) in use with the command <code>git remote -v</code> run inside a Git repository—in this case, inside the folder <tt>install/flightgear/fgdata</tt>). As a consequence of this change, all future updates of your FGData clone will use the <tt>https</tt> protocol, therefore you won't be prompted anymore for your SourceForge password.
Replace <code>ssh://''SFusername''@</code> with <code>https://</code> and save the file. As a consequence of this change, all future updates of your FGData clone will use the <tt>https</tt> protocol, therefore you won't be prompted anymore for your SourceForge password.


All that remains to do is to run, from the same directory as before (<tt>~/flightgear/dnc-managed</tt> in our example):
All that remains to do is to run, from the same directory as before (<tt>~/flightgear/dnc-managed</tt> in our example):
Line 293: Line 308:
  $ cd ~/flightgear/dnc-managed
  $ cd ~/flightgear/dnc-managed
  $ ./run_fgfs.sh --launcher
  $ ./run_fgfs.sh --launcher
(You may omit the <code>--launcher</code> option; this would simply start FlightGear without any launcher, at the default airport and with the default aircraft.)<br />
In case you find this tedious to type or have more arguments to pass on a regular basis, you can follow the advice given at the end of [https://sourceforge.net/p/flightgear/mailman/message/36634426/ this message] or use another launcher such as [[FFGo]] (but the [[FlightGear Qt launcher|FlightGear built-in launcher]] started with <code>run_fgfs.sh --launcher</code> is quite fine, be sure to try it first!).
In case you find this tedious to type or have more arguments to pass on a regular basis, you can follow the advice given at the end of [https://sourceforge.net/p/flightgear/mailman/message/36634426/ this message] or use another launcher such as [[FFGo]] (but the [[FlightGear Qt launcher|FlightGear built-in launcher]] started with <code>run_fgfs.sh --launcher</code> is quite fine, be sure to try it first!).


Line 336: Line 352:
  $ git log -p -- download_and_compile.sh
  $ git log -p -- download_and_compile.sh


== Update Available ==
== <span id="list-of-available-components"></span> List of available components ==


The latest version of <tt>download_and_compile.sh</tt> can be obtained {{fgmeta source
The <tt>download_and_compile.sh</tt> script is able to download, compile (when applicable) and install the following components:
| path = download_and_compile.sh
| text = here
}}, however there are advantages getting it from an [[FGMeta]] clone as explained [[User:Rominet#Getting_download_and_compile.sh_the_.E2.80.9Cright_way.E2.80.9D|here]]. Contents should be moved from [[User:Rominet|there]] to this page; this and the following section are not up-to-date at the time of this writing.


== Cut to the Chase: for the impatient ==
* ATCPIE (for the [[ATC-pie]] air traffic control simulation program)
* CMAKE (for the [https://cmake.org/ CMake] build tool—this can be useful in case CMake is too old in your distribution)
* DATA (for [[FGData]], the main set of data files used by FlightGear)
* FGFS (for FlightGear itself)
* FGO (for the [[FGo!]] FlightGear launcher)
* FGRUN (for the [[Fgrun|FGRun]] FlightGear launcher)
* FGX (for the [[FGX|FGx]] FlightGear launcher<ref name="note-on-the-status-of-FGx-support-in-download-and-compile-sh">Support for FGx in <tt>download_and_compile.sh</tt> would probably benefit from a code review.</ref>)
* OPENRADAR (for the [[OpenRadar]] air traffic control simulation program)
* OPENRTI (for [[FlightGear HLA support (High Level Architecture)#OpenRTI | OpenRTI]]<ref name="note-on-the-status-of-OpenRTI-support-in-FG">Note that OpenRTI is just an optional dependency for [[FlightGear high-level architecture support | HLA support]]. For the time being, you should be just fine building without it. Eventually, the idea is for HLA to replace the existing MP system and even increasingly distribute the FlightGear architecture such that more and more components can be more easily run in separate threads or even separate processes, possibly even on different machines. So this is going to be an important feature for professional users, using several computers and screens to create a comprehensive and immersive simulation environment.
<p>
At the moment, it is probably safe to say that HLA is only of interest to developers and people willing to play with experimental features.</ref>)
* OSG (for the [[OpenSceneGraph]] library)
* PLIB (for the [[PLIB]] library)
* SIMGEAR (for the [[SimGear]] library—foundation for FlightGear and TerraGear)
* TERRAGEAR (for the [[TerraGear]] terrain building toolchain)
* TERRAGEARGUI (for [[TerraGear GUI]], a graphical interface for TerraGear)


Beware: with the following, you are likely to encounter problems when cloning [[FGData]]: read just above.
Each of the items listed above is a ''component'' in <tt>download_and_compile.sh</tt> terminology. Components are written in uppercase by convention.


cd  <your working directory for building FlightGear>
{{Note|The preceding list might not be up-to-date. The up-to-date list of components supported by <tt>download_and_compile.sh</tt> can always be obtained by running <code>download_and_compile.sh --help</code>.}}
wget -O download_and_compile.sh https://sourceforge.net/p/flightgear/fgmeta/ci/next/tree/download_and_compile.sh?format=raw
chmod +x download_and_compile.sh
mkdir -p stable
mkdir -p next
cd stable
../download_and_compile.sh -j$(nproc) -s
cd ../next
../download_and_compile.sh -j$(nproc) -p n
 
{{Note|With <code>-j$(nproc)</code> as above, the compilation will use all cores available on your processor, which can save several hours. If you want to use, say, 4 cores, replace <code>-j$(nproc)</code> with <code>-j4</code>.}}
 
== Conversion of directory structure from earlier versions of download_and_compile.sh ==
 
Earlier versions of the script used a different directory structure. If you used the earlier version, the new script includes a section that will convert the earlier structure to the current set of directories.
 
== List of compiled programs ==
The <tt>download_and_compile.sh</tt> script is able to download and compile:
* [[SimGear]] (”base libraries” that are part of the FlightGear project, and required)
* FlightGear
* [[FGData]] (base data files that are part of the FlightGear project, and required)
* [https://cmake.org/ CMake] (in case CMake is too old in your distribution)
* [[PLIB]]
* [[OpenSceneGraph]]
* [[FGRun]]
* [[FGo!]]
* [[FGX]]
* [[TerraGear]]
* [[TerraGear_GUI]]
* [[OpenRadar]]
* [[ATC-pie]]
* [[FlightGear HLA support (High Level Architecture) | OpenRTI]]
 
(Note that OpenRTI is just an optional dependency for [[FlightGear high-level architecture support|HLA support]]. For the time being, you should be just fine building without it. Eventually, the idea is for HLA to replace the existing MP system and even increasingly distribute the FlightGear architecture such that more and more components can be more easily run in separate threads or even separate processes, possibly even on different machines. So this is going to be an important feature for professional users, using several computers and screens to create a comprehensive and immersive simulation environment.
 
At the moment, it's probably safe to say that HLA is only of interest to developers and people willing to play with experimental features.)
 
Each of the items listed above corresponds to a ''component'' in <tt>download_and_compile.sh</tt> terminology. Components are written in uppercase. The list of supported ones is currently:
* SIMGEAR
* FGFS (this corresponds to FlightGear)
* DATA (this corresponds to [[FGData]])
* CMAKE
* PLIB
* OSG (this corresponds to [[OpenSceneGraph]])
* FGRUN
* FGO
* FGX
* TERRAGEAR
* TERRAGEARGUI
* OPENRADAR
* ATCPIE
* OPENRTI
The up-to-date list of components can be obtained by running:
$ download_and_compile.sh --help


What is the point of knowing this? Because you may pass component names to <tt>download_and_compile.sh</tt> in order to tell it what you want to download, build and install. By default, only the three essential components SIMGEAR, FGFS and DATA are taken care of, which means that the command:
What is the point of knowing this? Because you may pass component names to <tt>download_and_compile.sh</tt> in order to tell it what you want to download, build and install. By default, only the three essential components SIMGEAR, FGFS and DATA are taken care of, which means that the command:
  download_and_compile.sh
  $ download_and_compile.sh
is equivalent to:
is equivalent to:
  $ download_and_compile.sh SIMGEAR FGFS DATA
  $ download_and_compile.sh SIMGEAR FGFS DATA
Line 422: Line 397:
{{Note|In this section, we assume you've read and followed the advice given in [[#getting-started-with-download-and-compile-sh|Getting started with <tt>download_and_compile.sh</tt>]].}}
{{Note|In this section, we assume you've read and followed the advice given in [[#getting-started-with-download-and-compile-sh|Getting started with <tt>download_and_compile.sh</tt>]].}}


For the FGFS component (FlightGear), there are two main options:
=== <span id="selecting-the-components-to-work-on"></span> Selecting the components to build ===
* build the latest ''stable'' release;
 
By default, <tt>download_and_compile.sh</tt> downloads or updates, then compiles, [[SimGear]] and FlightGear, and downloads or updates [[FGData]] (by nature, FGData can't be compiled). This is what happens when running:
$ download_and_compile.sh
The preceding command is therefore equivalent to:
$ download_and_compile.sh SIMGEAR FGFS DATA
 
To make <tt>download_and_compile.sh</tt> take care of other programs or libraries, use non-option arguments naming the ''components'' you want, for instance:
$ download_and_compile.sh SIMGEAR FGFS DATA OSG
SIMGEAR, FGFS, DATA and OSG are the component names respectively corresponding to [[SimGear]], FlightGear, [[FGData]] and [[OpenSceneGraph]] in <tt>download_and_compile.sh</tt>'s terminology.
 
A [[#list-of-available-components|list of available components]] is provided on this page, but the fully up-to-date list can always be obtained by running <code>download_and_compile.sh --help</code>.
 
=== Choosing between stable and development versions ===
 
By default, <tt>download_and_compile.sh</tt> fetches code and data from development branches of the source repositories (which sometimes causes compilation or runtime errors). However, it is possible to tell the script to download the latest ”stable” version of each component, for some suitable definition of “stable”. This is by means of the <code>-s</code> option:
$ download_and_compile.sh -s ''COMPONENT1 COMPONENT2...''
 
How does it work?
* For [[SimGear]], FlightGear and [[FGData]], it uses the most recent stable release branch of the corresponding Git repository.
* For some components, a known-stable version is hardcoded in <tt>download_and_compile.sh</tt> and used when the <code>-s</code> option is given<ref name="components-with-a-known-stable-version-hardcoded-in-download_and_compile_sh">As of May 2019, apart from SIMGEAR, FGFS and DATA, the only components for which <tt>download_and_compile.sh</tt> “knows” a stable version are TERRAGEAR and OPENRTI.</ref> (for instance, the hardcoded information can be the name of a Git branch).
* For the other components, the <code>-s</code> option has no effect.
 
{{Warning|In a given folder where <tt>download_and_compile.sh</tt> is run, you should either always use the <code>-s</code> option, or never. Building some components with <code>-s</code> and others without (all within the same base folder) is not supported.}}
 
Applying what we just said to the FGFS component (FlightGear) leaves us with two main options:
* build the latest stable release;
* build the current development version (bleeding edge), which lives in the {{flightgear source
* build the current development version (bleeding edge), which lives in the {{flightgear source
| branch = next
| branch = next
Line 429: Line 429:
}} branch of the FlightGear repository.
}} branch of the FlightGear repository.


=== Build the latest stable FlightGear release ===
==== Building the latest stable FlightGear release ====


When executing <tt>download_and_compile.sh</tt>, use the <code>-s</code> option to build the latest stable release:  
When executing <tt>download_and_compile.sh</tt>, use the <code>-s</code> option to build the latest stable release:  
Line 437: Line 437:
{{Note|If you decide to use the <code>-s</code> option in a given directory tree, you should use it for all components in that directory tree (SIMGEAR, FGFS, DATA, etc.). Running <tt>download_and_compile.sh</tt> in a given directory with the <code>-s</code> option for some components and not for others is not supported.}}
{{Note|If you decide to use the <code>-s</code> option in a given directory tree, you should use it for all components in that directory tree (SIMGEAR, FGFS, DATA, etc.). Running <tt>download_and_compile.sh</tt> in a given directory with the <code>-s</code> option for some components and not for others is not supported.}}


=== Build the current FlightGear development version ===
==== Building the current FlightGear development version ====


When executing <tt>download_and_compile.sh</tt> without any option, the latest development version is built:
When executing <tt>download_and_compile.sh</tt> without any option, the development version of every selected component is built:
  $ cd ~/flightgear/dnc-managed
  $ cd ~/flightgear/dnc-managed
  $ download_and_compile.sh
  $ download_and_compile.sh
(In this example, the implicitly-selected components are SIMGEAR, FGFS and DATA, as explained [[#selecting-the-components-to-work-on | above]].)


{{Note|The development version of FlightGear changes on an almost daily basis. It provides the latest features, but is not guaranteed to always work reliably. If you don't want to take the risk of finding new bugs when updating, you may prefer to use the latest stable release.}}
{{Note|The development version of FlightGear changes on an almost daily basis. It provides the latest features, but is not guaranteed to always work reliably. If you don't want to take the risk of finding new bugs when updating, you may prefer to use the latest stable release.}}
=== Passing custom arguments to CMake ===
Sometimes, when building a program, you may want to enable a feature that is not enabled by default, or disable a feature that is enabled by default. With recent versions of <tt>download_and_compile.sh</tt> (April 2019 or later), the environment variables <tt>SG_CMAKEARGS</tt> and <tt>FG_CMAKEARGS</tt> allow one to do that for SimGear and FlightGear. For instance, in order to link SimGear with the system Expat library, you can do:
$ SG_CMAKEARGS='-DSYSTEM_EXPAT=ON' download_and_compile.sh SIMGEAR
Similarly, disabling HID-based input when building FlightGear can be achieved this way:
$ FG_CMAKEARGS='-DENABLE_HID_INPUT=OFF' download_and_compile.sh FGFS
{{Note|Such options are typically defined in <tt>CMakeLists.txt</tt> files, for example {{simgear source
| path = CMakeLists.txt
| text = here
}} for SimGear and {{flightgear source
| path = CMakeLists.txt
| text = here
}} for FlightGear.}}
This can be useful for instance to work around bugs in a part of SimGear or FlightGear that you don't need, but causes a build or runtime failure (see {{forum link|t=35740|text=here}} for example). This is often convenient when using the development version of FlightGear, but doesn't mean such bugs shouldn't be reported!
If you have several such options to pass, just use spaces to separate them inside the quotes:
$ FG_CMAKEARGS='-DENABLE_SWIFT=ON -DENABLE_HID_INPUT=OFF' download_and_compile.sh FGFS
Of course, the same thing can also be achieved this way in Bourne-style shells:
$ export FG_CMAKEARGS='-DENABLE_SWIFT=ON -DENABLE_HID_INPUT=OFF'
$ download_and_compile.sh FGFS
It is also possible to set both <tt>SG_CMAKEARGS</tt> and <tt>FG_CMAKEARGS</tt> at the same time for a given <tt>download_and_compile.sh</tt> run:
$ export SG_CMAKEARGS='-DSYSTEM_EXPAT=ON'
$ export FG_CMAKEARGS='-DENABLE_SWIFT=ON -DENABLE_HID_INPUT=OFF'
$ download_and_compile.sh


=== Launching FlightGear ===
=== Launching FlightGear ===
Line 455: Line 484:
{{Note|<code>./run_fgfs.sh --launcher</code> starts FlightGear with its built-in launcher. If you just do <code>./run_fgfs.sh</code>, FlightGear will be started without any launcher, at the default airport and with the default aircraft.}}
{{Note|<code>./run_fgfs.sh --launcher</code> starts FlightGear with its built-in launcher. If you just do <code>./run_fgfs.sh</code>, FlightGear will be started without any launcher, at the default airport and with the default aircraft.}}


=== Launching FGRun ===
In order to start FlightGear without any launcher, at a given airport (say, [https://en.wikipedia.org/wiki/Paro_Airport Paro airport], whose ICAO code is VQPR) and with a chosen aircraft, you can do:
 
{{Note|As of 2019, FGRun has been superseded by the [[FlightGear Qt launcher|FlightGear built-in launcher]]. The built-in launcher is the most actively maintained launcher for FlightGear. Other launchers are [[FFGo]] and [[FGX|FGx]].}}
 
[[File:fgrun-page2.jpg|thumb|right]]
Before FlightGear had its built-in launcher (the one you get with <code>run_fgfs.sh --launcher</code>), many users found comfortable having FlightGear launched by the graphical utility [[Fgrun|FGRun]], which is built and installed when <tt>download_and_compile.sh</tt> is run with the FGRUN component. You then have to launch the <tt>run_fgrun.sh</tt> command, for example:
  $ cd ~/flightgear/dnc-managed
  $ cd ~/flightgear/dnc-managed
  $ ./run_fgrun.sh
  $ ./run_fgfs.sh --airport=VQPR --aircraft=dhc6
 
Actually, the directory change is not needed, we only gave it here for readability. Therefore, the following single command does the same:
FGRun will save its settings in <tt>~/.fltk/flightgear.org/fgrun.prefs</tt>. You may want to save copies of the preferences customized for stable and next.
$ ~/flightgear/dnc-managed/run_fgfs.sh --airport=VQPR --aircraft=dhc6
 
=== Launching FGo! ===


{{Note|As of 2019, FGo! is not maintained anymore. You may want to try the built-in launcher (started with <code>run_fgfs.sh --launcher</code>) or [[FFGo]].}}
=== <span id="avoiding-multiple-downloads-of-fgdata"></span> Avoiding multiple downloads of FGData ===
 
[[File:Fgo01.jpg|thumb|left]]
FGo! is a graphical utility written in [[python]]. It is downloaded and installed when <tt>download_and_compile.sh</tt> is run with the FGO component. You then have to launch the <tt>run_fgo.sh</tt> command, for example:
$ cd ~/flightgear/dnc-managed
$ ./run_fgo.sh
 
Remember that the first time you run it, you have to go to open the ''Preferences'' dialog and set the paths to the <tt>fgfs</tt> executable and to FGData.
 
=== Avoiding multiple downloads of FGData ===


Some people use <tt>download_and_compile.sh</tt> to maintain several directory trees such as the tree starting at <tt>~/flightgear/dnc-managed</tt> in [[#getting-started-with-download-and-compile-sh|Getting started with <tt>download_and_compile.sh</tt>]] (this can be useful if you want to have one tree with programs compiled in Release mode and another tree where they are built in Debug mode, for instance). This can easily be done by running <tt>download_and_compile.sh</tt> in each of the directories. But since [[FGData]] is so large, it may be tempting to share a single instance of this repository among several trees. This is not officially supported, but apparently can be made to work with symbolic links.
Some people use <tt>download_and_compile.sh</tt> to maintain several directory trees such as the tree starting at <tt>~/flightgear/dnc-managed</tt> in [[#getting-started-with-download-and-compile-sh|Getting started with <tt>download_and_compile.sh</tt>]] (this can be useful if you want to have one tree with programs compiled in Release mode and another tree where they are built in Debug mode, for instance). This can easily be done by running <tt>download_and_compile.sh</tt> in each of the directories. But since [[FGData]] is so large, it may be tempting to share a single instance of this repository among several trees. This is not officially supported, but apparently can be made to work with symbolic links.
Line 492: Line 505:
{{Warning|This can only work simply if all trees that share a given FGData repository are from the same release (e.g., current stable or development). Running a “stable“ FlightGear with FGData from the ''next'' branch or the other way round, a development version of FlightGear with FGData from a release branch, doesn't work—and FlightGear should tell you when you start it in such a situation.
{{Warning|This can only work simply if all trees that share a given FGData repository are from the same release (e.g., current stable or development). Running a “stable“ FlightGear with FGData from the ''next'' branch or the other way round, a development version of FlightGear with FGData from a release branch, doesn't work—and FlightGear should tell you when you start it in such a situation.


That said, people comfortable with Git can check out the correct FGData branch before starting FlightGear, for instance:
That said, people comfortable with Git can check out the correct FGData branch before building or starting FlightGear, for instance:
  $ cd /path/to/fgdata && git checkout release/2019.1
  $ cd /path/to/fgdata && git checkout release/2019.1
or
or
Line 502: Line 515:
== Additional programs ==
== Additional programs ==


If you wish to get other programs, you need to launch <tt>download_and_compile.sh</tt> with the desired component names as arguments. For instance:
{{Note|In this section, we assume you've read and followed the advice given in [[#getting-started-with-download-and-compile-sh|Getting started with <tt>download_and_compile.sh</tt>]].}}
 
If you wish to get other programs (precisely: download, build and install them), you need to launch <tt>download_and_compile.sh</tt> with the desired component names as arguments. For instance:
  $ cd ~/flightgear/dnc-managed
  $ cd ~/flightgear/dnc-managed
  $ download_and_compile.sh SIMGEAR FGFS DATA OSG
  $ download_and_compile.sh SIMGEAR FGFS DATA OSG


The available components are (in April 2019):<br />
See [[#list-of-available-components|above]] for the list of available components.
CMAKE, PLIB, OPENRTI, OSG, SIMGEAR, FGFS, DATA, FGRUN, FGO, FGX, OPENRADAR, ATCPIE, TERRAGEAR, TERRAGEARGUI.
 
=== TerraGear ===
 
Run <tt>download_and_compile.sh</tt> with the TERRAGEAR component in order to build and install the [[TerraGear]] terrain building toolchain:
$ cd ~/flightgear/dnc-managed
$ download_and_compile.sh TERRAGEAR
 
This creates the following scripts in <tt>~/flightgear/dnc-managed</tt>:
* <tt>run_genapts850.sh</tt>
* <tt>run_ogr-decode.sh</tt>
* <tt>run_tg-construct.sh</tt>
These scripts themselves run the corresponding TerraGear tools, as expected.


The full, up-to-date list of these components can always be obtained by running:
=== TerraGear GUI ===
  $ download_and_compile.sh --help
 
[[TerraGear GUI]] is a graphical interface for [[TerraGear]] written with the Qt toolkit (still Qt 4 in 2019, but it works). In order to install it, run <tt>download_and_compile.sh</tt> with the TERRAGEARGUI component:
$ cd ~/flightgear/dnc-managed
  $ download_and_compile.sh TERRAGEARGUI
This will create a <tt>run_terrageargui.sh</tt> script in <tt>~/flightgear/dnc-managed</tt>, and also a default configuration file <tt>~/.config/TerraGear/TerraGearGUI.conf</tt>, unless you already have one. This default configuration file contains paths to the TerraGear and [[$FG_ROOT]] directories, assuming you have installed the TERRAGEAR and DATA components.
 
To run TerraGear GUI:
$ cd ~/flightgear/dnc-managed
$ ./run_terrageargui.sh


=== Launching FGCOM ===
=== FGCom ===


{{Note|[[FGCom]] has been integrated into FlightGear long ago, therefore the following is not needed in general.}}
{{Note|[[FGCom]] has been integrated into FlightGear long ago, therefore the following is not needed in general.}}


[[FGCom]] is the system used by FlightGear to simulate radio communications between users. Launch it using the <tt>run_fgcom.sh</tt> script:
[[FGCom]] is the system used by FlightGear to simulate radio communications between users. It is automatically built and installed when you tell <tt>download_and_compile.sh</tt> to take care of the FGFS component. You can launch the standalone FGCom program by using the <tt>run_fgcom.sh</tt> script:
  $ cd ~/flightgear/dnc-managed
  $ cd ~/flightgear/dnc-managed
  $ ./run_fgcom.sh
  $ ./run_fgcom.sh
=== FGRun ===
{{Note|As of 2019, FGRun has been superseded by the [[FlightGear Qt launcher|FlightGear built-in launcher]]. The built-in launcher is the most actively maintained launcher for FlightGear. Other launchers are [[FFGo]] and [[FGX|FGx]].}}
[[File:fgrun-page2.jpg|thumb|right]]
Before FlightGear had its built-in launcher (the one you get with <code>run_fgfs.sh --launcher</code>), many users found comfortable having FlightGear launched by the graphical utility [[Fgrun|FGRun]]. This program is built and installed when <tt>download_and_compile.sh</tt> is run with the FGRUN component. You then have to launch the <tt>run_fgrun.sh</tt> command, for example:
$ cd ~/flightgear/dnc-managed
$ ./run_fgrun.sh
FGRun will save its settings in <tt>~/.fltk/flightgear.org/fgrun.prefs</tt>. You may want to save copies of the preferences customized for stable and next.
=== FGo! ===
{{Note|As of 2019, FGo! is not maintained anymore. You may want to try the built-in launcher (started with <code>run_fgfs.sh --launcher</code>) or [[FFGo]].}}
[[File:Fgo01.jpg|thumb|left]]
FGo! is a graphical utility written in [[python]]. It is downloaded and installed when <tt>download_and_compile.sh</tt> is run with the FGO component. You then have to launch the <tt>run_fgo.sh</tt> command, for example:
$ cd ~/flightgear/dnc-managed
$ ./run_fgo.sh
Remember that the first time you run it, you have to go to open the ''Preferences'' dialog and set the paths to the <tt>fgfs</tt> executable and to FGData.


== Troubleshooting ==
== Troubleshooting ==
Line 536: Line 592:
  $ rm -rf build/* install/simgear/ install/openrti/ install/flightgear/share/ install/flightgear/bin/
  $ rm -rf build/* install/simgear/ install/openrti/ install/flightgear/share/ install/flightgear/bin/


See [https://forum.flightgear.org/viewtopic.php?f=45&t=26244 this thread] for more details.
See {{forum link|t=26244|text=this thread}} for more details.


== Options ==
== Options ==


By default, <tt>download_and_compile.sh</tt> downloads or updates, then compiles, [[SimGear]] and FlightGear, and downloads or updates [[FGData]] (by nature, FGData can't be compiled). This is what happens when running:
=== Multicore acceleration ===
$ download_and_compile.sh
To make it download or update and compile something else, you may pass non-option arguments naming the ''components'' you want, for instance:
$ download_and_compile.sh SIMGEAR FGFS DATA OSG
SIMGEAR, FGFS, DATA and OSG are the component names respectively corresponding to [[SimGear]], FlightGear, [[FGData]] and [[OpenSceneGraph]] in <tt>download_and_compile.sh</tt>'s terminology.
 
See the output of <code>download_and_compile.sh --help</code> for more details.
 
=== Compiling only one program ===
 
{{Note|The following is not necessarily up-to-date. See the output of <code>download_and_compile.sh --help</code> for the up-to-date list of components.}}
 
If you wish to recompile only one of the programs you can launch the script with one of the following parameters:
* CMAKE (to compile and install only cmake)
* PLIB (to compile and install only plib)
* OSG (to compile and install only OpenSceneGraph)
* SIMGEAR (to compile and install only Simgear)
* FGFS (to compile and install only FlightGear)
* DATA (to download / update only data files for FlightGear)
* FGRUN (to compile and install only Fgrun)
* TERRAGEAR (to compile and install only terragear!)
* TERRAGEARGUI (to compile and install only terrageargui!)
* OPENRADAR (to compile and install only OpenRadar!)
* FGO (to compile and install only Fgo!)
 
=== Compiling the last known-stable versions ===
 
Even if <tt>download_and_compile.sh</tt> fetches code and data from development branches of the source repositories by default (which sometimes causes compilation errors), it is possible to tell the script to download the latest known versions of the software that were compiling successfully by means of the <code>-s</code> option:
$ download_and_compile.sh -s


How does it work?
* For [[SimGear]], FlightGear and [[FGData]], it uses the most recent stable release branch of the corresponding Git repository.
* For some components, a known-stable version is hardcoded in <tt>download_and_compile.sh</tt> and used when the <code>-s</code> option is given<ref name="components-with-a-known-stable-version-hardcoded-in-download_and_compile_sh">As of May 2019, apart from SIMGEAR, FGFS and DATA, the only components for which <tt>download_and_compile.sh</tt> “knows” a stable version are TERRAGEAR and OPENRTI.</ref> (for instance, the hardcoded information can be the name of a Git branch).
* For the other components, the <code>-s</code> option has no effect.


{{Warning|In a given folder where <tt>download_and_compile.sh</tt> is run, you should either always use the <code>-s</code> option, or never. Building some components with <code>-s</code> and others without (all within the same base folder) is not supported.}}
Passing option <code>-j x</code> to <tt>download_and_compile.sh</tt> (where ''x'' is the number of your CPU cores you wish to assign to the job) will considerably speed up the compilation steps.


=== Advanced options ===
=== Advanced options ===
Line 594: Line 618:


This command will only rebuild modified files and reinstall FlightGear. Note that depending on the kind of changes you made, reconfiguring and thus dropping the <code>-d n</code> option may be necessary, though (this is the case in particular if you added or removed C++ files).
This command will only rebuild modified files and reinstall FlightGear. Note that depending on the kind of changes you made, reconfiguring and thus dropping the <code>-d n</code> option may be necessary, though (this is the case in particular if you added or removed C++ files).
=== Multicore Acceleration ===
Using the option <code>-j x</code> (where ''x'' is the number of your CPU cores you wish to assign to the job) will speed up the whole compilation process considerably.


== Optimus technology ==
== Optimus technology ==
Line 607: Line 628:
The same can be done for the [[FlightGear_Launch_Control|FGRun]] launcher:
The same can be done for the [[FlightGear_Launch_Control|FGRun]] launcher:
  $ sed  's|\./fgrun|optirun ./fgrun|' run_fgrun.sh > run_fgrun_optirun.sh && chmod +x run_fgrun_optirun.sh
  $ sed  's|\./fgrun|optirun ./fgrun|' run_fgrun.sh > run_fgrun_optirun.sh && chmod +x run_fgrun_optirun.sh
== Remove warning message for DDS files ==
You can remove the warning message displayed when DDS files are parsed by SimGear by adding the following line just after '''cd "simgear"''' line :
$ sed -i s/SG_ALERT,\ \"Image/SG_WARN,\ \"Image/g simgear/scene/model/ModelRegistry.cxx


== See also ==
== See also ==
Line 617: Line 634:
| path = compile-scripts
| path = compile-scripts
| text = Other FlightGear build scripts
| text = Other FlightGear build scripts
}} can be found in [[FGMeta]].
}} present in [[FGMeta]]
* Another script for building FlightGear and all its dependencies in an automated fashion can be found [http://geoffmclane.com/fg/fgfs-052.htm here]. The page seems a bit oldish, though (as of 2019).
* {{fgmeta source
| path = fg-from-scratch
| simplepath = true
}}
* [http://geoffmclane.com/fg/fgfs-052.htm Another script] for building FlightGear and all its dependencies in an automated fashion. The page seems a bit oldish, though (as of 2019).


== References ==
== References ==
Line 625: Line 646:
[[Category:Building from source]]
[[Category:Building from source]]


[[fr:Script de compilation sous Linux Debian/Ubuntu]]
[[nl:Compileren met een Script op Linux Debian/Ubuntu]]
[[nl:Compileren met een Script op Linux Debian/Ubuntu]]
[[fr:Script de compilation sous Linux Debian/Ubuntu]]
185

edits

Navigation menu