Setup & Building on Mac OS X

Problems building or running the engine, queries about how to use features etc.
Smithers
Gnoblar
Posts: 6
Joined: Mon Jul 05, 2004 10:07 pm
Location: Banbury, England

Setup & Building on Mac OS X

Post by Smithers »

After spending quite a while going through the forum topics finding out how to get the Ogre framework and samples to build on the Mac I'm hoping the following will help others to save some time.

I just followed these steps on my PowerBook (which has never had any Ogre related stuff on it) and the Ogre framework and samples built and ran fine.

Most of this is scattered throughout various forum topics but I thought it might be useful to have it all in one place. Many thanks to all the people who have posted answers to the topic of building on the Mac in the past.


1) Download the latest Ogre source by following the instructions on the CVS Access page of the main Ogre site. Alternatively you can download the latest stable release from the Downloads page.

2) Go to the Downloads -> Source Releases -> Extras page on the Ogre site and click on the 'Mac OSX Frameworks' link to download 'Frameworks.zip'. Extract the 'Frameworks' folder from the zip file and put it in the OgreNew/Mac directory.

3) Open the new 'Frameworks' folder and delete the SDL.framework. This version is out of date and has problems with the mouse in full screen mode.

4) Download the latest SDL distribution from:

http://www.libsdl.org/download-1.2.php

The file you need is SDL-devel-1.2.7.pkg.tar.gz

Extract the package from the archive and install it. By default it will install in ~/Library/Frameworks. Move it from there into the OgreNew/Mac/Frameworks directory.

5) Download the NVidia Cg Toolkit from:

http://www.developer.nvidia.com/object/cg_toolkit.html

Click on the 'Cg Compiler (.pax)' link, under 'Downloads for Mac OS X'

Extract the package from the archive with Stuffit Expander (you'll probably need to right click on it and use "Open With"). Install the resulting NVCg-1.2.1b1.pkg

6) Download the DevIL framework from:

http://openil.sourceforge.net/download.php

Click on the 'DevIL 1.6.7 OS X Package' link and install the package.

This will place the IL.framework into Library/Frameworks along with libtiff.framework, libjpeg.framework, libexslt.framework, libxml.framework, Icms.framework, libmng.framework and libpng.framework.

Copy the libjpeg, Icms, libmng, libpng and libtiff frameworks into IL.framework/Frameworks (you'll need to make the Frameworks directory).


That's it, you should now be able to open the Xcode project for the Ogre.framework and build it. Once that's done the samples should build and run Ok.


If you want to build Deployment versions then you may need to read the following forum topic:

http://www.ogre3d.org/phpBB2/viewtopic.php?t=4938

As far as I can tell this issue has not been resolved yet, but making the change described in the topic allows the Deployment builds to run.

Hope this helps!
User avatar
temas
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 390
Joined: Sun Oct 06, 2002 11:19 pm
Location: The Woodlands, TX

Post by temas »

Nice write up, sounds right on. I'll look at copying it into a README. The thread you linked to I replied in. It has been resolved and in CVS for a while.
Smithers
Gnoblar
Posts: 6
Joined: Mon Jul 05, 2004 10:07 pm
Location: Banbury, England

Post by Smithers »

temas wrote:Nice write up, sounds right on. I'll look at copying it into a README.

Thanks, that would be great.
temas wrote: The thread you linked to I replied in. It has been resolved and in CVS for a while.
Hmm, I was still getting the crash mentioned in that thread with the latest CVS version. I'll double check it asap.
User avatar
cTh
Halfling
Posts: 81
Joined: Wed Dec 11, 2002 10:47 am
Location: Moscow/Russia

Post by cTh »

temas : I still get the 'bus error' with the latest CVS :(, the new String stuff did not do the trick...

HtH, cTh
marcoc
Gnoblar
Posts: 9
Joined: Fri Jan 02, 2004 10:18 am
Location: Milano, Italy

Post by marcoc »

Me too. But changing

Code: Select all

String cmd = splitCmd.size() >= 2 ? splitCmd[1] : StringUtil::BLANK;
into this:

Code: Select all

String cmd;
if (splitCmd.size() >= 2)
    cmd = splitCmd[1];
else
    cmd = StringUtil::BLANK;
in invokeParser (OgreMaterialSerializer.cpp), everything works well...

:?: :?:
User avatar
temas
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 390
Joined: Sun Oct 06, 2002 11:19 pm
Location: The Woodlands, TX

Post by temas »

You guys suck :wink: I'm starting a full rebuild of a lot of my platform tonight, so I'll try that out tomorrow.
Richard Kain
Gnoblar
Posts: 1
Joined: Thu Aug 19, 2004 5:47 pm

Mac OS X build

Post by Richard Kain »

I got the following error while trying to build my Ogre.framework

Linking /ogrenew/Mac/XCode/OgreFramework/build/plugin_OctreeSceneManager.bundle/Contents/MacOS/Plugin_OctreeSceneManager (1 error)

Error: Undefined symbols:
Smithers
Gnoblar
Posts: 6
Joined: Mon Jul 05, 2004 10:07 pm
Location: Banbury, England

Post by Smithers »

Richard : What were the symbols?

temas : Did you find a solution to the string problem? I'm using marcoc's fix at the moment so no great rush...just interested to hear if you've found anything. Thanks.
karate.dog
Gnoblar
Posts: 1
Joined: Mon Sep 13, 2004 9:23 am
Location: London

Post by karate.dog »

I have just been through a newbie Ogre on OSX install. This thread was the most helpful (thanks Smithers!) - should definitely try to update the readme with this info!

A couple of additional points:

1) There are a couple of source files missing in the project file (OgreTerrainSceneManager.cpp/.h). You need to add these as described in this thread:
http://www.ogre3d.org/phpBB2/viewtopic.php?t=4584

When adding the files, ensure that you check the option to also add them to the Target (otherwise you get the "Undefined symbols" link error Richard mentions in this thread).

2) The link to the Cg download in step [5] is now wrong. Ogre currently does not work with the latest Cg release. If you run it with the new release the demos fail to initialize with errors:

