Fr/Script de compilation sous Linux Debian/Ubuntu

From FlightGear wiki
Jump to navigation Jump to search

Le script décrit ici prend en charge le téléchargement des sources et la compilation de FlightGear à partir des dépôts git en exécutant une commande unique pour les systèmes de type Debian 32-bit et 64-bit (Debian, Ubuntu). L'installation pré-existante de FlightGear (si elle existe) ne sera pas modifiée, le script construit et installe tout ce qu'il faut dans le répertoire dans lequel il sera téléchargé. Vous pouvez choisir entre la construction de l'ensemble ou seulement l'un des outils spécifiques de l'application.

Les paquetages nécessaires seront installés via le système apt-get. Les bibliothèques qui ne sont pas incluses dans les dépôts seront téléchargés et compilées "à la volée" (par exemple Plib, Simgear et OSG).

Pour les systèmes de type Redhat (Fedora, CentOS) reportez vous à la page dédiée à CentOS.

Voir aussi Superbuild.

Le script

Vous pouvez télécharger le script de la manière suivante:

wget -O download_and_compile.sh http://sourceforge.net/p/flightgear/fgmeta/ci/next/tree/download_and_compile.sh?format=raw


Pour les impatients

cd  <your working directory for building flightgear>
wget -O download_and_compile.sh  http://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 -s
cd ../next
../download_and_compile.sh -p n

Espace disque nécessaire

Pour la version 3.4.0, en juin 2015, le script requiert entre 2 et 3 Go d'espace disque. Ceci inclus le fichiers à télécharger, les fichiers de construction lors de la compilation, ainsi que le fgdata.

Liste des programmes à compiler

Le script permet de télécharger et compiler:

Note: openRTI est une autre dépendance optionnelle pour le support HLA: http://wiki.flightgear.org/FlightGear_HLA_support_(High_Level_Architecture)

Pour l'instant, vous pouvez faire abstraction du support HLA. Finalement, l'idée de remplacer le système MP existant par HLA est surtout destiné à une architecture FlightGear qui intégre un grand nombre de composants dans des process séparés, ou même des machines distinctes. Cette technologie est donc plutôt destinée à un contexte professionnel utilisant plusieurs ordinateurs et écrans pour créer un environnement complet de simulation "immersif".

Pour l'instant, il est probablement plus sécurisant de considérer que HLA est réservé aux développeurs et aux personnes qui veulent expérimenter ces fonctionnalités.

Vous pouvez utiliser le paramètre -i pour compiler OpenRTI, ou la re-configuration SimGear et FlightGear avec l'option -D ENABLE_RTI=ON (experimental)

Erreurs lors de la compilation de la version Next

Gardez à l'esprit que ce script se compile avec les dernières versions des logiciels, en utilisant les dernières distributions Debian. Il peut arriver que le programme qui a été compilé avec succès la semaine dernière, aujourd'hui, ne fonctionne plus. Construire la version stable devrait toujours fonctionner, sauf s'il y a un problème avec le script.

Téléchargement

Vous pouvez télécharger le script ici:

Le script est maintenu dans le dépôt FlightGear principal. Rappelez-vous de mettre à jour ce script dans le cas d'une nouvelle version de FlightGear, vous pourrez ainsi télécharger la dernière version stable.

Pièges connus

Dans les versions FlightGear antérieures ou égales à 3.0 le système de construction cmake est connu pour ne pas reconfigurer automatiquement les sources SG/FG apèrs mise à jour dans $SG_SRC et $FG_SRC, en principe que vous devez utiliser un "git pull" pour mettre à jour les sources (via le script d&c) qui créera les derniers binaires, mais ça ne concernera pas le paquet de base des data. En effet, les sources continueront à utiliser les anciennes versions des fichiers qui se trouvent dans le cache de cmake. Cette anomalie a été rencontrée par plusieurs contributeurs, y compris pour le développement du noyau de base.

Pour contourner ce problème, allez dans les répertoire de construction SG/FG et reconfigurez chaque arborescence en exécutant la commande "cmake ." - pour plus d'informations voyez [1][2].

Ceci devrait être résolu dans les versions stables postérieures à la 3.0.

Procédure

Pour lancer l'exécution de download_and_compile.sh, enregistrez le script dans un répertoire de travail, comme, par exemple: ~/fgfs puis exécutez le (il n'est pas nécessaire d'être root).

Voici un exemple de la séquence des commandes pour récupérer le cript depuis la branch "master". Vous pouvez remplacer "master" par next pour récupérer la dernière version de développement du script, s'il y en a une:

mkdir ~/fgfs
cd ~/fgfs
wget http://www.gitorious.org/fg/fgmeta/raw/download_and_compile.sh
chmod 755 download_and_compile.sh


Vous disposez de deux options: construire la dernière version stable de FlightGear, ou construire la version courante de développement (bleeding edge). Après construction, si vous avez besoin de construire une version différente, essayez la procédure Avoiding Multiple Downloads of fgdata.

Construction de la dernière version stable de FlightGear

À l'exécution du script utilisez l'option "-s" pour travailler sur la dernière version stable:

./download_and_compile.sh -s

Construction de la version de développement de FlightGear

À l'exécution du script sans aucune option, la dernière version de développement sera constuite.

Attention: La version de développementde Flightgear évolue tous les jours. Elle fournit les dernières fonctions disponibles, mais sans aucune garantie de fonctionnement correcte. Si vous n'êtes pas un habitué des tests de logiciels vous devriez vous en tenir à la version stable.

./download_and_compile.sh


Une fois l'exécution du script correctement terminée, vous disposerez de FlightGear et Fgrun installés dans le répertoire ~/fgfs.

