Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Building FlightGear - Windows

From FlightGear wiki
Revision as of 12:31, 16 August 2009 by Tom-cat (Talk | contribs) (Step 3)

Jump to: navigation, search

1rightarrow.png See Building Flightgear for the main article about this subject.

NOTE: This page is a work in progress. The instructions should now be usable for all but building jpeglib and installing FlightGear

This section describes how to build FlightGear on Windows using Visual C++ 2008 Express Edition (the "free" for personal use version). These procedures will be very similar if you have the full Visual Studio 2008 and mostly similar if you're using older versions of Visual C++.

Keep in mind that FlightGear is a large project with external dependencies and compiling it is not a task for novice users. If you just want to fly, we recommend you get the binary distribution and have fun. If you intend to get hip deep in the code, please proceed...

Requirements

Before you can compile FlightGear, you need to have the following installed on your computer:

C++ compiler

You may download the Express ("free" for personal use) version of Visual C++ 2008 from Microsoft. C++ Builder and Turbo C++ Explorer (by CodeGear, formerly by Borland) should work as well with some effort. We have not tried this.

Please note that when using MSVC++ Express, you'll probably want to download the full offline installation image file (iso) which -unlike the web installation- doesn't require any complicated and long-winded registration process. The direct link to the latest version (as of 11/2008) is [1] - after having downloaded the iso image, you'll either have to burn it or simply mount it in order to execute the installation.