Code: Select all

Function: CgProgram::loadFromSource 
Description: Unable to compile Cg program Ogre/HardwareSkinningOneWeight: CG ERROR : The compile returned an error. 


See thread:
http://www.ogre3d.org/phpBB2/viewtopic.php?t=5827

You need to download the 1.2 release from:
http://developer.nvidia.com/object/cg_toolkit_1_2.html

3) Even if you have an ATI video card, you still need the nVidia Cg download (hey, it surprised me!) as Ogre uses the API. I presume that Cg then programs the ATI driver using the OpenGL shader interface.

Now works a treat :-) Am looking forward to experimenting...!
ahausknecht
Gnoblar
Posts: 1
Joined: Sun Nov 21, 2004 3:59 am

Building Orge 0.15 under Mac OS 10.3.6

Post by ahausknecht »

Hi,

I have attempted to build Orge and the Samples on a PowerPC G5 under Mac OS 10.3.6 and have had many problems.

-After many attempts with the help of the message posted to the
Help Forum by Smithers (July 05, 2004) and by making changes
in the provided XCode project, I was finally was able to build Orge
framework but with many warning messages.

-So far I have only been able to build the sample Bezier application.
However, it crashes and the crash log shows that a memory
access violation occurred!

So now I wonder if anyone has successfully build Orge and the
Samples on PowerPC G5 under Mac OS 10.3.6?

If so, what versions of the CG, DevIL, and SDL frameworks should be used? NVCg-1.2.1b1? DevIL 1.6.7? SDL-devel-1.2.7?

Note: I also used CVS to update to the latest version with the same
problems!

Thanks in advance,

ahausknecht
SigfriedMcWild
Halfling
Posts: 62
Joined: Wed Mar 03, 2004 3:12 am
Location: just a figment of your imagination

Post by SigfriedMcWild »

I've followed all the instructions but halfway through builing ogremain I get this error:

OgreFramework:0: Undefined symbols: ___setonlyClocaleconv referenced from CoreFoundation expected to be defined in libSystem

Disturbingly enough CoreFoundation.h is a osX system header

I'm running 10.3.6
User avatar
temas
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 390
Joined: Sun Oct 06, 2002 11:19 pm
Location: The Woodlands, TX

Post by temas »

That's a very fubar error message. I'd suggest a clean rebuild.
Will Thimbleby
Halfling
Posts: 60
Joined: Mon Dec 13, 2004 10:41 pm

Post by Will Thimbleby »

I too have been trying to compile without success.

The stable version 0.15.1 compiles the framework fine (with the addition of CoreFoundation.framework). The samples will then build but complain about a missing framework; when I add this in as a Copy Files build phase they just crash when loading the dynamic lib. I tried CVS but it seems to be in a transition state, missing several files, at the moment.

I tried compiling the framework as Deployment but this has the same problems. Strange unknown crashes when loading the framework.

The closest I got to a sensible error message was:
ZeroLink: unknown symbol '__ZN4Ogre13MemoryManager8setOwnerEPKcjS2_'

All the other errors were "unknown". Any help would be appreciated --thanks
User avatar
temas
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 390
Joined: Sun Oct 06, 2002 11:19 pm
Location: The Woodlands, TX

Post by temas »

any memory manager errors like that are due to a mismatch of debug and deployment based on the DEBUG flag.
Will Thimbleby
Halfling
Posts: 60
Joined: Mon Dec 13, 2004 10:41 pm

Post by Will Thimbleby »

