rpg_ig_active_reconstruction
rpg_ig_active_reconstruction copied to clipboard
Adapt to gcc 4.9 and 5.0
GCC became more strict on a few things with 4.9 that now create errors in compilation...resolve these.
The issue appears to stem from nested templates, and in both 4.9 and 5.0 it causes an internal compiler error, resulting in a segmentation fault for gcc.
4.9
In file included from /home/jeffdelmerico/catkin_ws/src/rpg_ig_active_reconstruction/ig_active_reconstruction_octomap/include/ig_active_reconstruction_octomap/octomap_world_representation.hpp:122:0, from /home/jeffdelmerico/catkin_ws/src/rpg_ig_active_reconstruction/ig_active_reconstruction_octomap/include/ig_active_reconstruction_octomap/octomap_ig_tree_world_representation.hpp:20, from /home/jeffdelmerico/catkin_ws/src/rpg_ig_active_reconstruction/ig_active_reconstruction_octomap/src/ros_nodes/octomap_world_representation.cpp:22: /home/jeffdelmerico/catkin_ws/src/rpg_ig_active_reconstruction/ig_active_reconstruction_octomap/include/../src/code_base/octomap_world_representation.inl: In instantiation of ‘boost::shared_ptr<typename INPUT_OBJ_TYPE<TREE_TYPE>::Type> ig_active_reconstruction::world_representation::octomap::WorldRepresentation<TREE_TYPE>::getLinkedObj(typename INPUT_OBJ_TYPE<TREE_TYPE>::Type::Config) [with INPUT_OBJ_TYPE = ig_active_reconstruction::world_representation::octomap::StdPclInputPointXYZ; TREE_TYPE = ig_active_reconstruction::world_representation::octomap::IgTree; typename INPUT_OBJ_TYPE<TREE_TYPE>::Type = ig_active_reconstruction::world_representation::octomap::StdPclInput<ig_active_reconstruction::world_representation::octomap::IgTree, pcl::PointCloudpcl::PointXYZ >; typename INPUT_OBJ_TYPE<TREE_TYPE>::Type::Config = ig_active_reconstruction::world_representation::octomap::StdPclInput<ig_active_reconstruction::world_representation::octomap::IgTree, pcl::PointCloudpcl::PointXYZ >::Config]’: /home/jeffdelmerico/catkin_ws/src/rpg_ig_active_reconstruction/ig_active_reconstruction_octomap/src/ros_nodes/octomap_world_representation.cpp:123:126: required from here /home/jeffdelmerico/catkin_ws/src/rpg_ig_active_reconstruction/ig_active_reconstruction_octomap/include/../src/code_base/octomap_world_representation.inl:19:16: internal compiler error: Segmentation fault #define CSCOPE WorldRepresentation<TREE_TYPE> ^ /home/jeffdelmerico/catkin_ws/src/rpg_ig_active_reconstruction/ig_active_reconstruction_octomap/include/../src/code_base/octomap_world_representation.inl:84:65: note: in expansion of macro ‘CSCOPE’ boost::shared_ptr< typename INPUT_OBJ_TYPE<TREE_TYPE>::Type > CSCOPE::getLinkedObj( typename INPUT_OBJ_TYPE<TREE_TYPE>::Type::Config config ) ^
5.0
In file included from /home/jeffdelmerico/catkin_ws/src/rpg_ig_active_reconstruction/ig_active_reconstruction_octomap/include/ig_active_reconstruction_octomap/octomap_ig_calculator.hpp:107:0, from /home/jeffdelmerico/catkin_ws/src/rpg_ig_active_reconstruction/ig_active_reconstruction_octomap/include/ig_active_reconstruction_octomap/octomap_basic_ray_ig_calculator.hpp:21, from /home/jeffdelmerico/catkin_ws/src/rpg_ig_active_reconstruction/ig_active_reconstruction_octomap/src/ros_nodes/octomap_world_representation.cpp:25: /home/jeffdelmerico/catkin_ws/src/rpg_ig_active_reconstruction/ig_active_reconstruction_octomap/include/../src/code_base/octomap_ig_calculator.inl: In instantiation of ‘boost::shared_ptr<ig_active_reconstruction::world_representation::octomap::InformationGain<TREE_TYPE> > ig_active_reconstruction::world_representation::octomap::IgCalculator<TREE_TYPE>::makeShared(typename IG_METRIC_TYPE<TREE_TYPE>::Utils::Config) [with IG_METRIC_TYPE = ig_active_reconstruction::world_representation::octomap::AverageEntropyIg; TREE_TYPE = ig_active_reconstruction::world_representation::octomap::IgTree; typename IG_METRIC_TYPE<TREE_TYPE>::Utils::Config = ig_active_reconstruction::world_representation::octomap::InformationGain<ig_active_reconstruction::world_representation::octomap::IgTree>::Utils::Config]’: /home/jeffdelmerico/catkin_ws/src/rpg_ig_active_reconstruction/ig_active_reconstruction_octomap/src/ros_nodes/octomap_world_representation.cpp:158:1: required from here /home/jeffdelmerico/catkin_ws/src/rpg_ig_active_reconstruction/ig_active_reconstruction_octomap/include/../src/code_base/octomap_ig_calculator.inl:19:16: internal compiler error: Segmentation fault #define CSCOPE IgCalculator<TREE_TYPE> ^ /home/jeffdelmerico/catkin_ws/src/rpg_ig_active_reconstruction/ig_active_reconstruction_octomap/include/../src/code_base/octomap_ig_calculator.inl:61:51: note: in expansion of macro ‘CSCOPE’ boost::shared_ptr< InformationGain<TREE_TYPE> > CSCOPE::makeShared(typename IG_METRIC_TYPE<TREE_TYPE>::Utils::Config utils) ^
But as is noted in the CMakeLists.txt for ig_active_reconstruction_octomap, the C++11 versions don't play nicely with the boost shared pointers from ROS, so I don't think the variadic template version that you (@islers) wrote is an option either.
As far as I can tell from the GCC Bugzilla, this is an open bug in the compiler. Do you think it would be possible to un-nest these templates even if the code becomes a bit less clean and efficient?
One other tiny issue that I did resolve is statically casting a stream return value to bool, since implicit casting is no longer supported.
Pushed minor fix to #4.