Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 11 (modified by ahedges, 8 years ago) (diff)

Mac OS X Dependencies

In order to get the orxonox dependencies to build properly on the Mac, some tricks are needed. This page will contain some or more important tidbits for compiling various dependencies on the Mac.

General Considerations

Build all libraries as 64-bit-only dynamic libraries or frameworks (fat binaries would also work, but we only need the 64 bit part).

LLVM/Clang (the default Xcode compiler) uses a different standard c++ library than gcc (libc++ instead of libstdc++, they are not binary compatible). So make sure that all dependencies are linking against libc++.

Useful Tools

To see what libraries the .dylib is linking against use:

otool -L libsomething.dylib

To change the library install name or the locations of libraries it links against, use the install_name_tool (see the man page for details).

With

otool -hv libsomething.dylib

you can check the header (useful for determining if you have a 64-bit or a fat binary).

To find which symbols the library defines use nm:

nm libsomething.dylib

Dependency List

Library name Minimum Version Recommended Version Notes
OGRE 3D Graphics Engine 1.4 1.8.2
CEGUI (Crazy Eddie's GUI System) 0.5 0.7.9 We need: CEGUI.framework, CEGUILuaScriptModule.framework and ceguitolua++.framework. Plus, disable all ppc architectures
Boost libraries 1.35 1.49
Lua (scripting language) 5.0 or 5.1 5.1.4 Hint: Use the patchfile located in the Tools directory of the dependency package. ($patch -p1 -i patchfile) inside source dir. But preferentially use the Lua version shipped with CEGUI
Tcl (shell script language) 8.4 or 8.5 - Use Apple system version
OpenAL (audio) (not yet specified) - Use Apple system version
ALUT (audio) (not yet specified) - Can't be compiled on Apple. Use the package included in dependency package or consult Flight Gear. Sadly, I do not know how they compiled this framework.
LibOgg (not yet specified) 1.2.1
LibVorbis (not yet specified) 1.3.2
LibVorbisFile (not yet specified) 1.3.2 Comes with LibVorbis
ZLib (compression) (not yet specified) - Use Apple system version

Apple Mac OS X uses the following library paths:

  • /usr
  • /usr/local
  • /opt/local (MacPorts source distribution: MacPorts)
  • /sw (Fink binary distribution: Fink)
  • /Library/Frameworks (for Apple frameworks; dynamically linked and self-contained structures. See CFBundles for information.)
  • ~/Library/Frameworks
  • /System/Library/Frameworks
  • /Developer/Library/Frameworks

Compiling Ogre 1.8

Download the source archive with unix line endings from the ogre website or the repository from BitBucket using mercurial.

Make sure you have all the needed libraries installed (it should compile with the zlib, zziplib, freeimage, freetype, OpenGL, OpenGL ES 1.x, OpenGL ES 2.x, cg, iOS SDK, Carbon, Cocoa, IOKit and CoreVideo options enabled, you can use Homebrew to install the libraries you don't have installed yet). Use cmake to create the Xcode project (mkdir build && cd build && cmake .. -G Xcode). Check the output of the cmake script to verify that it found all the needed libraries. Open the Xcode project. Set the deployment target to 10.8 and the Base SDK to 10.12. Then in the build settings make sure that it builds only the 64 bit version and uses libc++.

It probably will give you two errors related to some initializers. Delete the (NULL) on the line. Next it will probably complain about some symbols starting with _agl. To solve that you need to add the "Link binary with libraries" phase to the RenderSystem_GL target. Press the add button and chose "AGL.Framework". Now the project should compile. We need Ogre.Framework, Plugin_CgProgramManager.dylib, Plugin_ParticleFX.dylib and RenderSystem_GL.dylib.

Compiling CEGUI 0.7

Compiling CEGUI is a bit tricky. First download the source of 0.7.9 and the dependency package for a 0.8 release from the CEGUI website.

Compiling the dependencies: Modify the cmakefile that it compiles all dependencies except the "Direct3d 11" by default (change all the options to have TRUE at the end). In order to get DevIL to compile you have to comment out all the lines that contain #undef __LITTLE_ENDIAN__ or #define __LITTLE_ENDIAN__ in deps/src/devil-1.7.8/src-IL/include/il_endian.h. Build everything with cmake (mkdir build && cd build && cmake .. && make -j8) Also make sure you already have compiled Ogre.framework using the release configuration, you'll need that later.

Compiling CEGUI: Open the Xcode project that is provided in CEGUI-0.7.9/projects/Xcode/. Like with ogre change the deployment target, base sdk, target architecture and c++ std library.

For everything to compile correctly you have to copy the dependencies you compiled earlier to the project root. Then you have to move them around a bit until Xcode finds everything where it is looking (use the precompiled dependencies for 0.7 as a reference). You have to split the DevIL libraries into IL.framework and ILU.framework. Note that the headers of the Xerces framework have changed so you have to supply the new ones. To compile the CEGUIOgreRenderer you have to set CEGUI_OGRE_SDK_PATH to the build folder in the ogre project root. Then CEGUI_OGRE_SAMPLE_LINK_FLAGS should point to the Ogre.framework.

Then the parts that you need of CEGUI should compile (some samples probably still won't compile).

Compiling Ogg and Vorbis

Download and unzip the sources first from Xiph.org. Outside of libogg-1.2.1, create a directory lib_build. Open the file os_types.h in

libogg-1.2.1/include/ogg/os_types.h

and replace the following lines

#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */

#  include <inttypes.h>
   typedef int16_t ogg_int16_t;
   typedef u_int16_t ogg_uint16_t;
   typedef int32_t ogg_int32_t;
   typedef u_int32_t ogg_uint32_t;
   typedef int64_t ogg_int64_t;

with:

#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */

#  include <sys/types.h> // used wrong header file
   typedef int16_t ogg_int16_t;
   typedef u_int16_t ogg_uint16_t;
   typedef int32_t ogg_int32_t;
   typedef u_int32_t ogg_uint32_t;
   typedef int64_t ogg_int64_t;

Open up the Terminal (/Applications/Utilities/Terminal), and enter the following set of commands (assuming that you have downloaded ogg and vorbis to yourname/Downloads (you need to enter your password during the following sequences):

cd Downloads/libogg-1.2.1 && ./configure CFLAGS="-arch x86-64" LDFLAGS="-arch x86-64" && make && sudo make install

next, enter the following lines:

cd ../libvorbis-1.3.2 && ./configure CFLAGS="-arch x86-64" LDFLAGS="-arch x86-64" && make && sudo make install

Finally, you need to delete the ogg and vorbis files in your Orxonox dependency package (Just delete everything with the names ogg and vorbis in them). They are locaded in:

dependencies/include and dependencies/lib

That's it - now you can follow the normal building steps. If building works out for you, then please send us an e-mail with the lib_build folder as a zip file attached!