Building 1.8 from on MacOSX - Cg problems

Problems building or running the engine, queries about how to use features etc.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Building 1.8 from on MacOSX - Cg problems

Post by d000hg »

I am getting errors that <Cg/cg.h> doesn't exist when CgProgramManager is built. But I do have the Cg toolkit installed and things appear to be correct:

On disk: ls /Library/Frameworks/Cg.framework/Headers => cg.h cgGL.h
CMake automatically detected: Cg_INCLUDE_DIR = /Library/Frameworks/Cg.framework/Headers
In XCode, Plugin_CgProgramManager Header Search Paths: /usr/local/ogre/ogre1.8/src/OgreMain/include /Library/Frameworks/Cg.framework/Headers

And yet:

/usr/local/ogre/ogre1.8/src/PlugIns/CgProgramManager/include/OgreCgPrerequisites.h:32:19: error: Cg/cg.h: No such file or directory

I don't get what's wrong, even XCode seems to think it knows the path! This is a clean build using default CMake for 1.8.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Building 1.8 from on MacOSX - Cg problems

Post by d000hg »

bump.
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Building 1.8 from on MacOSX - Cg problems

Post by masterfalcon »

How are you configuring the project with CMake? It works fine for me.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Building 1.8 from on MacOSX - Cg problems

Post by d000hg »

I finally came back to this and I can at least see why it's not working.

OgreCgPrerequisites.h #includes <Cg/cg.h> but the Plugin_CgProgramManager project has a header search path /Library/Frameworks/Cg.framework/Headers, which is where Cg is installed. So the path to cg.h on my Mac is actually /Library/Frameworks/Cg.framework/Headers/cg.h, there is no 'Cg' dir.

To those of you running on Mac, I'd appreciate knowing how your systems differ from mine or any extra step you had to do.
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Building 1.8 from on MacOSX - Cg problems

Post by masterfalcon »

Actually, Cg/cg.h should work as long as the framework search path is set. See Cocoa/Cocoa.h, AppKit/AppKit.h, etc.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Building 1.8 from on MacOSX - Cg problems

Post by d000hg »

I was looking at my filesystem and it seemed a bit odd what I saw:
Screen shot 2012-05-09 at 21.19.31.png
The only stuff in the Cg.framework dir seems to be the headers... I re-installed Cg3.1 (Feb2012) on my Snow Leopard Mac and this stays the same. Shouldn't there be some binaries somewhere - how does it comare to yours?
You do not have the required permissions to view the files attached to this post.
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Building 1.8 from on MacOSX - Cg problems

Post by masterfalcon »

That's correct. The item named Cg is the binary. This is how frameworks are laid out on OS X. Apple's docs on bundles can give you more in depth info.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Building 1.8 from on MacOSX - Cg problems

Post by d000hg »

OK so it is installed right, good.

I tested changing <Cg/cg.h> => <cg.h> and now it compiles OK. But on linking I get "Framework not found Cg". It's almost like it doesn't realise Cg is a framework and is treating it as a regular dir. Does that even make sense?
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Building 1.8 from on MacOSX - Cg problems

Post by masterfalcon »

yeah, you'll need to add /Library/Frameworks to your framework search paths. It should pick it up.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Building 1.8 from on MacOSX - Cg problems

Post by d000hg »

Oh I have that already - CMake added that. As I say, it seems somehow like it is not being recognised AS a framework but I don't know if frameworks are special at all.

I assume you're running XCode 4 with Ogre 1.8? Has anyone tried 1.8 with 3.2.x?

Anyway I'll do a full clean CMake build just to be safe, but I wonder if this is it: http://stackoverflow.com/questions/5293 ... frameworks
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Building 1.8 from on MacOSX - Cg problems

Post by d000hg »

Clean build yields same issues. Here are my settings fresh from CMake:
Framework Search Paths: /Library/Frameworks /Applications

Header Search Paths: /usr/local/ogre/ogre1.8/src/OgreMain/include /usr/local/ogre/ogre1.8/build/mac/include /usr/local/ogre/ogre1.8/src/OgreMain/include/OSX /usr/local/ogre/ogre1.8/Dependencies/include /usr/local/ogre/ogre1.8/Dependencies/include/OIS /Library/Frameworks/Cg.framework/Headers /System/Library/Frameworks/Carbon.framework/Headers /System/Library/Frameworks/Cocoa.framework/Headers /System/Library/Frameworks/CoreVideo.framework/Headers /usr/local/ogre/ogre1.8/src /usr/local/ogre/ogre1.8/src/PlugIns/CgProgramManager/include

Other Linker Flags: -dynamiclib -Wl,-headerpad_max_install_names /usr/local/ogre/ogre1.8/build/mac/lib/Debug/Ogre.framework/Versions/1.8.0/Ogre -framework Cg /usr/local/ogre/ogre1.8/Dependencies/lib/debug/libfreetype.a -framework Carbon -framework Cocoa /opt/local/lib/libboost_thread-mt.a /opt/local/lib/libboost_date_time-mt.a /usr/local/ogre/ogre1.8/Dependencies/lib/debug/libfreeimage.a /usr/local/ogre/ogre1.8/Dependencies/lib/debug/libzzip.a /usr/lib/libz.dylib
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Building 1.8 from on MacOSX - Cg problems

Post by d000hg »

Well, after a lot of messing about I seem to have found the cause - but not the underlying reason.

I am using a MacBook with clean install of OSX10.6, and the CMake-generated Ogre project was set to use 10.6 (SDK_ROOT). The same when I created a brand new test C++ console project in XCode.
BUT, when I changed SDK to 10.5, suddenly it works!

I checked on disk and both SDKs have a link to /Library/Frameworks:
Screen shot 2012-05-15 at 12.15.12.png
So I don't know what the issue is - if I upgraded from 10.5 -> 10.6 or something it would make some sense but everything looks perfect. Any ideas... I suppose I can just build for 10.5 but would like to understand what's happening.
You do not have the required permissions to view the files attached to this post.