[osg-submissions] Solaris build fixes

Colin McDonald cjmcdonald at qinetiq.com
Tue Jan 8 07:15:22 PST 2008


Hi Robert,

Here are fixes for some SVN build problems on Solaris:

include/osgDB/DatabasePager wouldn't compile with the default Solaris
C++ library, because unfortunately that library doesn't contain the
standard form of std::count_if.  It includes a non-standard form,
apparently for binary backwards-compatability.  So I have modified
DatabasePager to avoid use of count_if.  This is a bit clearer anyway,
and is possibly slightly more efficient as the iterations can be
short-circuited as soon as an uncompiled graphics context is found.

src/osg/Geometry.cpp and src/osgUtil/Tessellator.cpp both contained
functions with the name _computeNumberOfPrimitives, resulting in a
duplicate symbol error on link.  I have made them static.

src/osgPlugins/Inventor/ConvertToInventor.cpp included template
declarations for static functions, which the Solaris compiler doesn't
accept.  The compiler documentation claims that "When looking up
template names, the C++ standard says that only names with external
linkage are found", and that "compilers which allow names with internal
static linkage to be found, do so as an extension to the standard, or as
a bug".  There doesn't appear to be any other usage of static template
functions in osg, so I have removed the static declarations, prefixing
some of the names to reduce the chance of a name clash.

Doing a static build of the osg libraries and osgviewer, the windowing
system registration wasn't working at all, even with the
USE_GRAPHICSWINDOW() declaration from osgstaticviewer.  After much
investigation this turned out to be a problem with use of the static
ref_ptr to hold the WindowingSystemInterface in
src/osg/GraphicsContext.cpp.  The order of invocation of the static
ref_ptr constructor is undefined, and on Solaris it was happening around
about when the program main() was invoked, after the
USE_GRAPHICSWINDOW() registration.  So the reference created to a valid
WindowingSystemInterface was lost.  Perhaps this could be a potential
problem with static builds on other platforms as well.  Wrapping the
static ref_ptr in a function controls the order in which the constructor
is executed.  This is similar to the Registry::instance() ref_ptr, which
has always worked OK.

Using environment variable FREETYPE_DIR to locate Freetype was not
working, due to a missing directive in CMakeModules/FindFreeType.cmake.

Regards

Colin McDonald

-------------- next part --------------
A non-text attachment was scrubbed...
Name: SolarisBuild.zip
Type: application/zip
Size: 51801 bytes
Desc: not available
Url : http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20080108/f9dc7345/attachment-0001.zip 


More information about the osg-submissions mailing list