Scripted Compilation on Linux Debian/Ubuntu: Difference between revisions

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)
(Fix header levels)
(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))
Line 16: Line 16:


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 ==
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).
With an Intel Core i7 860 CPU (2.80 GHz) purchased in 2009, compiling [[SimGear]] and FlightGear 2019.2 with option <code>-j8</code> takes about 14 minutes. If you don't have a fast machine and build using only one core, it may require several hours.
== Download ==
You can get <tt>download_and_compile.sh</tt> {{fgmeta source
| path = download_and_compile.sh
| text = from FGMeta
}}. It is contained in the [[FGMeta]] repository, which is maintained by the FlightGear developers. The script can be downloaded from the link given above, however, for easier updates and in order to have the command <code>download_and_compile.sh --version</code> work as intended, it is recommended to get it as explained [[#getting-download-and-compile-sh-using-an-fgmeta-clone|below]].
In case you build stable versions of FlightGear using the <code>-s</code> option of <tt>download_and_compile.sh</tt>, remember to update the script before trying to build a new version of FlightGear (see [[#updating-download-and-compile-sh-using-an-fgmeta-clone|Updating <tt>download_and_compile.sh</tt>]] below). Of course, you can update it more often in order to benefit from new features or bug fixes; this is especially useful if you are building ''next'', that is, the development branch of FlightGear.
== <span id="getting-started-with-download-and-compile-sh"></span> Getting started with <tt>download_and_compile.sh</tt> ==
Because of technical problems at SourceForge (cloning [[FGData]] using the https protocol usually fails), the initial setup is unfortunately more complex than it used to be. You'll be guided step by step though, so don't be afraid. Besides, once you have a complete clone of the FGData repository, all future operations will be really easy.
We'll first explain how to get <tt>download_and_compile.sh</tt> in a way that makes it convenient to update and causes the command <code>download_and_compile.sh --version</code> to work as intended (the reported “version” is a Git blob id such as <tt>6a5e4f05e2ccf27115eec58313be027b11266097</tt><ref name="note-on-download-and-compile-sh-version-being-a-Git-blob-id">This looks like, but is ''not'' a Git commit identifier. This kind of “version number” is admittedly not very pretty, but it doesn't pollute Git commits  (the diffs) and is automatically updated by Git every time you update <tt>download_and_compile.sh</tt> the way we present here; thus, the advantages compensate for the ugliness.</ref>). Then we'll show how to clone the large FGData repository, and finally give instructions to get FlightGear up and running.
=== <span id="getting-started-with-download-and-compile-sh-notations"></span> Notations ===
When a command should be run as an unpriviledged user, it will be preceded by a dollar sign:
$ whoami
toto
In contrast, a hash sign (#) means that the command must be run with superuser privileges to achieve the desired effect:
# whoami
root
In order to make instructions easy to understand, two directories (= folders) will be consistently used for the same purpose below:
* <tt>~/flightgear/fgmeta</tt> will contain a clone of the [[FGMeta]] repository; therefore, <tt>download_and_compile.sh</tt> will reside in that directory;
* <tt>~/flightgear/dnc-managed</tt> will be the directory from which we run <tt>download_and_compile.sh</tt>. In other words, with this setup, a typical sequence of commands could be:
$ cd ~/flightgear/dnc-managed
$ ~/flightgear/fgmeta/download_and_compile.sh SIMGEAR FGFS DATA
These are of course just examples. The aforementioned paths are not hardwired anywhere in the script; you are free to choose the directories you want for these purposes.
=== <span id="getting-download-and-compile-sh-using-an-fgmeta-clone"></span> Getting <tt>download_and_compile.sh</tt> the “right way” ===
There are several ways to obtain [https://sourceforge.net/p/flightgear/fgmeta/ci/next/tree/download_and_compile.sh download_and_compile.sh]. The method described here makes it very easy to update the script and causes the command <code>download_and_compile.sh --version</code> to work as intended.
As explained in [[#getting-started-with-download-and-compile-sh-notations|Notations]], we want to clone the [[FGMeta]] repository in <tt>~/flightgear/fgmeta</tt>. Let's go:
$ mkdir -p ~/flightgear
$ cd ~/flightgear
<nowiki>$ git clone https://git.code.sf.net/p/flightgear/fgmeta</nowiki>
You now have a fresh FGMeta clone in <tt>~/flightgear/fgmeta</tt> and your brand new <tt>download_and_compile.sh</tt> script is located in that directory. You can already try it to see the available options:
<pre>$ ~/flightgear/fgmeta/download_and_compile.sh --help
download_and_compile.sh [OPTION...] [--] [COMPONENT...]
Download and compile components belonging to the FlightGear ecosystem.
Without any COMPONENT listed, or if ALL is specified, recompile all
components listed in the WHATTOBUILDALL variable. Each COMPONENT may
be one of the following words:
  ALL, CMAKE, OSG, PLIB, OPENRTI, SIMGEAR, FGFS, DATA, FGRUN, FGO, FGX,
  OPENRADAR, ATCPIE, TERRAGEAR, TERRAGEARGUI
Available options:
  -h, --help    show this help message and exit
      --version print version and license information, then exit
(...)</pre>
=== <span id="updating-download-and-compile-sh-using-an-fgmeta-clone"></span> Updating <tt>download_and_compile.sh</tt> ===
Now that you have <tt>download_and_compile.sh</tt> from the [[FGMeta]] repository, it is very easy to update (this assumes you didn't modify anything yourself inside <tt>~/flightgear/fgmeta</tt>!):
$ cd ~/flightgear/fgmeta && git pull
If you want to keep updates as easy as we just shown, it is best not to modify <tt>download_and_compile.sh</tt> yourself. <tt>download_and_compile.sh</tt> has plenty of options that usually make it unnecessary to modify the script. Just run <code>download_and_compile.sh --help</code> and learn about the available options when you feel the need to change something. Unless you have special needs that can only be accomodated by modifying <tt>download_and_compile.sh</tt>, you are invited to skip to the next section.
If you really, ''really'' want to modify <tt>download_and_compile.sh</tt> while keeping updates easy, a good technique is to add your changes to your FGMeta clone in the form of one or more Git ''commits'' (no need to push them anywhere, commits can remain in your clone). How to do that is beyond the scope of this document, though; read Git tutorials if you want to learn it (there are plenty on the Internet). Once you have committed your changes to your FGMeta clone, make sure the repository is clean (use <code>git status</code>), then update it with:
$ cd ~/flightgear/fgmeta && git pull --rebase
This will apply your commits on top of the latest commit of the branch that is currently checked out, which so far contained the official version of <tt>download_and_compile.sh</tt>. In case your changes conflict with the update, Git will tell you and you'll have to resolve the conflict manually (look for “Git resolve conflict” on your favorite search engine)... or start again from a pristine [[FGMeta]] clone.
=== <span id="using-download-and-compile-sh-to-build-flightgear"></span> Building FlightGear ===
For the method described below, you'll need an account at [https://sourceforge.net/ SourceForge] (this is unfortunate, but methods that don't require such an account are either unreliable or insecure, as long as [[FGData]] can't be cloned using the <tt>https</tt> protocol). If you don't already have one, go to the [https://sourceforge.net/user/registration registration page] and create an account. In all this section, we'll assume that your account name at SourceForge is ''SFusername''.
In what follows, we won't give the full path to <tt>download_and_compile.sh</tt> when showing commands to be run, but you should prepend it to <tt>download_and_compile.sh</tt> whenever you see a <tt>download_and_compile.sh</tt> command. For instance, if you used the same path as in [[#getting-started-with-download-and-compile-sh-notations|Notations]] and see the command:
$ download_and_compile.sh --help
what you should actually run is:
$ ~/flightgear/fgmeta/download_and_compile.sh --help
Apart from this harmless command, ''do not'' run other <tt>download_and_compile.sh</tt> commands from an arbitrary directory, in particular ''don't'' run them from <tt>~/flightgear/fgmeta</tt>. This is because '''most other <tt>download_and_compile.sh</tt> commands write to the current directory''' (<code>download_and_compile.sh --help</code> and <code>download_and_compile.sh --version</code> are safe to run from any directory, though).
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.
'''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.}}
{{Note|As explained in [[#getting-started-with-download-and-compile-sh-notations|Notations]], we assume that your Unix user name (login) is <tt>toto</tt>. Don't confuse the <tt>sudo</tt> password prompt (where you need to enter <tt>toto</tt>'s password) with the password prompt for your SourceForge account! The former appears as
[sudo] password for toto:
whereas the latter is just:
Password:
}}
{{Tip|In case you want to run some other program instead of <tt>sudo</tt>, this can be done with the <code>--sudo</code> option of <tt>download_and_compile.sh</tt>. For instance, in order to see the commands that would be run with sudo without actually running them, you can pass <code><nowiki>--sudo=echo</nowiki></code> to <tt>download_and_compile.sh</tt>. Like all other options, <code><nowiki>--sudo</nowiki></code> must be given ''before'' all arguments that are component names (such as <tt>SIMGEAR</tt>, <tt>FGFS</tt>, <tt>DATA</tt>, etc.).}}
The package manager used by <tt>download_and_compile.sh</tt> by default is <tt>apt-get</tt>. You can use another one if you want, as long as it supports the following calls:
''pkg-mgr'' update
''pkg-mgr'' install ''pkg1 pkg2'' ...
This is the case for <tt>aptitude</tt> as well as <tt>apt</tt>. If you want <tt>download_and_compile.sh</tt> to use <tt>aptitude</tt>, give it the option <code><nowiki>--package-manager=aptitude</nowiki></code> before any of the ''COMPONENT'' arguments.
All options of <tt>download_and_compile.sh</tt> can be seen by running the following command:
$ download_and_compile.sh --help
Now the instructions we promised you. You have chosen a dedicated directory where all the stuff that is downloaded and built by <tt>download_and_compile.sh</tt> will be stored. This is <tt>~/flightgear/dnc-managed</tt> in our example, and should be empty before you run <tt>download_and_compile.sh</tt> for the first time. However, it is quite correct to start <tt>download_and_compile.sh</tt> from the same directory for subsequent runs, even when non-empty (otherwise, <tt>download_and_compile.sh</tt> would automatically reclone the repositories every time you run it; that would be a sheer waste of time and bandwidth).
Ready? Let's go!
<pre>$ mkdir -p ~/flightgear/dnc-managed
$ cd ~/flightgear/dnc-managed
$ download_and_compile.sh --git-clone-site-params SourceForge=ssh:SFusername DATA
**********************************************************************
*                                                                    *
* Warning: a typical SimGear + FlightGear + FGData build requires    *
* about 12 GiB of disk space. The compilation part may last from a  *
* few minutes to hours, depending on your computer.                  *
*                                                                    *
* Hint: use the -j option if your CPU has several cores, as in:      *
*                                                                    *
*        download_and_compile.sh -j$(nproc)                        *
*                                                                    *
**********************************************************************
Running 'apt-get update'...
[sudo] password for toto:
(...)
Considering a package alternative: libcurl4-openssl-dev libcurl4-gnutls-dev
Package alternative matched for libcurl4-openssl-dev
Running 'apt-get install build-essential git libcurl4-openssl-dev cmake'...
[sudo] password for toto:
(...)
****************************************
**************** DATA ******************
****************************************
Fetching DATA with 'git clone ssh://SFusername@git.code.sf.net/p/flightgear/fgdata'
Cloning into '.'...
The authenticity of host 'git.code.sf.net (216.105.38.16)' can't be established.
ECDSA key fingerprint is SHA256:FeVkoYYBjuQzb5QVAgm3BkmeN5TTgL2qfmqz9tCPRL4.
Are you sure you want to continue connecting (yes/no)?
Warning: Permanently added 'git.code.sf.net,216.105.38.16' (ECDSA) to the list of known hosts.
Connection closed by 216.105.38.16 port 22
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
</pre>
The above messages are perfectly normal but deserve a little explanation. Here, <tt>ssh</tt> asked us to confirm that the fingerprint sent by the remote host is that of the real <tt>git.code.sf.net</tt>, as opposed to that of some malicious server ''pretending'' to be <tt>git.code.sf.net</tt>. This confirmation only has to be done once, after which it is remembered thanks to <tt>~/.ssh/known_hosts</tt>. You should visit the [https://sourceforge.net/p/forge/documentation/SSH%20Key%20Fingerprints/#fingerprint-listing page that gives the host key fingerprint of every publically-accessible SSH server at SourceForge] and carefully check that the fingerprint appearing on your terminal is listed on that page for <tt>git.code.sf.net</tt>, or some matching pattern such as <tt>*.code.sf.net</tt>.
If the fingerprint that is printed on your terminal is not listed on that page, answer <tt>no</tt> to the question ''Are you sure you want to continue connecting (yes/no)?'' and copy/paste to flightgear-devel (see [[Mailing lists]]) the above message from <tt>ssh</tt> that contains the fingerprint sent to you by the remote host which pretends to be <tt>git.code.sf.net</tt>. If this happened, you should stop here and wait for answers from readers of flightgear-devel.
From now on, we'll assume that the fingerprint you received was correct, and therefore that you have answered <tt>yes</tt> to the ''Are you sure you want to continue connecting (yes/no)?'' question.
In this example, it took us several minutes to verify the fingerprint of the <tt>git.code.sf.net</tt> server and confirm it to <tt>ssh</tt>. Because of this delay, <tt>git.code.sf.net</tt> hung up on us and closed the connection. This is absolutely ''not a problem:'' we can just rerun the <tt>download_and_compile.sh</tt> command with the same arguments as the first time. Since we answered <tt>yes</tt> to the ''Are you sure you want to continue connecting (yes/no)?'' prompt, the fingerprint of <tt>git.code.sf.net</tt>'s key has been stored in <tt>~/.ssh/known_hosts</tt>, therefore we won't get this prompt anymore. But if some server claiming to be <tt>git.code.sf.net</tt> presents a host key that has a different fingerprint in the future, <tt>ssh</tt> will print a big fat warning that the server may belong to an attacker trying to impersonate <tt>git.code.sf.net</tt>. Therefore, this SSH host key verification is very useful to protect us from future attacks (which hopefully won't happen at all).
As said, we just rerun the <tt>download_and_compile.sh</tt> command with the same arguments:
<pre>$ download_and_compile.sh --git-clone-site-params SourceForge=ssh:SFusername DATA
**********************************************************************
*                                                                    *
* Warning: a typical SimGear + FlightGear + FGData build requires    *
* about 12 GiB of disk space. The compilation part may last from a  *
* few minutes to hours, depending on your computer.                  *
*                                                                    *
* Hint: use the -j option if your CPU has several cores, as in:      *
*                                                                    *
*        download_and_compile.sh -j$(nproc)                        *
*                                                                    *
**********************************************************************
Running 'apt-get update'...
[sudo] password for toto:
(...)
Considering a package alternative: libcurl4-openssl-dev libcurl4-gnutls-dev
Package alternative matched for libcurl4-openssl-dev
Running 'apt-get install build-essential git libcurl4-openssl-dev cmake'...
[sudo] password for toto:
(...)
****************************************
**************** DATA ******************
****************************************
Fetching DATA with 'git clone ssh://SFusername@git.code.sf.net/p/flightgear/fgdata'
Cloning into '.'...
Password:</pre>
As explained above, the preceding prompt is for your SourceForge password (which you could guess from the <code><nowiki>git clone ssh://SFusername@git.code.sf.net/p/flightgear/fgdata</nowiki></code> command).
<pre>remote: Enumerating objects: 67011, done.
remote: Counting objects: 100% (67011/67011), done.
remote: Compressing objects: 100% (31342/31342), done.
remote: Total 67011 (delta 38776), reused 59640 (delta 33570)
Receiving objects: 100% (67011/67011), 2.60 GiB | 313.00 KiB/s, done.
Resolving deltas: 100% (38776/38776), done.
Checking out files: 100% (12959/12959), done.
Password:</pre>
(It will take a fair amount of time to get there, because this is the complete download of [[FGData]].)<br />
This is again a prompt for your SourceForge password, because <tt>download_and_compile.sh</tt> wants to run <code>git pull --rebase</code> in the repository (admittedly, it's a bit dumb after a <tt>clone</tt> operation—please forgive us). In case you were not monitoring the <tt>clone</tt> operation, you probably saw the password prompt way after <tt>git.code.sf.net</tt> got bored waiting for you and closed our second connection:
<pre>Connection closed by 216.105.38.16 port 22
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.</pre>
(if not, there should be no error message and you should have a clean FGData clone)<br />
No worries. Just as before, simply rerun the command with the same arguments:
<pre>$ download_and_compile.sh --git-clone-site-params SourceForge=ssh:SFusername DATA
**********************************************************************
*                                                                    *
* Warning: a typical SimGear + FlightGear + FGData build requires    *
* about 12 GiB of disk space. The compilation part may last from a  *
* few minutes to hours, depending on your computer.                  *
*                                                                    *
* Hint: use the -j option if your CPU has several cores, as in:      *
*                                                                    *
*        download_and_compile.sh -j$(nproc)                        *
*                                                                    *
**********************************************************************
Running 'apt-get update'...
[sudo] password for toto:
(...)
Considering a package alternative: libcurl4-openssl-dev libcurl4-gnutls-dev
Package alternative matched for libcurl4-openssl-dev
Running 'apt-get install build-essential git libcurl4-openssl-dev cmake'...
[sudo] password for toto:
(...)
****************************************
**************** DATA ******************
****************************************
DATA: the repository already exists
Password:
Already up to date.
Current branch next is up to date.
Already on 'next'
Your branch is up to date with 'origin/next'.
All optional package alternatives have found a matching package.
download_and_compile.sh has finished to work.
</pre>
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:
[remote "origin"]
        url = ssh://''SFusername''@git.code.sf.net/p/flightgear/fgdata
        fetch = +refs/heads/*:refs/remotes/origin/*
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):
$ download_and_compile.sh
or
$ download_and_compile.sh -j$(nproc)
(<code>-j$(nproc)</code> is “only” useful to save time—see the tip below).
When you don't pass any non-option argument to <tt>download_and_compile.sh</tt> as done here, it takes care of the three base components needed to run FlightGear: <tt>SIMGEAR</tt>, <tt>FGFS</tt> and <tt>DATA</tt> (these are the component names used by <tt>download_and_compile.sh</tt>, i.e., the final arguments one can optionally give in a <tt>download_and_compile.sh</tt> command; in normal speech, they correspond to the {{simgear source
| text = SimGear
}}, {{flightgear source
| text = FlightGear
}} and {{fgdata source
| text = FGData
}} repositories). Therefore, the above command is presently exactly equivalent to:
$ download_and_compile.sh SIMGEAR FGFS DATA
In case you wanted to build another component such as [[OpenSceneGraph|OSG]], you could add it to the command, like this:
$ download_and_compile.sh SIMGEAR FGFS DATA OSG
(With current Debian stable, this is not necessary because it has OpenSceneGraph 3.4. But if your distribution only has an older version, you'll certainly need to select the <tt>OSG</tt> component like this.)
When the command terminates, you should have a script called <tt>run_fgfs.sh</tt> in the directory <tt>~/flightgear/dnc-managed</tt> from which you ran <tt>download_and_compile.sh</tt>. This will be your script to run FlightGear. For instance, in order to start the built-in launcher, you can run the following commands:<ref name="no-need-to-change-to-dnc-managed-dir-before-starting-generated-scripts">We give these commands because they are easy to read, but the <code>cd</code> command is not needed if you use the correct path, as in <code>~/flightgear/dnc-managed/run_fgfs.sh --launcher</code>.</ref>
$ cd ~/flightgear/dnc-managed
$ ./run_fgfs.sh --launcher
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!).
{{Tip|You can considerably speed up the build process—literally, save hours—by telling <tt>download_and_compile.sh</tt> to use several cores simultaneously when compiling. With option <code>-j$(nproc)</code>, compilations will use all cores available on your processor; thus, a typical <tt>download_and_compile.sh</tt> command is <code>download_and_compile.sh -j$(nproc)</code>. If you want to use, say, 4 cores, replace <code>-j$(nproc)</code> with <code>-j4</code>.}}
=== <span id="using-download-and-compile-sh-to-update-flightgear"></span> Updating FlightGear ===
Just go to the directory from which you you previously ran <tt>download_and_compile.sh</tt> (<tt>~/flightgear/dnc-managed</tt> in our example). This is the folder which, if you did a complete run of <tt>download_and_compile.sh</tt> as shown in the previous section, contains the <tt>run_fgfs.sh</tt> script and a log file named <tt>compilation_log.txt</tt> that records what <tt>download_and_compile.sh</tt> did in its last run. If you wish to update, say, {{simgear source
| text = SimGear
}}, {{flightgear source
| text = FlightGear
}} and {{fgdata source
| text = FGData
}}, simply execute this:
$ download_and_compile.sh -pn SIMGEAR FGFS DATA
We'll explain the <code>-pn</code> in a minute. <tt>SIMGEAR</tt>, <tt>FGFS</tt> and <tt>DATA</tt> are called ''components'' in <tt>download_and_compile.sh</tt> terminology. A component generally corresponds to a software repository, or something close. In fact, since <tt>SIMGEAR</tt>, <tt>FGFS</tt> and <tt>DATA</tt> are often precisely the components people wish to update, they form the default components set, so that the previous command is equivalent to:
$ download_and_compile.sh -pn
Now about this <code>-pn</code>. It is equivalent to <code>-p n</code> and means “don't install packages from my (Linux) distribution” (<code>y</code> means ''yes, please install'', <code>n</code> means ''no, don't install''). In case you forgot that, simply run:
$ download_and_compile.sh --help
What does it imply to pass <code>-pn</code>? This tells <tt>download_and_compile.sh</tt> to completely skip the step where it checks for needed packages from your distribution and installs them, by default using <tt>apt-get</tt>. It thus goes straight to the following steps:
* update each repository corresponding to one of the selected components (<tt>SIMGEAR</tt>, <tt>FGFS</tt> and <tt>DATA</tt> in our example);
* compile each selected component that requires compilation;
* install each selected component in the appropriate place (under <tt>~/flightgear/dnc-managed</tt> according to our [[#getting-started-with-download-and-compile-sh-notations|Notations]]).
In case you don't have all required dependencies for the selected components, one of them is likely to fail, of course, since by passing <code>-pn</code> to <tt>download_and_compile.sh</tt>, you forbid it to install these dependencies for you. So, you can also very well update without passing the <code>-pn</code> option, it will simply take a little longer (the time to check if all dependencies of the selected components are available with <tt>APT</tt>). In fact, this is '''what you should do if the previous <tt>download_and_compile.sh</tt> run failed:''' first update <tt>download_and_compile.sh</tt> (see [[#getting-download-and-compile-sh-using-an-fgmeta-clone|above]]) then run it ''without'' <code>-pn</code><ref name="passing-no-pn-option-equals-passing-py">Which is the same as passing <code>-py</code>.</ref> in case new dependencies have been recently added and you don't have them on your system yet—this would be a very likely cause for the failure.
'''Summary'''
Routine update:
$ download_and_compile.sh -pn ''COMPONENT...''
In case this fails, first update <tt>download_and_compile.sh</tt> (see [[#getting-download-and-compile-sh-using-an-fgmeta-clone|above]]), then run
$ download_and_compile.sh ''COMPONENT...''
where ''COMPONENT...'' stands for the space-separated list of selected components, and defaults to <tt>SIMGEAR FGFS DATA</tt> if you don't specify any.
=== <span id="examining-download-and-compile-sh-history"></span> Examining the history of <tt>download_and_compile.sh</tt> ===
Looking at the latest commits that affected <tt>download_and_compile.sh</tt> is quite easy with your FGMeta clone:
$ cd ~/flightgear/fgmeta
$ git log -- download_and_compile.sh
(then quit by typing <tt>q</tt>, assuming your <tt>$GIT_PAGER</tt> is <tt>less</tt>)<br />
In order to do the same, but also see the patch for each commit:
$ cd ~/flightgear/fgmeta
$ git log -p -- download_and_compile.sh


== Update Available ==
== Update Available ==
Line 43: Line 362:


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.
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.
== Disk Space Requirements ==
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).


== List of compiled programs ==
== List of compiled programs ==
Line 85: Line 400:
* OPENRTI
* OPENRTI
The up-to-date list of components can be obtained by running:
The up-to-date list of components can be obtained by running:
  download_and_compile.sh --help
  $ 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


In case you want to do the same build with just [[OpenSceneGraph]] added, you can use:
In case you want to do the same build with just [[OpenSceneGraph]] added, you can use:
  download_and_compile.sh SIMGEAR FGFS DATA OSG
  $ download_and_compile.sh SIMGEAR FGFS DATA OSG


You get the idea. When several components are passed on the same command line, <tt>download_and_compile.sh</tt> chooses a reasonable order for processing, so don't worry about that.
You get the idea. When several components are passed on the same command line, <tt>download_and_compile.sh</tt> chooses a reasonable order for processing, so don't worry about that.


== When building Next you may see build errors ==
== When building 'next', you may see build errors ==


Keeping in mind that this script compiles sometimes bleeding edge software, it can happen that what was successfully compiling last week, does not compile anymore today. Building the stable version should always work, unless there is a problem with the script.
Keeping in mind that this script compiles sometimes bleeding edge software, it can happen that what was successfully compiling last week, does not compile anymore today. Building the stable version should always work, unless there is a problem with the script.
Line 103: Line 418:
That said, don't be too afraid of building the development version (called ''next''): this is the one developers use all the time, so kindly asking on the flightgear-devel [[Mailing_lists|mailing list]] in case a problem popped up<ref name="what-to-provide-when-asking-for-help">Don't forget in this case to precisely tell what you did and include the <tt>compilation_log.txt</tt> file written by <tt>download_and_compile.sh</tt>.</ref> should allow you to find good advice and get the problem quickly fixed, if it's a new one. Conversely, probably not many people (in 2019) build themselves the “stable” version of FlightGear. People who want the stable version can usually have it from their distribution, this is generally easier. On the other hand, those running <tt>download_and_compile.sh</tt> typically want to build the latest code that FlightGear developers are working on; this is useful when you want to contribute feedback, code, aircraft or scenery based on recent technology, or just want to enjoy the latest features and bugs. ;-)
That said, don't be too afraid of building the development version (called ''next''): this is the one developers use all the time, so kindly asking on the flightgear-devel [[Mailing_lists|mailing list]] in case a problem popped up<ref name="what-to-provide-when-asking-for-help">Don't forget in this case to precisely tell what you did and include the <tt>compilation_log.txt</tt> file written by <tt>download_and_compile.sh</tt>.</ref> should allow you to find good advice and get the problem quickly fixed, if it's a new one. Conversely, probably not many people (in 2019) build themselves the “stable” version of FlightGear. People who want the stable version can usually have it from their distribution, this is generally easier. On the other hand, those running <tt>download_and_compile.sh</tt> typically want to build the latest code that FlightGear developers are working on; this is useful when you want to contribute feedback, code, aircraft or scenery based on recent technology, or just want to enjoy the latest features and bugs. ;-)


== Download ==
== Task-specific instructions ==
You can get <tt>download_and_compile.sh</tt> {{fgmeta source
| path = download_and_compile.sh
| text = from FGMeta
}}. It is contained in the [[FGMeta]] repository, which is maintained by the FlightGear developers. Remember to update this script whenever a new FlightGear version is released, so that you'll be able to download the latest stable revision (of course, you can update it more often to benefit from bug fixes, it doesn't have to happen ''after a release).''


== Instructions ==
{{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>]].}}
To run download_and_compile.sh, just save it in a directory called for example: ~/fgfs
then execute it (no need to execute it as root).


Here is for example a sequence of commands to get the script from the ''next'' branch:
For the FGFS component (FlightGear), there are two main options:
mkdir ~/fgfs
* build the latest ''stable'' release;
cd ~/fgfs
* build the current development version (bleeding edge), which lives in the {{flightgear source
<nowiki>wget https://sourceforge.net/p/flightgear/fgmeta/ci/next/tree/download_and_compile.sh?format=raw</nowiki>
| branch = next
chmod 755 download_and_compile.sh
| text = next
}} branch of the FlightGear repository.


You have two options now: build the latest ''stable'' FlightGear release or build the ''current development'' version (bleeding edge).
=== Build the latest stable FlightGear release ===
After building stable or the latest, if you need to build a different version, try the instructions for [[Avoiding multiple downloads of FGData on Linux]] (warning: as of April 2019, they are outdated).


=== Build 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 the script, use the "-s" option to build the latest stable release:  
  $ cd ~/flightgear/dnc-managed
  ./download_and_compile.sh -s
$ download_and_compile.sh -s
 
{{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 ===
=== Build the current FlightGear development version ===
When executing the script without any options,
the latest development version is built.


'''Warning''': The development version of FlightGear changes on an almost daily basis. It provides the latest features, but is not always guaranteed to work reliably. If you're unfamiliar with software testing, you may prefer to use the latest stable release.
When executing <tt>download_and_compile.sh</tt> without any option, the latest development version is built:
  ./download_and_compile.sh
  $ cd ~/flightgear/dnc-managed
$ download_and_compile.sh


Once the script has finished running, you will successfully get FlightGear installed in the ~/fgfs directory.
{{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.}}


=== Launching FlightGear ===
=== Launching FlightGear ===


When using <tt>download_and_compile.sh</tt>, apart from those installed with the package manager, the FlightGear dependencies (which are typically libraries) are not installed system-wide but under the directory from which <tt>download_and_compile.sh</tt> is run. This makes it possible to easily use, for instance, different [[OpenSceneGraph]], [[SimGear]] and FlightGear versions on a single system—e.g., for testing purposes—but also to have separate build trees (optimized/debug). This is also why you either need to set LD_LIBRARY_PATH to run the built programs, or simply use the scripts created by <tt>download_and_compile.sh</tt> in the directory where it is run, such as <tt>run_fgfs.sh</tt> and <tt>run_fgfs_debug.sh</tt>: these scripts automatically set up the required environment variables according to your build settings before firing the desired program (e.g., <tt>fgfs</tt>) with the arguments you provided.  
When using <tt>download_and_compile.sh</tt>, apart from those installed with the package manager, the FlightGear dependencies (which are typically libraries) are not installed system-wide but under the directory from which <tt>download_and_compile.sh</tt> was run. This makes it possible to easily use, for instance, different [[OpenSceneGraph]], [[SimGear]] and FlightGear versions on a single system—e.g., for testing purposes—but also to have separate build trees (optimized/debug). This is also why you either need to set LD_LIBRARY_PATH to run the built programs, or simply use the scripts created by <tt>download_and_compile.sh</tt> in the directory where it is run, such as <tt>run_fgfs.sh</tt> and <tt>run_fgfs_debug.sh</tt>: these scripts automatically set up the required environment variables according to your build settings before firing the desired program (e.g., <tt>fgfs</tt>) with the arguments you provided.  


Therefore, the simplest way to run your newly-built FlightGear is to launch the <tt>run_fgfs.sh</tt> script that <tt>download_and_compile.sh</tt> created in the directory from which it was run, for example:
Therefore, the simplest way to run a FlightGear program built by <tt>download_and_compile.sh</tt> is to launch the <tt>run_fgfs.sh</tt> script that <tt>download_and_compile.sh</tt> created in the directory from which it was run, for example:
  cd ~/fgfs
  $ cd ~/flightgear/dnc-managed
  ./run_fgfs.sh --launcher
  $ ./run_fgfs.sh --launcher


{{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.}}
Line 147: Line 457:
=== Launching FGRun ===
=== Launching FGRun ===


{{Note|As of 2019, FGRun is not maintained anymore. You may want to try the built-in launcher (see above) or [[FFGo]].}}
{{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]]
[[File:fgrun-page2.jpg|thumb|right]]
For many users it's more comfortable having FlightGear launched by the graphical utility FGRun which is installed as well in the same folder. You have to launch the ''run_fgrun.sh'' command, for example:
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:
<pre>
$ cd ~/flightgear/dnc-managed
cd ~/fgfs
$ ./run_fgrun.sh
sh run_fgrun.sh
</pre>


FGRun will save its settings in ~/.fltk/flightgear.org/fgrun.prefs you may want to save copies of the preferences customized for stable and next.
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.


=== Launching FGo! ===
=== Launching FGo! ===


{{Note|As of 2019, FGo! is not maintained anymore. You may want to try the built-in launcher (see above) or [[FFGo]].}}
{{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]]
[[File:Fgo01.jpg|thumb|left]]
This is a graphical utility written in [[python]], You have to launch the ''run_fgo.sh'' command, for example:
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:
<pre>
$ cd ~/flightgear/dnc-managed
cd ~/fgfs
$ ./run_fgo.sh
sh run_fgo.sh
 
</pre>
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.
Remember that the first time you run it, you have to go to preferences and set the binary and FGData path (Do no set the working directory, you don't need it).
 
=== 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.
 
Let's show how this can be done on an example. Suppose your master copy of FGData is in <tt>~/flightgear/dnc-managed/install/flightgear/fgdata</tt>. Then the following appears to work:
$ mkdir -p ~/flightgear/other-dnc-managed-tree/install/flightgear
$ cd ~/flightgear/other-dnc-managed-tree/install/flightgear
$ ln -s ../../../dnc-managed/install/flightgear/fgdata
$ cd ~/flightgear/other-dnc-managed-tree
$ download_and_compile.sh
 
The last of these commands will use and update the FGData repository present in <tt>~/flightgear/dnc-managed/install/flightgear/fgdata</tt>.
 
{{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:
$ cd /path/to/fgdata && git checkout release/2019.1
or
$ cd /path/to/fgdata && git checkout next
So, this is possible but somewhat acrobatic. You've been warned.}}
 
Note: there is a [[Avoiding multiple downloads of FGData on Linux|wiki article about this subject]], but it is severely outdated as of April 2019.


== Additional programs ==
== Additional programs ==


If you wish to get other programs, you need to launch the script with the desired component names as arguments. For instance:
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:
  ./download_and_compile.sh SIMGEAR FGFS DATA OSG
  $ cd ~/flightgear/dnc-managed
$ download_and_compile.sh SIMGEAR FGFS DATA OSG


The available components are (in April 2019):<br />
The available components are (in April 2019):<br />
Line 179: Line 510:


The full, up-to-date list of these components can always be obtained by running:
The full, up-to-date list of these components can always be obtained by running:
  ./download_and_compile.sh --help
  $ download_and_compile.sh --help


=== Launching FGCOM ===
=== Launching FGCOM ===
Line 185: Line 516:
{{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 ''run_fgcom.sh'' command:
[[FGCom]] is the system used by FlightGear to simulate radio communications between users. Launch it using the <tt>run_fgcom.sh</tt> script:
<pre>
$ cd ~/flightgear/dnc-managed
cd ~/fgfs
$ ./run_fgcom.sh
sh run_fgcom.sh
</pre>


== Troubleshooting ==
== Troubleshooting ==
Line 201: Line 530:
There is a simple solution to the above errors: wait and relaunch the script after some time (hours or days), if software developers repair or synchronize their code with the newly updated libraries (which generally happens eventually), your FlightGear will compile fine as if the previous error never took place.
There is a simple solution to the above errors: wait and relaunch the script after some time (hours or days), if software developers repair or synchronize their code with the newly updated libraries (which generally happens eventually), your FlightGear will compile fine as if the previous error never took place.


Sometimes it happens that the script fails to compile only FGRun, FGCOM or atlas, if you then see the run_fgfs.sh file it means that FlightGear installation was successful and you can safely run it.
Sometimes it happens that the script fails to compile only [[Fgrun|FGRun]], [[FGCom]] or atlas, if you then see the run_fgfs.sh file it means that FlightGear installation was successful and you can safely run it.


=== OpenRTI undefined reference errors ===
=== OpenRTI undefined reference errors ===
Sometimes due to the way d&c build cleans up projects, linking errors might occur, this is the case with this error "libRTI-NG.so: undefined reference to xxx", sadly at this point either you need to patch the d&c script to clean OpenRTI with rm -f CMakeCache.txt && rm -rf CMakeFiles/, or just start from a clean environment, assuming you are in the parent project directory, you will need to issue this command to clean everything(except FGDATA):
Sometimes due to the way d&c build cleans up projects, linking errors might occur, this is the case with this error "libRTI-NG.so: undefined reference to xxx", sadly at this point either you need to patch the d&c script to clean OpenRTI with <code>rm -f CMakeCache.txt && rm -rf CMakeFiles/</code>, or just start from a clean environment, assuming you are in the parent project directory, you will need to issue this command to clean everything (except FGData):
<pre>
$ 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/
</pre>


see this thread for more details (https://forum.flightgear.org/viewtopic.php?f=45&t=26244)
See [https://forum.flightgear.org/viewtopic.php?f=45&t=26244 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:
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
  $ 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:
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
  $ 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.
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.


Line 241: Line 568:


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:
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
  $ download_and_compile.sh -s


How does it work?
How does it work?
* For [[SimGear]], FlightGear and [[FGData]], it uses the most recent stable release branch of the corresponding Git repository.
* 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 April 2019, apart from SIMGEAR, FGFS and DATA, the only component for which <tt>download_and_compile.sh</tt> “knows” a stable version is OPENRTI.</ref> (for instance, the hardcoded information can be the name of a Git branch).
* 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.
* For the other components, the <code>-s</code> option has no effect.


Line 261: Line 588:


For example, if you are a developer and wish to quickly recompile and reinstall only your own modifications for FlightGear, you can do this:
For example, if you are a developer and wish to quickly recompile and reinstall only your own modifications for FlightGear, you can do this:
  ./download_and_compile.sh -p n -d n -r n FGFS
  $ download_and_compile.sh -p n -d n -r n FGFS


Note that this is the same as:
Note that this is the same as:
  ./download_and_compile.sh -pn -dn -rn FGFS
  $ download_and_compile.sh -pn -dn -rn FGFS


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 ===
=== Multicore Acceleration ===
Using the option '''-j x''' (where x is the number of your CPU-Cores you wish to assign to the job) will speed up the whole compilation process considerably.
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.
 
== Disk usage and build time ==
 
Keeping compiled programs, source code and data repositories requires some hard disk space: it will take something like 12 [https://en.wikipedia.org/wiki/Gibibyte GiB] of space for just [[SimGear]], FlightGear and [[FGData]] (i.e., the SIMGEAR, FGFS and DATA components).
 
With an Intel Core i7 860 CPU (2.80 GHz) purchased in 2009, compiling [[SimGear]] and FlightGear 2019.2 with option <code>-j8</code> takes about 14 minutes. If you don't have a fast machine and build using only one core, it may require several hours.


== Optimus technology ==
== Optimus technology ==
Line 281: Line 602:


After having installed required tools (Bumblebee) you just need to run this command line in your FlightGear installation directory (where you executed <tt>download_and_compile.sh</tt>):
After having installed required tools (Bumblebee) you just need to run this command line in your FlightGear installation directory (where you executed <tt>download_and_compile.sh</tt>):
  sed  's|\./fgfs|optirun ./fgfs|' run_fgfs.sh > run_fgfs_optirun.sh && chmod +x run_fgfs_optirun.sh
  $ sed  's|\./fgfs|optirun ./fgfs|' run_fgfs.sh > run_fgfs_optirun.sh && chmod +x run_fgfs_optirun.sh
Now you can run FlightGear with <code>./run_fgfs_optirun.sh</code>.
Now you can run FlightGear with <code>./run_fgfs_optirun.sh</code>.


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 ==
== 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 :
You can remove the warning message displayed when DDS files are parsed by SimGear by adding the following line just after '''cd "simgear"''' line :
<pre>
$ sed -i s/SG_ALERT,\ \"Image/SG_WARN,\ \"Image/g simgear/scene/model/ModelRegistry.cxx
sed -i s/SG_ALERT,\ \"Image/SG_WARN,\ \"Image/g simgear/scene/model/ModelRegistry.cxx
</pre>


== See also ==
== See also ==
377

edits