Lancement de FlightGear

L'utilisation du script n'installe rien dans votre système, comme le ferait un paquetage traditionnel. Il se borne à construire dans votre répertoire de travail tout ce qui est nécessaire. Ceci permet de disposer de plusieurs versions simultanément (pour des tests, de la mise au point, de l'optimisation, etc...). Il est donc indispensable de paramétrer correctement votre LD_LIBRARY_PATH, ou tout simplement d'utiliser le script Brisa qui fera ça pour vous (run_fgfs.sh qui a été créé automatiquement dans votre répertoire de travail).

Pour démarrer FlightGear depuis une nouvelle installation git, lancez la commande run_fgfs.sh depuis ce répertoire, par exemple:

cd ~/fgfs
sh run_fgfs.sh

Lanceur Fgrun

Fgrun-page2.jpg

Beaucoup d'utilisateurs sont plus à l'aise avec une interface graphique qu'avec la ligne de commande. FlightGear dispose de l'utilitaire de lancement Fgrun qui a été installé dans votre répertoire de travail. Vous devz simplement exécuter la commande run_fgrun.sh, par exemple:

cd ~/fgfs
sh run_fgrun.sh

fgrun sauvegardera tous ses paramètres dans un fichier ~/.fltk/flightgear.org/fgrun.prefs vous pouvez enregristrer des copies de ce fichier de préférences ajusté pour chaque version stable et/ou next.

Lanceur Fgo!

Fgo01.jpg

C'est un autre utilitaire de lancement écrit en python, Vous devez le lancer avec la commende run_fgo.sh, par exemple:

cd ~/fgfs
sh run_fgo.sh

Souvenez vous que lors de la première exécution de Fgo il faut aller dans les préférences pour paramétrer les chemin d'accès pour binary et fgdata (vous n'avez pas besoin de renseigner le working directory).

Additional programs

If you wish to get all the other programs, you need to launch the script adding the "ALL" option to the command line:

./download_and_compile.sh ALL

This, will also install FGCOM, FGComGui and Atlas

Launching FGCOM

FGCOM is the system used by FlightGear to simulate radio communications between users. Launch it using the run_fgcom.sh command:

cd ~/fgfs
sh run_fgcom.sh


Launching Terrasync

Your FlightGear compilation comes with the Terrasync program too, so if you want to use it:

cd ~/fgfs
sh run_terrasync.sh -S -p 5500 -d /folder/with/sceneries

Where: /folder/with/sceneries is the folder containing the sceneries data.

Then launch fgfs with the --fg-scenery=/folder/with/sceneries --atlas=socket,out,5,localhost,5500,udp option

Troubleshooting

Compilation errors

Here we are, no fear, if you wish to use programs from the cvs/svn/git repositories, you might face compilation errors that will prevent you to have a working copy of one or more of the programs provided by this script. What can be the causes that prevent us from successfully compiling? As far as I know those:

  1. Software developers introduce a new functionality with a new piece of code that prevents the compilation under your architecture, this can happen working with cvs/svn/git sources.
  2. The program refuses to compile because of a divergence in the libraries on which it depends. For example FlightGear might not compile because OSG has been modified, while OSG itself compiles fine, FG won't.
  3. One or more repositories are down and you can't get the library you need. (Both from cvs/svn/git or apt-get)

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.

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):

rm -rf build/* install/simgear/ install/openrti/ install/flightgear/share/ install/flightgear/bin/

see this thread for more details(http://forum.flightgear.org/viewtopic.php?f=45&t=26244)

Options

The script by default (without any option) will only compile FlightGear and Fgrun. To make it compile all, you need to launch the script with the ALL parameter. i.e.:

./download_and_compile.sh ALL

Compiling only one program

If you wish to recompile only one of the programs you can launch the script with one of the following parameters:

  • 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!)

Fast updating

There is a second parameter UPDATE that allows you to just update your installation. i.e.: This will only update FGFS

./download_and_compile.sh FGFS UPDATE

Compiling last stable versions (Experimental)

Even if the script fetches data and sources from bleeding edge developers repositories (which sometimes do not compile), you can still force the script to download latest known versions of the software that were compiling successfully by adding the -s option.

./download_and_compile.sh -s

How does it work? Inside the script there is a small list with latest known versions of successfully compiling revisions, it will download from svn/git those specific revisions, which have been found able to compile together.
Warning: If you run this option inside a folder where you previously compiled fgfs, it will probably fail to compile, you better run the script with this option inside an empty folder or a folder whith the same fgfs version compiled previously.

Advanced options

  • Skip download of distro packages using -p n option
  • Skip compilation of programs using -c n option
  • Skip retrieving software updates using -d n option
  • Skip reconfigure (make clean) using -r n option

For example, if you are a developer and wish to quickly recompile and reinstall only your own modifications for FlightGear do this:

./download_and_compile.sh -p n -d n -r n  FGFS

this will only recompile modifications and reinstall them.

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.

Disk usage

Having both compiled program, source code, and data from git requires some hard disk space: It will take something like 13 GB of space. If you don't have a fast machine, it will require several hours of compilation time.

Optimus technology

If your computer has a GPU with optimus technology, you need a dedicated script in order to make FG running with the powerful GPU.

After having installed required tools (Bumblebee) you just need to run this command line in your FG installation directory (where you executed ./download_and_compile.sh) :

sed  's|\./fgfs|optirun ./fgfs|' run_fgfs.sh > run_fgfs_optirun.sh && chmod +x run_fgfs_optirun.sh

Now you can run FG with ./run_fgfs_optirun.sh


the same is applied with the FGRUN launcher :

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