Building under Mac OS X

crt32

01-09-2010 09:33:05

This one gave me a lot of trouble, so I decided to share how I made it work, since I couldn't find any help in the forums or at google.

Here is how I changed CMakeLists.txt: (basically replaced the PKG_CHECK_MODULES part)
In my build system Ogre is already found (the script for that is kind of longish so I decided not to include it), check the wiki if you have trouble with that.
if (APPLE)
FIND_PACKAGE(OPENAL REQUIRED)
FIND_LIBRARY(OGG Ogg REQUIRED)
FIND_LIBRARY(VORBIS Vorbis REQUIRED)

set(OGG_LIBRARIES ${OGG})
set(VORBISFILE_LIBRARIES ${VORBIS})
set(VORBISFILE_INCLUDE_DIRS ${VORBIS_INCLUDE_DIRS})
set(OPENAL_INCLUDE_DIRS ${OPENAL_INCLUDE_DIRS} ${OPENAL_INCLUDE_DIR})
set(OPENAL_LIBRARIES ${OPENAL_LIBRARIES} ${OPENAL_LIBRARY})
else ()
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(OPENAL REQUIRED openal)
PKG_CHECK_MODULES(OGG REQUIRED ogg)
PKG_CHECK_MODULES(VORBISFILE REQUIRED vorbisfile)
endif()


If you use the 32-bit build of ogre, add somewhere
if (APPLE)
set(CMAKE_OSX_ARCHITECTURES "i386")
endif()


Next, I had to change OgreOggSoundPrereqs.h:
(OpenAL.framework does not have an AL subdirectory)
#elif OGRE_COMPILER == OGRE_COMPILER_GNUC
# if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
# include <al.h>
# include <alc.h>
# else
# include <AL/al.h>
# include <AL/alc.h>
# endif


To make it work, I had to build Ogg.framework and Vorbis.framework myself. OpenAL is already included in Xcode.
To accomplish this, get Ogg and Vorbis from here (latest version):
http://downloads.xiph.org/releases/ogg/
http://downloads.xiph.org/releases/vorbis/

Extract and for both of them (you will need to build ogg first) do the following:
- Open the Xcode project in subdirectory macosx
- For both Project and Active Target set SDK to current and Architecture to 32-bit (except you run a 64 bit build of ogre)
- Build and copy the .framework to /Library/Frameworks

I hope this helps someone, since I spent a lot of time on figuring this out.

stickymango

01-09-2010 09:54:37

Excellent work and thanks a lot for sharing this information! :D

I don't have access nor ever used a Mac yet so I couldn't provide any support or help on the subject, so your patience and persistence is greatly appreciated!

I shall make this topic sticky and make the appropriate changes in the header file for Mac OS X compilation.

Thanks once again for your help! :)

Crhonos

20-07-2014 18:22:04

Hi, I have been trying to build this for a while now, the src files I have already contain the changes you made. But when I try to compile OgreOggSound I get the following error:


Undefined symbols for architecture i386:
"_ov_clear", referenced from:
OgreOggSound::OgreOggStaticSound::_release() in OgreOggStaticSound.cpp.o
OgreOggSound::OgreOggStreamSound::_release() in OgreOggStreamSound.cpp.o
"_ov_comment", referenced from:
OgreOggSound::OgreOggStaticSound::_openImpl(Ogre::SharedPtr<Ogre::DataStream>&) in OgreOggStaticSound.cpp.o
OgreOggSound::OgreOggStreamSound::_openImpl(Ogre::SharedPtr<Ogre::DataStream>&) in OgreOggStreamSound.cpp.o
"_ov_info", referenced from:
OgreOggSound::OgreOggStaticSound::_openImpl(Ogre::SharedPtr<Ogre::DataStream>&) in OgreOggStaticSound.cpp.o
OgreOggSound::OgreOggStreamSound::_openImpl(Ogre::SharedPtr<Ogre::DataStream>&) in OgreOggStreamSound.cpp.o
"_ov_open_callbacks", referenced from:
OgreOggSound::OgreOggStaticSound::_openImpl(Ogre::SharedPtr<Ogre::DataStream>&) in OgreOggStaticSound.cpp.o
OgreOggSound::OgreOggStreamSound::_openImpl(Ogre::SharedPtr<Ogre::DataStream>&) in OgreOggStreamSound.cpp.o
"_ov_read", referenced from:
OgreOggSound::OgreOggStaticSound::_openImpl(Ogre::SharedPtr<Ogre::DataStream>&) in OgreOggStaticSound.cpp.o
OgreOggSound::OgreOggStreamSound::_stream(unsigned int) in OgreOggStreamSound.cpp.o
"_ov_seekable", referenced from:
OgreOggSound::OgreOggStaticSound::_openImpl(Ogre::SharedPtr<Ogre::DataStream>&) in OgreOggStaticSound.cpp.o
OgreOggSound::OgreOggStreamSound::_openImpl(Ogre::SharedPtr<Ogre::DataStream>&) in OgreOggStreamSound.cpp.o
"_ov_time_seek", referenced from:
OgreOggSound::OgreOggStreamSound::_stream(unsigned int) in OgreOggStreamSound.cpp.o
OgreOggSound::OgreOggStreamSound::_updatePlayPosition() in OgreOggStreamSound.cpp.o
OgreOggSound::OgreOggStreamSound::_stopImpl() in OgreOggStreamSound.cpp.o
"_ov_time_total", referenced from:
OgreOggSound::OgreOggStaticSound::_openImpl(Ogre::SharedPtr<Ogre::DataStream>&) in OgreOggStaticSound.cpp.o
OgreOggSound::OgreOggStreamSound::_openImpl(Ogre::SharedPtr<Ogre::DataStream>&) in OgreOggStreamSound.cpp.o
ld: symbol(s) not found for architecture i386

Any ideas which library provides these symbols?


Edit:
I have been trying to build liboog and libvorbis from the source for i386, but I can't make this work, if someone could make a guide for getting done(or point me to one) I would really appreciate.

Thanks in Advance