You will also need the Platform SDK (Software Developer's Kit).

You can download the PSDK from http://www.microsoft.com/downloads/details.aspx?FamilyId=F26B1AA4-741A-433A-9BE5-FA919850BDBF&displaylang=en or http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm

Detailed installation instructions are available here (and [2]).

CVS

FlightGear uses CVS (Concurrent Versions System) for version control. You will need a CVS client if you want to download the latest (development) source code for both FlightGear and SimGear. Traditionally, these are command line tools, but TortoiseCVS provides a graphic interface for Windows users. Download the installer for the latest stable version of TortoiseCVS, run the installer, using all of its default settings (the installation destination folder is up to you). It will ask you to restart the computer when it's finished <grumble>. Do that.

SVN

OpenSceneGraph (OSG) uses Subversion (SVN) for version control. You will need an SVN client if you want to use the latest (development) source code for OpenSceneGraph. TortoiseSVN provides a graphic interface for Windows users. Download the installer for the latest stable version of TortoiseSVN, run the installer, using all of its default settings (the installation destination folder is up to you).

Dependencies

FlightGear is dependent on quite a number of external libraries. You do not need to compile all of them yourself, but you will at least need to have their development version installed.

  • Boost
  • ALut, OpenAL and pthreads. These are listed here as one dependency because it's made available as a single package by a FlightGear project member.
  • zlib
  • jpeglib
  • Plib - portability libraries and scene graph.
  • OpenSceneGraph
  • SimGear - Simulation support libraries that are developed mainly by the same people who develop FlightGear, though it can be and is used for other purposes. If you are building FlightGear from CVS, you need the CVS version of SimGear. If you have strange FlightGear build errors, check that you have an up-to-date version of SimGear built and installed.

The dependencies are introduced in the steps below in roughly the order that you will need to get them.

Directory Structure

As noted above, FlightGear depends on several other software packages. The Visual C++ project files that are maintained in CVS for both SimGear and FlightGear assume that these dependencies can be found within a very specific directory structure. In these examples, the root of the FlightGear related directories is C:\FlightGear\. This part is actually up to you; you could choose a completely different name and drive location.

All other directories shown under this project root must follow the directory structure shown below:

 C:\FlightGear\boost_1_39_0\
 C:\FlightGear\simgear\
 C:\FlightGear\simgear\simgear\
 C:\FlightGear\install\msvc90\OpenSceneGraph\include\
 C:\FlightGear\3rdParty\include\

If you continue to follow the instructions in this wiki, you will end with the proper directory structure that is shown above.

Compiling

Getting Boost 1.39.0

Step 1

Download Boost packaged release Version 1.39.0 (about 188 MB) from http://sourceforge.net/projects/boost/files/boost/1.39.0/boost_1_39_0.zip/download (direct link) or from the project releases page at http://www.boost.org/users/download/#releases

Step 2

Extract the contents of the boost archive in your \FlightGear directory. This will create a subdirectory named boost_1_39_0 where the boost libraries and include files reside.

Getting "3rdParty" ALut, OpenAL and pthreads

Olaf Flebbe has provided an archive containing the following FlightGear dependencies:

 ALut
 OpenAL
 pthreads

Download the archive from http://www.oflebbe.de/FlightGear/3rdParty-2008-01-30.zip (direct link) or visit Olaffe's Compiling FlightGear page at http://www.oflebbe.de/FlightGear/index.html

Extract the archive in your FlightGear project root directory, C:\FlightGear\ in these instructions. This will create the directory 3rdParty under your project root directory.

Getting zlib

Step 1

Download the latest zlib binary package here http://sourceforge.net/projects/gnuwin32/files/zlib/1.2.3/zlib-1.2.3-lib.zip/download (direct link) or view the release page here http://sourceforge.net/projects/gnuwin32/files/zlib/1.2.3/

Step 2

Extract the archive you downloaded in Step 1 in the "3rdParty" directory under your FlightGear project root directory.

Step 3

As of zlib version 1.2.3, you must edit line 287 of the file "3rdParty\include\zconf.h" from "#if 1" to "#if 0" to avoid compiler errors when compiling SimGear against zlib.

Getting jpeglib

Step 1

Download the latest jpeglib source package here http://www.ijg.org/

Step 2

TODO: Figure out to compile it :(

Getting plib

You may download a prebuilt version of plib from http://www.oflebbe.de/FlightGear/plib-2007-04-16.zip (direct link) or visit Olafe's Compiling FlightGear page at http://www.oflebbe.de/FlightGear/index.html If you use this prebuilt, just extract the archive file's contents in your FlightGear project root directory. This will create the subdirectory plib.

There have been some bug fixes and changes to plib since the above package was created, so you may wish to use the latest development version, 1.8.5-rc1 which you may download here http://sourceforge.net/projects/plib/ One annoying bug that was fixed caused joystick models to not be recognized automatically on Windows Vista (and maybe XP).

Going this route means that you must compile plib yourself by following the instructions below:

Step 1

Download the latest plib source tarball from http://sourceforge.net/projects/plib/ and extract it in some location that is NOT in your FlightGear project root directory. This will create a subdirectory named plib-1.8.5-rc1

Step 2

Double-click the file plib-1.8.5-rc1\plib.dsw. This should launch Visual C++ which will ask if you want to convert the project file; answer "Yes to all" at the convert prompt.

Step 3

Build the debug version of the plib libraries first by setting the VC++ Solution Configuration for Debug and hitting the F7 key.

Build the release version of the plib libraries next by setting the VC++ Solution Configuration for Release and hitting the F7 key.

NOTE: as of this writing, 5 compile errors in 4 files will occur. In each case, a typecast of (char*) must be added in order to compile without error using VC++ 2008 (VC90).

Step 4

Create the subdirectory plib in your FlightGear project root directory.

Example:

 C:\FlightGear\plib

Step 5

Copy all of the files in your plib-1.8.5-rc1 directory that have the extensions "h", "lib" and "pdb" the new plib directory under your FlightGear project root directory.

Getting OpenSceneGraph (OSG)

Step 1

To build SimGear and FlightGear from CVS head, you'll usually need the latest version of OSG. OSG from SVN head might be the best choice, but we don't have OSG for Windows build instructions prepared yet.

Download the latest Windows binaries from this page: [3]

Get the archive(s) named "openscenegraph-all[...]". Get both the Release and Debug versions if you expect to do any debug builds of FlightGear. Otherwise, just the Release version should be fine.

Step 2

Create a the following directure structure under your FlightGear project root directory: "install\msvc90\"

Example:

 C:\FlightGear\install\msvc90\

I have no idea why that directory structure was chosen, but that's what the MS VC++ project file(s) in FG CVS expect.

Step 3

Extract the OSG archive(s) you downloaded in Step 1 in the directory you created in Step 2.

Step 4

Rename the resulting "OpenSceneGraph-[version]" directory to simply "OpenSceneGraph".

Getting and compiling SimGear

Step 1

Navigate to the base folder for your FlightGear stuff; In this example, we've chosen "C:\FlightGear"

In Windows Explorer, select the "C:\FlightGear" folder and right-click on it. From the resulting pop-up menu, choose "CVS Update". On the "Module" tab, enter the following in the CVSROOT field:

:pserver:cvsguest@cvs.simgear.org:/var/cvs/SimGear-0.3

At the "Module" section near the bottom of the "Module" tab, click the "Fetch List" button. You will see some brief action and may see an error and a prompt for a password. Enter "guest" for the password (without the quote symbols). From the drop-down "Module" list, select "source" and click the "OK" button to begin the checkout.

Step 2

Since all the source code will be downloaded into a directory called source, you will need to rename that directory to simgear.

Navigate to simgear\projects\VC90 and double-click on the file SimGear.vcproj. This should launch Visual C++ with the SimGear project loaded.

Step 3

Build SimGear, either Release, Debug or both using VC++ 2008 (9.0)

Note: with the default settings, Visual C++ will yield many compiler warnings. Unfortunately, this is normal.

Getting and compiling FlightGear

Step 1

Make a base folder for your FlightGear stuff; In this example, we've chosen "C:\FlightGear"

In Windows Explorer, select the "C:\FlightGear" folder and right-click on it. From the resulting pop-up menu, choose "CVS Update". On the "Module" tab, enter the following in the CVSROOT field:

:pserver:cvsguest@cvs.flightgear.org:/var/cvs/FlightGear-0.9

At the "Module" section near the bottom of the "Module" tab, click the "Fetch List" button. You will see some brief action and may see an error and a prompt for a password. Enter "guest" for the password (without the quote symbols). From the drop-down "Module" list, select "source" and click the "OK" button to begin the checkout.

A directory with the name source will then be created with all of Flightgear's source code downloaded into it. Rename this directory from source to flightgear.

Step 2

Build either the Debug or Release version FlightGear as desired.

Step 3

TODO: Installation.

Checking out the FlightGear data

The binary distribution package contains data for only a small subset of the existing aircraft and other objects. The instructions below tell you how to obtain the full set of data, in their latest, greatest form.

Make a base folder for your FlightGear stuff; In this example, we've chosen "C:\FlightGear"

In Windows Explorer, select the "C:\FlightGear" folder and right-click on it. From the resulting pop-up menu, choose "CVS Checkout...". On the "Module" tab, enter the following in the CVSROOT field:

:pserver:cvsguest@cvs.flightgear.org:/var/cvs/FlightGear-0.9

At the "Module" section near the bottom of the "Module" tab, click the "Fetch List" button. You will see some brief action and may see an error and a prompt for a password. Enter "guest" for the password (without the quote symbols). From the drop-down "Module" list, select "data" and click the "OK" button to begin the checkout.

The result of the checkout is a directory called C:\FlightGear\data. To use this data directory with the FlightGear program, you can either (a) move it to C:\Program Files\FlightGear\ directory or (b) direct FlightGear to the actual location of this data directory from the command line or within the fgrun launcher application.

External links