Compile In Mac OS X 10.5 or earlier

From FreeOrionWiki
Jump to: navigation, search

Preliminary

ATTENTION: This section is severely out of date.

The instructions on this page have been copied almost without any adjustments from it's original page. I've decided to keep these instructions and move them to this page only to have them somewhere just in the highly unlikely case we might need some of the information. And for anyone crazy enough to try and build FreeOrion for OS X 10.5 or earlier. The information found here might give you some starting point. Good luck...

Old SDK

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

  • Subversion
  • Xcode >= 2.5. To compile FreeOrion you need the Developer Tools which can be downloaded from Apple. If you already have Xcode installed but it is older than 2.5 you should update.

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:

  • include any new sources added to FreeOrion or GG reversion control
  • remove old sources that were deleted from FreeOrion or GG revision control
  • make any new Mac specific code changes that resolved a Mac specific compilation error (possibly non-trivial)
  • if you're using the SDK packaged for the 0.3.13 release (Jun 13), it may include locally modified source files that will conflict with latest versions. When updating, just choose to abandon the local changes and go with "theirs".

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

Compilation Pitfalls

  • GCC 4.2 does not work to build use GCC 4.0 for now (with base SDK set to 10.4 in project settings)

TODO

  • The dependency on DevIL has been removed, but the Mac OS X build is still configured to use it.

SDK libraries

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

  • Dynamic Libraries
    • libpng
    • DevIL (only linked against libpng)
    • libjpeg
    • graphviz
    • libz
  • Frameworks
    • SDL
    • Ogg
    • Vorbis
    • Python
    • Ogre
  • Static Libraries
    • log4ccp
    • freetype2
    • Boost (only filesystem, python, serialization, signals, thread)


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:

  • SDL 1.2.11
  • log4cpp 0.3.5 rc3
  • graphviz 2.20.3: building from source is necessary to get the libgvc_builtins library
  • freetype 2.2.1
  • libpng 1.2.12
  • log4cpp 0.3.5 RC3
  • Boost 1.42.0
  • DevIL 1.6.8 RC1 (RC2 has problems with aclocal and automake)
  • Python 2.5.5

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.