Ok, Cheers I've got it all working now. -- One last question, how can I compile the XMLConverter without installing the libraries again (as non-frameworks) and compiling with make. thanks --Will
User avatar
temas
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 390
Joined: Sun Oct 06, 2002 11:19 pm
Location: The Woodlands, TX

Post by temas »

You wouldn't, you'll want to make a Xcode project, otherwise you're in for quite a bit of Makefile hackery to switch it to frameworks.
Will Thimbleby
Halfling
Posts: 60
Joined: Mon Dec 13, 2004 10:41 pm

Post by Will Thimbleby »

Ok, that was almost painless. If anyone wants the XCode project let me know. I had to make one change, I had to undef main in the XMLConverter main.cpp because libpng had a main function. --thanks
User avatar
rti
Gnoblar
Posts: 15
Joined: Mon Oct 25, 2004 1:42 pm
Location: Berlin, Germany

Post by rti »

hi.
I had to undef main in the XMLConverter main.cpp because libpng had a main function.
can u still run xml converter if u undef its main function? i think i dont really understand what u did.

but the i had similar problems when compiling the ogreode demos (or any other ogreode app) - as i described here: Thread: MacOS X - XCode - Ogre and Ode - Problems

is this the same problem with libpng?

thanks, rti
Will Thimbleby
Halfling
Posts: 60
Joined: Mon Dec 13, 2004 10:41 pm

Post by Will Thimbleby »

It is exactly the same problem. libpng has a main function that over-rides the one you provide, so you end up running a libpng test. Use this code to undef the main in libpng, just before your main function:

Code: Select all

#ifdef main
#  undef main
#endif
User avatar
temas
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 390
Joined: Sun Oct 06, 2002 11:19 pm
Location: The Woodlands, TX

Post by temas »

Something is not linked properly if you're getting that error still.
Will Thimbleby
Halfling
Posts: 60
Joined: Mon Dec 13, 2004 10:41 pm

Post by Will Thimbleby »

Any ideas how can I compile the Ogre framework statically linking to the freetype2 lib? So that users don't need X11 installed on their computers before being able to run my apps using Ogre. --cheers

... and the DevIL frameworks ... and everything I'd need to do to make an app immediately runnable on anyone's computer.
User avatar
temas
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 390
Joined: Sun Oct 06, 2002 11:19 pm
Location: The Woodlands, TX

Post by temas »

link to libfreetype.a instead of the dylib?
User avatar
rti
Gnoblar
Posts: 15
Joined: Mon Oct 25, 2004 1:42 pm
Location: Berlin, Germany

Post by rti »

hi.

undefining the main function of libpng worked kinda fine. i dont get that pngtest thing anymore.

but now i'm running into a new problem:
sdl on macosx needs to remap the applications main function to its own sdl_main. this is working well in the samples provided with ogre. but just because they dont need the libpng.framework and dont get in trouble with its main function.

so if i #undef main right before my main implementation in my ogre application it compiles and links fine. but if i try to run i get the following errors:

Code: Select all

...
Zip Archive codec for ../../../../Samples/Media/packs/skybox.zip created.
2005-01-06 10:08:55.285 MyTestDemo[996] *** _NSAutoreleaseNoPool(): Object 0x112c640 of class NSCFString autoreleased with no pool in place - just leaking
...
_NSAutoreleaseNoPool(): Object 0x114a0e0 of class NSException autoreleased with no pool in place - just leaking
2005-01-06 10:08:55.828 MyTestDemo[996] *** Uncaught exception: <NSInternalInconsistencyException> Error (1002) creating CGSWindow

Executable “MyTestDemo” has exited due to signal 5 (SIGTRAP).
now i'm really in trouble:
if i do nothing libpng.framework overwrites my main function, and if i prevent that, the sdl_main link does not work anymore.

please give me a hint
--
thanks in advance, rti
User avatar
Project5
Goblin
Posts: 245
Joined: Mon Nov 22, 2004 11:56 pm
Location: New York, NY, USA

Compile Error

Post by Project5 »

So I followed all of smithers' directions, and every time I try to complete a project it gives me an error of:

Code: Select all

can't locate file for: -ldylib1.o
And I don't know enough about xcode to get anything more verbose. Does anyone know what this means?

I'm compiling OgreFramework.xcode, and get this error on just about every target.

--Ben
SteveFrazier
Kobold
Posts: 29
Joined: Sun Sep 05, 2004 10:44 pm
Location: Rochester Hills, MI

Post by SteveFrazier »

The OgreFramework directory is obsolete and is no longer updated. Use the Ogre directory to build the framework with. That contains the native XCode project instead of the ProjectBuilder converted project. It also has the advantage smaller/faster builds.

Hopefully, OgreFramework will be removed before the 1.0 release.

BTW, the instructions above are out of date. I believe the README_MacOSX.txt in the distribution contains the most current build procedure.