Compile In MacOsX

From FreeOrionWiki

Jump to: navigation, search

Contents

Latest Version

This section is about compiling the latest version of FreeOrion for Intel Macs with OSX 10.6+. In case you want to compile FreeOrion for older versions of OS X, you're most probably out of luck. You can have a look at the 'Old SDK' section (see below), but the information there is really out of date, it's very likely completely useless by now. But of course, you can try your luck...

Hardware Requirements

Intel Mac

CPU: Mimimum: Core2 Duo; Recommended: Core i5 or better

RAM: Minimum: 4GB; Recomended: 8GB or more (the more the better...)

Software Requirements

Mac OS X 10.6.8 or later

Xcode 3.2 or later - Just get the latest version of Xcode from the Mac App Store for free.

Subversion - Subversion should be automatically installed when you install Xcode.

The latest version of the FreeOrion SDK

Build Directions

Step by step


To keep your sources up-to-date you have to use the svn update method before building (Xcode should not run at that time). You can also use Xcode's built-in SVN client, but it is kind of slow.

In a nutshell

Troubleshooting and keeping your project up-to-date

Updating the version number

The version information of FreeOrion in OS X is stored in two files:


Adding new source files

When you get errors like

Undefined symbols for architecture i386:
  "_condition3_p", referenced from:
      (anonymous namespace)::Init()in libCommon.a(ConditionParser.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

it is likely that there is a file missing in the target you get the error from.

To add the file ('ConditionParser3.cpp' in this case), just drag it into the 'Compile Sources' section in the 'Build Phases' window of the target.

Other Compilation Errors

You can report errors not listed here on the forums.

Old SDK

ATTENTION: This section is severely out of date. The instructions provided here are no longer useful with current FreeOrion SVN revisions.

If you want to try your luck at compiling FreeOrion for OS X <= 10.5, the following information might be useful.

As of Nov. 20, 2007 you can download an SDK which contains all the necessary libraries as universal binaries and an Xcode project.

Note: the log4cpp, graphviz and DevIL dependencies listed on this page are no longer required for FreeOrion. Instructions relating to them are out of date.

Software requirements

Build Directions

Download the SDK from SourceForge and unpack it. A current limitation of the Xcode project requires that it be unpacked to a filesystem path that contains no space characters.

In the newly created "freeorion-sdk/FreeOrion/Xcode" directory you will find the Xcode project and library dependencies required to build.

The included SVN revision for FreeOrion and FreeOrion/GG are a snapshot of the last release. Checking out or updating to the most recent revisions may require that you modify the Xcode project to:

Patches that update the Xcode project or Mac build are welcome.

Compilation Pitfalls

TODO

SDK libraries

The libraries (with include files) in the SDK are:


Building the Libraries by yourself

It's best to just stick with the SDK and just build the libraries yourself if you encounter problems with the ones included in the SDK.

Most of the problems with building the libraries arise because not all of them are that easy to build as universal binaries. In the worst case you'll have to build the binaries twice and then combine the result using

lipo

The following versions are known to work:

Ogre 1.7.0

Ogre can be built easily via their CMake system and Xcode project. They also provide pre-compiled dependency libraries which will also need to be copied into the FreeOrion SDK.

Python 2.5.5

Python 2.6 may result in a FreeOrion build time incompatibility on OS X 10.4, while Python 2.4 doesn't seem to be able to used to build FreeOrion on either 10.4 or 10.5.

./configure --enable-universalsdk=/Developer/SDKs/MacOSX10.4u.sdk/ --prefix=$HOME/local/python-2.5.5 --enable-framework
make
make install

It may try to write the framework to /Library/Frameworks/Python.framework

Boost 1.42.0

Build this after python:

./bootstrap.sh --prefix=$HOME/local/boost_1_42_0 --with-python-root=$HOME/local/python-2.5.5
./bjam link=static variant=release threading=multi macosx-version-min=10.4 install

SDL, Ogg, Vorbis

Building those is pretty straightforward. They all come with an Xcode project supplied. Just make sure that the install_path of the Framework is configured correctly if you plan on having it in the application bundle.

The produced Ogg/Vorbis frameworks have internal headers that may need to be renamed to support case sensitive filesystems. And the Vorbis.framework itself might need to be renamed to vorbis.framework.

libpng

./configure
make CC="gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk

log4cpp 0.3.5 rc3

open include/log4cpp/manipulator.hh and remove ';' on line 29

./configure CXX="g++ -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
make clean
make
cd src/
mkdir .lipos
mv .libs/liblog4cpp.4.0.5.dylib .lipos/
mv .libs/liblog4cpp.a .lipos/
cd ..
./configure CXX="g++ -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
make clean
make
cd src
mv .lipos/liblog4cpp.4.0.5.dylib .libs/liblog4cpp.4.0.5.dylib_i386
mv .lipos/liblog4cpp.a .libs/liblog4cpp.a_i386
rmdir .lipos
cd .libs
lipo -arch i386 liblog4cpp.4.0.5.dylib_i386 -arch ppc liblog4cpp.4.0.5.dylib -create -output liblog4cpp.4.0.5.dylib
lipo -arch i386 liblog4cpp.a_i386 -arch ppc liblog4cpp.a -create -output liblog4cpp.a
rm liblog4cpp.a_i386
rm liblog4cpp.4.0.5.dylib_i386
sudo make install

graphviz-2.20.3

./configure --prefix=$HOME/local/graphviz-2.20.3 --disable-swig --disable-sharp --disable-guile --disable-io --disable-java --disable-lua --disable-ocaml --disable-perl --disable-php --disable-python --disable-r --disable-ruby --disable-tcl --disable-ltdl --without-freetype --without-x CFLAGS="-arch i386 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" LDFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch i386"
make
make install

libjpeg

Mac OS X 10.3 and later ship with GNU libtool, albeit under a slightly different name, glibtool. We need only link to it to build the dynamic version of libjpeg that GD4O needs to work. Change into the build directory:

cd ../jpeg-6b/
ln -s `which glibtool` ./libtool

However, on Mac OS X 10.4 (Tiger), the libtool needs to be specified the build environment. Enter:

setenv MACOSX_DEPLOYMENT_TARGET 10.4

in tcsh, or:

export MACOSX_DEPLOYMENT_TARGET=10.4

in bash. Now configure with shared library support, then build and install:

./configure --enable-shared && make && sudo make install

configure will complain about ltconfig: cannot guess host type; you must specify one. An alternative to symlinking libtool is to copy its skeletal configuration defaults, as suggested by a correspondent (meaning, I haven't verified this):

cd ../jpeg-6b
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .
./configure CC="gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" --enable-shared
make
sudo make install
sudo ranlib /usr/local/lib/libjpeg.a

freetype

The freetype library is the same one that is included with the precompiled Ogre dependencies.

libDevIL

This section is probably dated...

Make sure that there is no previous version installed under /usr/local/lib that could be found by configure. Otherwise this can break the build process

sudo rm -rf /usr/local/include/IL
sudo rm /usr/local/lib/libIL*
aclocal
automake
./configure CC="gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" CPP="/usr/bin/cpp" CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib"
make clean
make
cd src-IL/src/
mkdir .lipos
mv .libs/libIL.1.0.0.dylib .lipos/
cd ../..
cd src-ILU/src/
mkdir .lipos
mv .libs/libILU.1.0.0.dylib .lipos/
cd ../..
cd src-ILUT/src
mkdir .lipos
mv .libs/libILUT.1.0.0.dylib .lipos/
cd ../..
./configure CC="gcc -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" CPP="/usr/bin/cpp" CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib"
make clean
make
cd src-IL/src/
mv .lipos/libIL.1.0.0.dylib .libs/libIL.1.0.0.dylib_i386
rmdir .lipos
cd .libs
lipo -arch i386 libIL.1.0.0.dylib_i386 -arch ppc libIL.1.0.0.dylib -create -output libIL.1.0.0.dylib
rm libIL.1.0.0.dylib_i386
sudo /usr/bin/install -c libIL.1.0.0.dylib /usr/local/lib/libIL.1.0.0.dylib
cd ../../..
cd src-ILU/src/
mv .lipos/libILU.1.0.0.dylib .libs/libILU.1.0.0.dylib_i386
rmdir .lipos
cd .libs
lipo -arch i386 libILU.1.0.0.dylib_i386 -arch ppc libILU.1.0.0.dylib -create -output libILU.1.0.0.dylib
rm libILU.1.0.0.dylib_i386
sudo /usr/bin/install -c libILU.1.0.0.dylib /usr/local/lib/libILU.1.0.0.dylib
cd ../../..
cd src-ILUT/src/
mv .lipos/libILUT.1.0.0.dylib .libs/libILUT.1.0.0.dylib_i386
rmdir .lipos
cd .libs
lipo -arch i386 libILUT.1.0.0.dylib_i386 -arch ppc libILUT.1.0.0.dylib -create -output libILUT.1.0.0.dylib
rm libILUT.1.0.0.dylib_i386
sudo /usr/bin/install -c libILUT.1.0.0.dylib /usr/local/lib/libILUT.1.0.0.dylib
cd ../../..
(sudo cd /usr/local/lib && sudo rm -f libIL.1.dylib && sudo ln -s libIL.1.0.0.dylib libIL.1.dylib)
(sudo cd /usr/local/lib && sudo rm -f libIL.dylib && sudo ln -s libIL.1.0.0.dylib libIL.dylib)
(sudo cd /usr/local/lib && sudo rm -f libILU.1.dylib && sudo ln -s libILU.1.0.0.dylib libILU.1.dylib)
(sudo cd /usr/local/lib && sudo rm -f libILU.dylib && sudo ln -s libILU.1.0.0.dylib libILU.dylib)
(sudo cd /usr/local/lib && sudo rm -f libILUT.1.dylib && sudo ln -s libILUT.1.0.0.dylib libILUT.1.dylib)
(sudo cd /usr/local/lib && sudo rm -f libILUT.dylib && sudo ln -s libILUT.1.0.0.dylib libILUT.dylib)
sudo mkdir /usr/local/include/IL
sudo /usr/bin/install -c -m 644 include/IL/il.h /usr/local/include/IL/il.h
sudo /usr/bin/install -c -m 644 include/IL/ilu.h /usr/local/include/IL/ilu.h
sudo /usr/bin/install -c -m 644 include/IL/ilut.h /usr/local/include/IL/ilut.h
sudo /usr/bin/install -c -m 644 include/IL/il_wrap.h /usr/local/include/IL/il_wrap.h
sudo /usr/bin/install -c -m 644 include/IL/config.h /usr/local/include/IL/config.h
sudo /usr/bin/install -c -m 644 include/IL/devil_internal_exports.h /usr/local/include/IL/devil_internal_exports.h
sudo /usr/bin/install -c -m 644 include/IL/ilu_region.h /usr/local/include/IL/ilu_region.h


Compilation Errors

Please report compilation errors in the forums.


Runtime Errors

Please report runtime errors in the forums.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox