page jumps: preamble -|- folders -|- build -|- runtime -|- downloads -|- quick start -|- missing items -|- end


2007-03-18 - It has already been about four(4) months since I last built FlightGear from scratch - my how time flies ;=)) Last page update 2007-04.20.

FlightGear depends on a considerable number of other 'libraries', which must be downloaded, and built first, then FG source and base data. Where possible, I tend to use the CVS (or SVN) development sources. And I tend to use the COMMAND LINE versions of these tools, since this facilitates the construction of a single batch file to update all the sources at one time.

CVS - Concurrent Versions System - I have zipped (MD5: 58a6ae5eb66eb1641e441f9e86d5a791) my client version 1.11.17, Copyright (c) 1989-2004 Brian Berliner, david d `zoo' zuhn, Jeff Polk, and other authors. CVS may be copied and used only under the terms of the GNU General Public License. At - http://ftp.gnu.org/non-gnu/cvs/binary/stable/x86-woe/ - later versions can be found, up to cvs-1-11-22.zip 10-Jun-2006 ... There are also several GUI version available, but I have never tried these.

SVN - Subversion - This is available from - http://subversion.tigris.org/ - I downloaded svn-1.4.0-setup.exe which does a nice windows setup, including automatically adding a path to the svn.exe, so it was all easy. I note there is a later svn-1.4.3-setup.exe, or you can download one of the zip files, and do your own setup. You may have to right mouse click, and use 'Save Target As...' to download these files in windows.

The link were valid at the time of this pages creation. In no particular order these are :- openal, freeglut, PLIB, OpenSceneGraph, OpenThreads, zlib, simgear, pthreads (optional), and flightgear source and base data -

With all the above sources, (and data) downloaded, you are ready to begin a build, first of the dependant libraries, and then FlightGear itself ...


Folder Structure:

I place all these source in a single folder I call FGCVS ... This is a view of the subdirectories in that folder. Note it contains a lot more than just the above mentioned source, but none of these additional items are specifically needed for FG ... It should also be noted I have unpacked zlib into to same folder, even though it is not a CVS/SVN source ...

view of my download folders

You need to emulate this folder structure if you want to use the setup and compile tools given at the end of this page.

For various reasons, including the fact that today big hard disk prices are very reasonable, I never build in the above, what I call 'updateable' folders. I first XCOPY the required sources to a new work folder. To make all this EASY I have a batch file, SETUPFG.BAT, to create a new set of folder, in a chosen 'work' folder, and copy the required sources into place. This batch file is included in the vc8sln04.zip given below. After this setupfg.bat has run, I have a simpler set of WORK folders, containing the desired sources :-

view of work folders

The first folder, 'bin', is where all the final binary runtime items will reside. The 'data' is a full copy of the base FG data folder. In here I can also download, and add additional scenery, and additional aircraft models, etc. The 'fgfs' is the make, or build folder.


The Build:

In this case I am using MSVC8 - each component, and finally FG could be loaded individually, and built separately, but I have created a single solution file, and set of MSVC8 project files, that includes all the required components, set to compile first, then finally FlightGear. Due to the changing sources, this is always a work-in-progress. Quite frequently files have to be added or delete from certain projects, and invariably, since this is nearly all ongoing development source, sometimes code fixes have to be made.

To try to ease some of the 'pain' of this latter item, the modified sources are also included in vc8sln04.zip. But you should first try the build WITHOUT these modified files. To aid in this, the source changes are in separate zip files, within the main zip. Sometimes, hopefully by the time you are using this, the relevant fixes have made it into the particular CSV/SVN development source. All that should be required is to unpack vc8sln04.zip into your chosen 'work' folder, allowing an overwrite of the existing project files.

As well as the modified source zip file, this will also add a srccfg04.zip to the 'work' folder. This must also be unpacked, using the folder names ... Load fgfs\fgfs.sln file in MSVC8, select either 'Debug' or 'Release' configuration and build ... Sometimes many other 'configurations' are listed, BUT ONLY 'Debug' and 'Release' have been fully tested. Using any other configuration, and you are on your own ;=)) Although I think I have now removed all the other configurations ...

For example, in building from vc8sln03 to develop vc8sln04, I found I had to delete about 4-5 files, add 4-5, and a changed source folder (ac3d to ac) in the OSG ... and had to delete a few, and add about 5 new files to simgear and flightgear ... these type of ongoing changes are inevitable ... it would be nice if I could automate a way, but that would be quite involved, perhaps impossible ;=() It would involve writing a unix/linux type makefile interpreter, but, for example,  OSG used GNUmakefile, while simgear and flightgear use makefile.am ...

This build, with Microsoft Visual C++ 2005 Express Edition (MSVC8), is using the runtime library 'Multithreaded DLL' (/MD), and 'Multithreaded Debug DLL' (/MDd)! When you create a new project in MSVC8 this is the default, but many prerequisite projects use /MT-/MTd, perhaps some with /ML-/MLd. It is VERY IMPORTANT that the runtime of the prerequisites and the final FlightGear build all use the SAME runtime, or else there will be 'conflicts' in the LINK.

Also, as previous, I had to make some minor code changes in Router\alc.cpp ...

1. I had to un-define HAVE_VISTA_HEADERS, since I don't have these installed ...

#ifndef __MINGW32__
#define _CRT_SECURE_NO_DEPRECATE // get rid of sprintf security warnings on VS2005

2. And a little later, change -

#ifndef __MINGW32__
#if !(defined (__MINGW32__) || defined (_MSC_VER))

so this is the only 'changed' file in vc8chg.zip. I must try to remember to post this to the OpenAL development board in the hope they will  change it in CVS ...

When the final link is successful, run UPD.BAT - this can be run with a 'D' parameter - like> upd d to also copy the debug versions to the 'bin' folder. In the 'bin' folder there is also an OpenAL folder. In this folder is another UPD.BAT, to copy the sound DLL shared libraries to your system folder, hard coded as C:\WINDOWS\System32.  If your windows is installed in other than this folder, then this upd.bat will need to be adjusted. If you already have the sound files installed, then it will refuse to do anything until these are deleted ...

Now you are ready to run flightgear. There are a number of batch files in the 'bin/bats' folder, to provide some initial scenarios. rfg.bat is the simplest with a content of :-

cd ..
FlightGear --fg-root=..\data --fog-disable --timeofday=noon --prop:/sim/rendering/fps-display=true
cd bats

You will note a number have 'noai' in their name. This is because I get a CRASH after about 5-10 minutes if I do not disable AI planes, but you might have more luck ;=)) You will note each uses ..\data as the path to the base data and scenery. If you did not copy the base data during setupfg then this will have to be adjusted to where you have installed at least the base data, and/or additional scenery ...



1. fgvc8rt04.zip - Set of WIN32 runtime binaries - MD5 = 84fc5c20f7dcad127e539ed6c2d309b8 - contents

  Length   Size  Ratio    Date     Time   Name
  ------   ----- -----    ----     ----   ----
       0       0   0%  20/03/2007  14:40  bats\
     138     112  19%  19/03/2007  16:10  bats\cleanup.bat
     116     101  13%  19/03/2007  16:10  bats\rfg.bat
      62      62   0%  19/03/2007  16:11  bats\rfgair.bat
     170     130  24%  20/03/2007  14:34  bats\rfgdbg.bat
      52      52   0%  19/03/2007  16:11  bats\rfghelp.bat
     391     273  31%  19/03/2007  16:11  bats\rfgmig.bat
     444     307  31%  19/03/2007  16:12  bats\rfgmigd.bat
     136     112  18%  19/03/2007  16:12  bats\rfgnoai.bat
     633     358  44%  19/03/2007  16:31  bats\rfgufo.bat
     680     370  46%  19/03/2007  16:14  bats\rfgufo1.bat
     620     354  43%  19/03/2007  16:15  bats\rfgufo1noai.bat
     177     136  24%  19/03/2007  16:15  bats\rfgufonoai.bat
 3850240 1527309  61%  20/03/2007  14:07  FlightGear.exe
       0       0   0%  19/03/2007  13:43  OpenAL\
   24576   16426  34%  20/03/2007  13:58  OpenAL\alut.dll
   49152   15916  68%  20/03/2007  13:58  OpenAL\OpenAL32.dll
    2892     799  73%  22/12/2006  13:57  OpenAL\upd.bat
   86016   36571  58%  20/03/2007  13:58  OpenAL\wrap_oal.dll
   18944    8784  54%  20/03/2007  13:52  OpenThreadsWin32.dll
 1282048  444636  66%  20/03/2007  13:56  osg.dll
  266240   93003  66%  20/03/2007  13:57  osgDB.dll
  147456   51154  66%  20/03/2007  13:59  osgdb_ac.dll
   22016    9779  56%  20/03/2007  13:58  osgdb_rgb.dll
  741376  278642  63%  20/03/2007  13:58  osgUtil.dll
   30208   15004  51%  20/03/2007  13:58  pthreadVC2.dll
 ------- -------  ---                     -------
 6524783 2500390  62%                          26

2. vc8sln04.zip - Set of MSVC8 build files - MD5 = a8b8a0da04b0b8ca86fdac978fa3c8ac - contents

  Length   Size  Ratio    Date     Time   Name
  ------   ----- -----    ----     ----   ----
   15541    2034  87%  19/03/2007  17:04  fgfs\fgfs.sln
    3926    1054  74%  25/11/2006  10:21  fgfs\fgfs.vcproj
  246073    8640  97%  19/03/2007  15:21  FlightGear\FlightGear.vcproj
   62545    2743  96%  19/03/2007  12:04  SimGear\SimGear.vcproj
   16001    1404  92%  20/11/2006  14:10  freeglut\freeglut_static.vcproj
    8412    1196  86%  20/11/2006  14:30  OpenAL\OpenAL-Windows\Alc\ALc.vcproj
    8412    1196  86%  20/11/2006  14:30  OpenAL\OpenAL-Windows\Alu\ALu.vcproj
   23381    1840  93%  26/11/2006  10:59  OpenAL\OpenAL-Windows\OpenAL32\OpenAL32.vcproj
   15996    1595  91%  26/11/2006  11:03  OpenAL\OpenAL-Windows\Router\Router.vcproj
    5532    1255  78%  21/11/2006  12:40  OpenAL\alut\admin\VisualStudioDotNET\alut\alut.vcproj
   12213    1495  88%  19/03/2007  13:19  zlib-1.2.3\projects\visualc6\zlib.vcproj
    5624    1127  80%  21/11/2006  13:18  PLIB\src\fnt\fnt.vcproj
    7365    1158  85%  21/11/2006  13:18  PLIB\src\js\js.vcproj
    7822    1262  84%  22/12/2006  12:18  PLIB\src\net\net.vcproj
   15596    1395  92%  21/11/2006  13:18  PLIB\src\pui\pui.vcproj
   10871    1273  89%  21/11/2006  13:18  PLIB\src\puAux\puAux.vcproj
    6459    1133  83%  21/11/2006  13:18  PLIB\src\sg\sg.vcproj
    6561    1132  83%  21/11/2006  13:18  PLIB\src\util\ul.vcproj
   42495    1821  96%  22/12/2006  12:19  PLIB\src\ssg\ssg.vcproj
    8816    1525  83%  20/03/2007  13:52  OpenThreads\win32_src\OpenThreads.vcproj
   79627    3628  96%  19/03/2007  13:23  OpenSceneGraph\VisualStudio\osg\osg.vcproj
   18220    1860  90%  19/03/2007  13:23  OpenSceneGraph\VisualStudio\osgDB\osgDB.vcproj
   23464    2054  92%  19/03/2007  13:23  OpenSceneGraph\VisualStudio\osgUtil\osgUtil.vcproj
    7176    1519  79%  19/03/2007  13:23  OpenSceneGraph\VisualStudio\osgPlugins\ac3d\ac3d.vcproj
    7196    1502  80%  19/03/2007  13:23  OpenSceneGraph\VisualStudio\osgPlugins\rgb\rgb.vcproj
    6540    1392  79%  21/11/2006  14:49  pthreads\pthread.vcproj
    1651     848  49%  20/03/2007  14:50  README.fgfs
    1568     583  63%  19/03/2007  15:13  upd.bat
    3619    1145  69%  20/03/2007  14:46  update.mak
     424     199  54%  20/03/2007  14:53  zipall.bat
     513     280  46%  19/03/2007  13:41  ziprt04.bat
    1461     541  63%  19/03/2007  13:41  zipvc04.bat
    2892     799  73%  22/12/2006  13:57  bin\openal\upd.bat
      38      36   6%  22/12/2006  13:58  changed.txt
     164     110  33%  19/03/2007  13:30  others.txt
     908     293  68%  19/03/2007  13:29  project.txt
      93      64  32%  15/12/2006  12:35  config.txt
    2946     890  70%  18/03/2007  14:01  SETUPFG.BAT
   13321   13321   0%  18/03/2007  19:22  srcchg04.zip
    3158    3158   0%  21/11/2006  12:27  srccfg04.zip
 ------- -------  ---                     -------
  704620   70500  90%                          40

Or you can go directly to the zip download page on the server that houses these zips ... or to my specific download page ... (MD5 (rfgbats02.zip) = d56c665199a141a5cb80e024288f7414) is a set of updated (2007-04-20) batch files, for the bin/bats folder.


Quick Start (using vc8sln04.zip)

This is a somewhat abbreviated version ;=))

If this is your first run, you may have to 'Unblock' the net communications, depending on your security settings, although, unless you have specifically enables some 'net' actions, flightgear does not really use this channel. I think this dialog occurs when 'socket' library is initialized in PLIB, and not only when a socket is specifically opened.

As some examples of the command line options, you could also download the fgvc8rt04.zip and extract all the BATCH files into the bin/bats folder, or directly download some updated (20070420) batch files,  (MD5 (rfgbats02.zip) = d56c665199a141a5cb80e024288f7414), and extract them , using the folder names ...


Missing Items

Since this is NOT an automated build system, and many of the projects are very active, the VCPROJ files can become out-of-date very quickly. This is usually evidenced by the fact that there are 'missing files' during the build, or 'unresolved externals' during the final link. This usually means that the source file list, for that particular project, has changed since the build system was last updated.

Aside from the quite drastic cvs 'backtracking' - that is do a cvs update using a Mar 30,2007 date - not tried nor recommended - the only thing that can be done about the 'missing files' is to delete them from the particular project, and continue with the build. The 'unresolved externals' usually means that some NEW file, or files, has/have been added, and now that file, or files, must be added to particular project of the build system.

Example 1: missing file

c1xx : fatal error C1083: Cannot open source file: '.\src\Instrumentation\encoder.cxx': 
No such file or directory

I just deleted this files from the FlightGear project, and continued the build.

Example 2: unresolved external

altimeter.obj : error LNK2019: unresolved external symbol "public: __thiscall 
FGAtmoCache::~FGAtmoCache(void)" (??1FGAtmoCache@@QAE@XZ) referenced in function 
"public: __thiscall FGAltimeter::~FGAltimeter(void)" (??1FGAltimeter@@QAE@XZ)

How to FIND the missing file? Using grep, or a grep-like tool you can search for the source (in *.c, *.cxx, *.cpp files) that contains 'FGAtmoCache'. In this case it showed up in FlightGear/src/Environment/atmosphere.cxx, which must then be added to the FlightGear project.

Example 3: unresolved external

NasalSys.obj : error LNK2019: unresolved external symbol _naInit_utf8 referenced 
in function "public: virtual void __thiscall FGNasalSys::init(void)" (?init@FGNasalSys@@UAEXXZ)

Again, searching the SimGear source for 'naInit_utf8', it is found in SimGear/simgear/nasal/utf8lib.c, thus this file is added to the SimGear project.

Example 4: unresolved external

NasalSys.obj : error LNK2019: unresolved external symbol _naInit_thread referenced in function 
"public: virtual void __thiscall FGNasalSys::init(void)" (?init@FGNasalSys@@UAEXXZ)

Searching the SimGear source this time, for ' naInit_thread', it is found in SimGear/simgear/nasal/threadlib.c, thus this file is added to the SimGear project.

And that does the trick.

Embedding manifest...
Build Time 6:20
Build log was saved at "file://c:\FG\14\FlightGear\Release\BuildLog.htm"
FlightGear - 0 error(s), 251 warning(s)
========== Build: 24 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Notice, I tend to work on the missing items 1 by 1, since sometimes the inclusion of a new file may require other new files to be added. Also I try to add it specifically to the appropriate 'project' ... you can verify, at least for simgear and flightgear the full set of source files, by carefully reading all the makefile.am files ...

Of course, in the above link, I am IGNORING the 251 warnings!!! Hopefully NOT at my peril ;=)).


Happy SIM flying ...

Geoff R. McLane
email address
date: 20070420 original: 20070320


EOP - fgfs-034.htm

Valid HTML 4.01 Transitional