Howto talk:Build FlightGear with Any IDE
|Work in progress|
This article or section will be worked on in the upcoming hours or days.
See for the latest developments.
This page presents an overview of IDEs and lists the code resources that should be present for development of Flightgear and Simgear.
If you are already familiar with IDEs and their configuration, skip this page and go to
There are several features that any IDE should have to support various parts of the development workflow.
- An IDE should work smoothly with the underlying software tools you use to edit, manage, store, build, test and analyse your code.
- IDE setup may have to take into account any standard software libraries used by the application.
- The IDE should be capable of building and then using any libraries that are either specific to the application or those that need a specific version or modification.
- There should be the capability of building both the debug and non-debug versions of executables and libraries.
- If there is more than one executable in the project, you build be able to build them all within the IDE.
- The IDE should be capable of starting the application's executables with debugging and possibly with testing, code analysis, path tracing and performance tools.
In most IDEs, your code can be set up in the usual way for building, with separate source, build and install directory trees. These should be configured in the IDE to allow IDE specific files in the project directory while keeping the application's code separated from the IDE specific files by using links within the project directory or a feature of the IDE that allows importing the code without making a separate copy.
In this development phase my goal is to get Eclipse and QTCreator set up for debugging the flightgear executable under Ubuntu with code man. Once this is complete, the main page will be populated with the content developed here.
Content development can proceed on this talk page, with additional phases to cover additional distributions, other operating Systems; testing; additional executables; code analysis; path tracing and performance tools. We can release to the main page, the content for the additional phases as soon as they are usable.
Flightgear Prerequisite Libraries and Development Tools
Flightgear and its various supporting executables use a number of standard libraries and development tools that can be obtained by simply installing the distribution's current version. It also uses the PLIB and OpenSceneGraph libraries which need to built for use with Flightgear.
A list of flightgear pre-requisites can be found in the download_and_compile.sh script.
Flightgear components: plib, OSG, OpenRTI, simgear, flightgear
To create a flightgear executable, you will need to build four required components and on optional component: Plib, OSG, simgear and flightgear must be built and OpenRTI is optional.
All the known flightgear components are described below with Links to web pages describing them. Instead of exploring these components individually and setting up source, build and install directories for them, you may want to use the results of a build using download_and_compile.sh as a basis for your IDE's configuration. (will that work?) otherwise you can download each source code repository to folders of your choice. Each component will be treated as a separate project by the IDE.
Specifics are provided for each IDE.
At some point in it's history the flightgear project needed to work with a specific version of cmake was not available in one or more Linux distributions. This appears to no longer be the case and cmake installed from most linux distributions will be sufficient.
When cmake had to be built, the following were relevant:
Plib is a library almost exclusively used by Flightgear. It is considered obsolete and there are a few things the Flightgear project needs to do to eliminate it from our codebase. Search the mailing list for plib to find out what needs to be done.
plib at Sourceforge: 
Open Scene Graph
The OpenSceneGraph library version 3.4 is used, with some current features backported in our custom source directory from later versions. Later versions have a different API, and at some point there will be an effort to convert Flightgear's code to use the API of the then current version. Flightgear developers get to decide when this work gets done.
An open source HLA/RTI implementation.
|Flightgear HLA Wiki Page|
|Wikipedia page on RTI|
Simgear is a library of supporting functions that can be used by any kind of simulator. It is part of the Flightgear Project.
Simgear at SourceForge: 
Flightgear is the main executable for the Simulator. FGData is its supporting data.
Additional Flightgear and ATC Projects
Source, Build and Install Directories
The download_and_compile.sh script works with the following directory tree, by default in the directory where the script runs:
|./||any directory containing the download_and_compile.sh script|
|./build||directory used for separately building each component from it's sources|
|./install||directory for FlightGear executables and data|
I hope that this directory structure will suffice for each IDE. There may have to be a level of indirection in the IDE project directories so that the application code is kept separate from IDE configuration files.
If at some point we want to add IDE project files to the flightgear source repository, the place to do it is fgmeta. Some scripting may be needed to manage the configuration file or files as part of fgmeta. But we're getting ahead of ourselves by mentioning this. Forget I said anything about it. Lets just make it work first.
Installing the IDE
This topic is pretty well covered on the Web. Other than noting significant pre-requisites, We don't need to explain things here, except to note that you can go with a distribution's current version, obtain the latest built version directly or build the IDE yourself. Pick your poison.
Eclipse requires a Java JDK package being installed.
# Ubuntu 18.04 Install JDK $ apt-get -y install openjdk-8-jdk # Ubuntu 18.04 - check java installed -- update-alternatives may work on other distributions. $ update-alternatives --config java There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
Configuring an IDE
Although the details may vary from IDE to IDE, the process of configuring them has similar requirements. Git, Cmake and other tools may need to be configured within the IDE or externally. Any step in the development workflow that can't be handled directly in an IDE will likely need to be done using a script, possibly but not necessarily called from within the IDE. Finally, IDE projects will have to be created, linking to Source, Build and Install directories.
Again, you can find specific information about configuring most IDE's with a number of software tools on the web. Here, we'll provide links to information on several aspects of configuring. Remember that these links will eventually need maintenance to stay fresh. In that case, Google the name of the ide with "Cmake", "GIT", "CPPUnit" or other tools along with the name of your OS.
Most of the workflow tasks you do in an IDE may already be familiar to you. If not, here's a list of what developers typically do in an IDE
- Provide ways to use specific test, code analysis or other tools and libra/ries either with the IDE or externally.
- Locate code related to some specific feature of the application by searching the entire project for one or more strings.
- Making changes to one or more files in the project, lin by line or using global search and replace.
- Find changes already made
- Run the application with a debugger
- Run application tests built with tools like cppUnit
- Run Code or Performance Analysis and tracing tools to profile the application in some way
- Produce API or other documentation
- Submit changes to a personal or project source archive, usually github or sourceforge.
- Request merging changes from personal github or sourceforge projects to the application's main codebase.
Newcomers to an IDE or IDE's in general may find instructions for these kind of workflows useful. If called for, we can provide them, for now, google it.
Additional Software Development Tools
Many IDEs are suitable for cross platform work. The details of installation and configuration might differ between platforms, but the IDE will work similarly. Cross Platform work may be done by using an IDE on each platform, or by cross compiling on one platform for execution on another.
Is there IDE support for Cross Compiling?
I believe the same project directories can be used for multiple IDEs. I may be wrong, but we'll go with that assumption for now. The approach I've taken is to use the download and compile script to get a copy of the next branch that I can just build with the script anytime I want. Taking things a step further, I've set up a development directory along side of the next directory with copies of the individual projects I'll be working on and links to the next directory for any that I won't be making changes to.
Use the download and compile script to do an initial get of the sources for plib, OSG, simgear, flightgear and fgdata
cd ~/fg mkdir -p ~/fg/next cd ~/fg wget -O download_and_compile.sh https://sourceforge.net/p/flightgear/fgmeta/ci/n cd ~/fg/next ~/fg/download_and_compile.sh PLIB OSG SIMGEAR FGFS DATA
move the fgdata directory so you do not have to download it again if you delete your install directory.
Be sure to recreate the symbolic link if delete the ~/fg/next/install directory for any reason.
if [ ! -e ~/fg/fgdata ] then mv ~/fg/next/install/flightgear/fgdata/ ~/fg/fgdata/ ln -s ~/fg/fgdata ~/fg/next/install/flightgear/fgdata fi
Create the development directory
populate the development directory with copies of flightgear and simgear, with links for plib, osg and fgdata.
\ Links are for the components you do not intend to make changes to.
mkdir ~/fg/dev cp -R ~/fg/next/flightgear/ ~/fg/dev/flightgear/ cp -R ~/fg/next/simgear/ ~/fg/dev/simgear/ ln -s ~/fg/next/plib ~/fg/dev/plib ln -s ~/fg/next/openscenegraph ~/fg/dev/openscenegraph ln -s ~/fg/next/install/flightgear/fgdata ~/dev/fgdata
Your ~/fg/dev directory should look similar to this:
ls -lah ~/fg/dev total 16K drwxrwxr-x 4 pac1 pac1 4.0K Sep 5 15:45 . drwxrwxr-x 24 pac1 pac1 4.0K Sep 5 14:49 .. lrwxrwxrwx 1 pac1 pac1 44 Sep 5 15:45 fgdata -> /home/pac1/fg/next/install/flightgear/fgdata drwxr-xr-x 15 pac1 pac1 4.0K Sep 5 14:51 flightgear lrwxrwxrwx 1 pac1 pac1 33 Sep 5 15:30 openscenegraph -> /home/pac1/fg/next/openscenegraph lrwxrwxrwx 1 pac1 pac1 23 Sep 5 15:30 plib -> /home/pac1/fg/next/plib drwxr-xr-x 6 pac1 pac1 4.0K Sep 5 15:28 simgear
Create SourceForge Clones
For any components you want to work on, create a SourceForge clone of the official project. This will be your immediate upstream repository for the project. It will contain your changes and will be the place where the developers can review your changes for inclusion in the official project.
To create these clones got to log in to your SourceForge account.
git branch branch_name --set-upstream-to your_new_remote/branch_name
Eclipse has built in support for git. Review: Eclipse Git User Guide (EGit) You will need to set an ssh key on sourceforge if you have not already.