Yeah, Apple screwed up and broke binary compatibility between 10.4 and
10.5 when using OpenGL and C++. I have notes and binaries coming on
this, but the short story is you can't use 10.4 built frameworks
against the 10.5 SDK or you get the linking problems you see. Either
switch to the 10.4u SDK on Leopard, or use a set of OSG frameworks
built against the 10.5 SDK.

-Eric



On 11/4/07, Berg, Michael <[EMAIL PROTECTED]> wrote:
> I have been developing an OSG application on Linux and recently began
> making it cross-platform with OS X 10.5 (Leopard).
>
> Either I'm not doing something correctly for an OS X compile or there is
> a bug in the OpenSceneGraph-2.2.0.dmg found at
> http://www.openscenegraph.org/files/OpenSceneGraph-2.2.0/OpenSceneGraph-2.2.0.dmg.
>
> I'm using CMake for cross platform builds, and whether I generate a
> Makefile or an Xcode build environment, the compile fails on OS X with
> this message:
> ==========
> Undefined symbols:
>   "osg::StateSet::setMode(unsigned int, unsigned int)", referenced from:
>       _main in main.o
>       _main in main.o
>   "osg::Image::readPixels(int, int, int, int, unsigned int, unsigned
> int)", referenced from:
>       screenshot(osg::Camera const&) in main.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
> ==========
>
>
> The offending snippets of code are:
> ==========
> osg::ref_ptr<osg::Group> root = new osg::Group();
> osg::ref_ptr<osg::StateSet> state = root->getOrCreateStateSet();
> state->setMode(GL_LIGHTING, osg::StateAttribute::ON);
> state->setMode(GL_LIGHT0, osg::StateAttribute::ON);
> ==========
> osg::ref_ptr<osg::Image> image = new osg::Image();
> image->readPixels(static_cast<int>(viewport->x()),
>                   static_cast<int>(viewport->y()),
>                   static_cast<int>(viewport->width()),
>                   static_cast<int>(viewport->height()),
>                   GL_RGBA, GL_UNSIGNED_BYTE);
> ==========
>
> This same code compiles and links without any problem on Linux.
>
> On OS X, options passed to the compiler include:
>     -F/Library/Frameworks \
>     -framework osg -framework osgDB -framework osgGA \
>     -framework osgParticle -framework osgUtil \
>     -framework osgText -framework osgViewer
>
> and I have followed the instructions for installing the OSG frameworks
> into /Library/Frameworks.
>
> If I comment out the code that triggers the linking errors, I can get
> the code to compile, link, and run.
> "otool -L" shows for following for the resulting executable:
> ==========
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
> 111.0.0)
> @executable_path/../Frameworks/osg.framework/Versions/A/osg
> (compatibility version 0.0.0, current version 1.0.0)
> @executable_path/../Frameworks/osgDB.framework/Versions/A/osgDB
> (compatibility version 0.0.0, current version 1.0.0)
> @executable_path/../Frameworks/osgGA.framework/Versions/A/osgGA
> (compatibility version 0.0.0, current version 1.0.0)
> @executable_path/../Frameworks/osgParticle.framework/Versions/A/osgParticle
> (compatibility version 0.0.0, current version 1.0.0)
> @executable_path/../Frameworks/osgUtil.framework/Versions/A/osgUtil
> (compatibility version 0.0.0, current version 1.0.0)
> @executable_path/../Frameworks/osgText.framework/Versions/A/osgText
> (compatibility version 0.0.0, current version 1.0.0)
> @executable_path/../Frameworks/osgViewer.framework/Versions/A/osgViewer
> (compatibility version 0.0.0, current version 1.0.0)
> /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version
> 7.4.0)
> /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version
> 1.0.0)
> ==========
>
> So executable is linked against the "osg" framework, and the application
> runs successfully (with the features that I commented out to get it to
> build disabled of course).
>
> Any ideas?  Am I doing something wrong?  Or did osg::StateSet::setMode()
> and osg::Image::readPixels() not make it into the OS X .dmg file (or not
> in a form that can be linked against)?
>
> - Michael Berg
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to