I've encountered a problem with the osg/Math header, which a few previous 
emails on this list have alluded to (based on searching the recent archives), 
but which has an interesting explanation.

osg/Math defines the 'f' versions of cos/sin/floor/etc in terms of the double 
versions, on various platforms, including Mac. The implementation is an inline 
function, which casts the input argument, and calls the 'base' version from 
math.h

Unfortunately, LLVM (or the GCC frontend) is smart enough to turn the cast + 
call of the base version back into the floating point version - but the symbol 
look-up then resolves to the osg wrapper - and hence the problem we're seeing. 
Since osg/Math was created, OS-X does define the 'f' versions - but I'm not 
sure which version started doing so - the 10.6 SDK math.h includes the 'f' 
variants, but plain gcc 4.2 wasn't smart enough to turn the cast-to-double + 
call pattern into the float version.

The local workaround is simply to remove the __APPLE__ case around line 48 of 
osg/Math, but really it would be changed to a MAC_OS_X_VERSION_10_z, if someone 
can identify what value 'z' should have. If anyone still has a 10.5 SDK, they 
could check '/usr/include/architecture/i386/math.h' and see if the 'f' variants 
of the math functions are present. 

(What's the minimum version OSG claims to support at this time? 10.5 or still 
holding out with 10.4?)
(Potentially this affects iOS too, though I'm not sure if Apple have enabled 
gcc-llvm for ARM yet, by de default)

James

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to