FlightGear Git on Mac OS X

From FlightGear wiki
Jump to navigation Jump to search

Please read this, important!

This page is under heavy developement! It shows how you can probably succeed with installing your own FlightGear Developement Version on OSX 10.5 or 10.6, on a Intel-based Mac. This page is experimental and this building should not be used unless you know what you do with your computer. Keep in mind that installing developer versions of software can crash your computer ;-) Please do not start to mail to the FlightGear- or SimGear Devel-Mailinglist with FlightGear OSX installing problems related to this Wiki, ask your questions or report errors in the forum in postings/threads related to this page! --> (new topic will follow soon, build system changed to cmake and old thread is not valid anymore)

Before you start, move other installs out of system root

The build system for FlightGear changed 2011 to cmake. When you want to follow this wiki and get a new clean install you should remove all former installs of plib, PLIB.Framework, OpenSceneGraph, simgear and flightgear. Depending on location where you installed FlightGear GIT version (NOT MacFlightGear!), you have to remove a lot of stuff i.e. in /usr/include, /usr/lib, /usr/local/lib, /usr/local/include etc. (depends where you installed before, but default is /usr/local/...). It is probably better NOT TO DELETE this stuff, keep the content in a safe place, but out of system root.

Default installing locations

This guide installs the software with default paths on your system (MacPorts in /opt/local/ - other parts in /usr and /usr/local). There is only one framework (to be placed manually) in /Library/Frameworks. Use your own configuration options to get your preferred locations!. Do not post linking errors in the forum or the lists when you decide to use your own search paths.

Requirements

System Requirements: OSX 10.5.8 (Leopard) or higher, and an Intel Mac. Other requirements: Basic knowledge of using Terminal on OSX, Xcode Dev Tools, MacPorts

You are going to install:
Xcode Dev Tools, MacPorts, boost, cmake, plib, ALUT.framework, OpenSceneGraph, git, SimGear and finally FlightGear

This action will take more than 2 hours!

Install

Install Xcode Developer Tools

Download and install Xcode Dev Tools for OSX
for OSX 10.5.8 you need Dev Tools 3.1.4 How to get older dev tools versions
for OSX 10.6 (x86_64) you can use Dev Tools 3.2.6

http://developer.apple.com/technologies/xcode.html

Note that apple charges for version 4.0 and later and it is hard to find the links for older versions. However you can still use the required version for flightgear [3.2 or later] for free and you don’t need Dev Tools >= 4 How to get older dev tools versions

Install MacPorts

Download and install MacPorts
Note: With already installed MacPorts it could be a good idea to first decactivate all other ports for this wiki. More information: http://guide.macports.org/#installing.macports.upgrade.

Update MacPorts

In terminal type

sudo port selfupdate

As of november 2011 you should get MacPorts 2.0.3

Maybe you need also to upgrade your ports a bit, then type

sudo port upgrade outdated

Download and Install GIT

There are different possibilities to install GIT.

Option 1: install via MacPorts in Terminal with "sudo port install git-core"
Option 2: Download and install GIT for OSX. Grab the latest version from
http://code.google.com/p/git-osx-installer/

Install boost (1.47.0) with MacPorts

sudo port install boost +universal

Note: this step can take more than 30 minutes! Boost is made for drinking more tea.

Install cmake (2.8.6) with MacPorts

sudo port install cmake +universal

Install plib (1.8.5) +universal

just install plib via MacPorts

sudo port install plib +universal

Install the ALUT.framework

Note: This framework is provided by James T. This is not official! James posted this download link in the develist and the link to the framework can change. Linking to the OpenAL/alut.h header and compilation of official freealut fails on my OSX 10.5.8 with FlightGear, and there is also no port avaiable at the moment. Big thanks to James for providing this framework (universal). Download here (temporary location!): [1]
Unzip and move the ALUT.framework folder to /Library/Frameworks

Download and install OpenSceneGraph trunk

Remark 1: This is the most complicated part. Be sure you have all deps for OpenSceneGraph installed when you change some cmake settings like cocoa/ioimage instead of quicktime/carbon etc., then you will probably need tiff, jpeg and libpng to get some OSG Plug-ins installed correctly. All this libs are available trough macports i.e. with "sudo port install tiff jpeg libpng" etc. Dont forget to add "+universal" when you want to compile for target "i386;x86_64".

Remark 2: Be careful what frameworks you have installed in /Lybrary/Frameworks. I edited some scenery for flightgear and that was the reason I had some geo frameworks installed. I had to move this frameworks to a safe place during OSG compilation, out of path (i.e. GDAL, GEOS, GSL, PROJ and especially UnixImageIO.framework).


Checkout OpenSceneGraph trunk with

git clone https://github.com/openscenegraph/osg.git OpenSceneGraph

Make a copy of the "OpenSceneGraph" folder you get, maybe you need a fresh clone again when it fails.

cd OpenSceneGraph

For compiling with imageio/cocoa, target architecture i386 AND x86_64:

cmake  -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.5.sdk -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.5 -DCMAKE_MINSIZEREL_POSTFIX= -DBUILD_OSG_APPLICATIONS=OFF \
-DCMAKE_RELWITHDEBINFO_POSTFIX= -DOSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX=imageio \
-DOSG_WINDOWING_SYSTEM=Cocoa

Alternate for compiling with imageio/carbon, target architecture i386/32-bit only:

cmake  -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.5.sdk -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.5 -DCMAKE_MINSIZEREL_POSTFIX= -DBUILD_OSG_APPLICATIONS=OFF \
-DCMAKE_RELWITHDEBINFO_POSTFIX= -DOSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX=imageio \
-DOSG_WINDOWING_SYSTEM=Carbon

Finally:

make
sudo make install

Remark: Compiling OpenSceneGraph often takes more than 30 minutes.

Git SimGear/FlightGear/fgdata

Create a directory where you want to place your new FlightGear code.

git clone git://gitorious.org/fg/flightgear.git
git clone git://gitorious.org/fg/simgear.git
git clone git://mapserver.flightgear.org/fgdata/ 
or git clone git://gitorious.org/fg/fgdata.git

The fgdata is about 4 GB! You can clone this repo once and later you use git pull. There is other page FlightGear and Git about using the FlightGear Gitorious GIT Repos. There is also an alternate GIT repo on mapserver.flightgear.org: http://mapserver.flightgear.org/git/.

Install SimGear (!new since nov 2011: cmake build)

cd to the simgear directory and type

 export CFLAGS="-g -O2 -fPIC -arch i386 -arch x86_64"
 export CXXFLAGS="-g -O2 -fPIC -arch i386 -arch x86_64"
 cmake . -DJPEG_FACTORY=1 -DCMAKE_INSTALL_PREFIX=/usr/local
 make
 sudo make install

Install FlightGear (!new since nov 2011: cmake build)

cd to the flightgear directory and type

 export CFLAGS="-g -O2 -fPIC -arch i386 -arch x86_64"
 export CXXFLAGS="-g -O2 -fPIC -arch i386 -arch x86_64"
 cmake . -DJPEG_FACTORY=1 -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_FGADMIN=OFF -DWITH_FGPANEL=OFF
 make
 sudo make install

As of november 2011 fgadmin and fgpanel won’t compile here on OSX. Set -DENABLE_FGADMIN=OFF -DWITH_FGPANEL=OFF to ON when you want to give it a try ...

Finish and Testrun

You can use fgfs --fg-root=/path/to/fgdata and --fg-scenery=/path/to/scenery

fgfs --option1 --option2 ...
type in terminal "fgfs --help -v" to get all current command line options