Compile error when Building Openscenegraph 3.4
A fresh build of Open Scene Graph version 3.4 ended with a compile error on Ubuntu 22.10 because
bool ObjectCache::ClassComp::operator() was not declared const.
The declaration in openscenegraph/include/osgDB/ObjectCache and the definition in openscenegraph/src/osgDB/ObjectCache.cpp need a minor change on the version 3.4 branch.
in both files, bool ObjectCache::ClassComp::operator() (const ObjectCache::FileNameOptionsPair& lhs, const ObjectCache::FileNameOptionsPair& rhs) changes to: bool ObjectCache::ClassComp::operator() (const ObjectCache::FileNameOptionsPair& lhs, const ObjectCache::FileNameOptionsPair& rhs) const
The error:
/work/fg/stable/openscenegraph/src/osgDB/ObjectCache.cpp:72:68: required from here
/usr/include/c++/12/bits/stl_tree.h:770:15: error: static assertion failed: comparison object must be invocable as const
770 | is_invocable_v<const _Compare&, const _Key&, const _Key&>,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/12/bits/stl_tree.h:770:15: note: ‘std::is_invocable_v<const osgDB::ObjectCache::ClassComp&, const std::pair<std::__cxx11::basic_string<char, std::char_traits
Same issue, any updates?
You are welcome to fix and submit a fix to this project. I know Robert has moved onto other things but I'm sure whomever is managing this repository would take it.
OpenSceneGraph-3.4.x is pretty ancient. Might I suggest just use OpenSceneGraph-3.6.x?
Are you sure you are using the 3.4.X branch? My copy of the 3.4.1 branch doesn't have ClassComp doesn't exist but does in the copy of 3.6.5 I have on my system. The definition of struct ClassComp in osgDB/ObjectCache is:
struct ClassComp { bool operator() (const ObjectCache::FileNameOptionsPair& lhs, const ObjectCache::FileNameOptionsPair& rhs) const; };
so it has the desired change.