Failure in Building rmf_robot_sim_gz_classic_plugins (#324)

Posted by @MatteoCarlone:

I followed the instructions from here to install open_rmf by directly installing the rmf_demos:

sudo apt install ros-galactic-rmf-demos-gz

I should have met all the dependecies:

rosdep install --from-paths src --ignore-src --rosdistro galactic -yr
#All required rosdeps installed successfully

When building the workspace colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release I get this error:

Starting >>> rmf_robot_sim_gz_plugins
--- stderr: rmf_building_sim_gz_plugins                                                
/home/matteocarlone/namespc_ws/src/rmf/rmf_simulation/rmf_building_sim_gz_plugins/src/door.cpp:45:8: error: ‘using Doors = class std::unordered_map<std::__cxx11::basic_string<char>, rmf_building_sim_common::DoorCommon::DoorElement>’ is private within this context
   45 |   std::optional<DoorCommon::Doors> get_doors(
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/matteocarlone/namespc_ws/src/rmf/rmf_simulation/rmf_building_sim_gz_plugins/src/door.cpp:14:
/opt/ros/galactic/include/rmf_building_sim_common/door_common.hpp:107:9: note: declared private here
  107 |   using Doors = std::unordered_map<std::string, DoorElement>;
      |         ^~~~~
/home/matteocarlone/namespc_ws/src/rmf/rmf_simulation/rmf_building_sim_gz_plugins/src/door.cpp: In member function ‘std::optional<std::unordered_map<std::__cxx11::basic_string<char>, rmf_building_sim_common::DoorCommon::DoorElement> > rmf_building_sim_gz_plugins::DoorPlugin::get_doors(ignition::gazebo::v6::Model&, const string&, const std::shared_ptr<const sdf::v12::Element>&, ignition::gazebo::v6::EntityComponentManager&)’:
/home/matteocarlone/namespc_ws/src/rmf/rmf_simulation/rmf_building_sim_gz_plugins/src/door.cpp:91:17: error: ‘using Doors = class std::unordered_map<std::__cxx11::basic_string<char>, rmf_building_sim_common::DoorCommon::DoorElement>’ is private within this context
   91 |     DoorCommon::Doors doors;
      |                 ^~~~~
In file included from /home/matteocarlone/namespc_ws/src/rmf/rmf_simulation/rmf_building_sim_gz_plugins/src/door.cpp:14:
/opt/ros/galactic/include/rmf_building_sim_common/door_common.hpp:107:9: note: declared private here
  107 |   using Doors = std::unordered_map<std::string, DoorElement>;
      |         ^~~~~
/home/matteocarlone/namespc_ws/src/rmf/rmf_simulation/rmf_building_sim_gz_plugins/src/door.cpp:110:19: error: ‘struct rmf_building_sim_common::DoorCommon::DoorElement’ is private within this context
  110 |       DoorCommon::DoorElement door_element;
      |                   ^~~~~~~~~~~
In file included from /home/matteocarlone/namespc_ws/src/rmf/rmf_simulation/rmf_building_sim_gz_plugins/src/door.cpp:14:
/opt/ros/galactic/include/rmf_building_sim_common/door_common.hpp:77:10: note: declared private here
   77 |   struct DoorElement
      |          ^~~~~~~~~~~
/home/matteocarlone/namespc_ws/src/rmf/rmf_simulation/rmf_building_sim_gz_plugins/src/door.cpp:113:36: error: ‘struct rmf_building_sim_common::DoorCommon::DoorElement’ is private within this context
  113 |         door_element = DoorCommon::DoorElement{lower_limit, upper_limit, true};
      |                                    ^~~~~~~~~~~
In file included from /home/matteocarlone/namespc_ws/src/rmf/rmf_simulation/rmf_building_sim_gz_plugins/src/door.cpp:14:
/opt/ros/galactic/include/rmf_building_sim_common/door_common.hpp:77:10: note: declared private here
   77 |   struct DoorElement
      |          ^~~~~~~~~~~
/home/matteocarlone/namespc_ws/src/rmf/rmf_simulation/rmf_building_sim_gz_plugins/src/door.cpp:117:36: error: ‘struct rmf_building_sim_common::DoorCommon::DoorElement’ is private within this context
  117 |         door_element = DoorCommon::DoorElement{lower_limit, upper_limit};
      |                                    ^~~~~~~~~~~
In file included from /home/matteocarlone/namespc_ws/src/rmf/rmf_simulation/rmf_building_sim_gz_plugins/src/door.cpp:14:
/opt/ros/galactic/include/rmf_building_sim_common/door_common.hpp:77:10: note: declared private here
   77 |   struct DoorElement
      |          ^~~~~~~~~~~
/home/matteocarlone/namespc_ws/src/rmf/rmf_simulation/rmf_building_sim_gz_plugins/src/door.cpp: In member function ‘virtual void rmf_building_sim_gz_plugins::DoorPlugin::Configure(const Entity&, const std::shared_ptr<const sdf::v12::Element>&, ignition::gazebo::v6::EntityComponentManager&, ignition::gazebo::v6::EventManager&)’:
/home/matteocarlone/namespc_ws/src/rmf/rmf_simulation/rmf_building_sim_gz_plugins/src/door.cpp:165:20: error: no matching function for call to ‘rmf_building_sim_common::DoorCommon::make(std::string&, rclcpp::Node::SharedPtr&, const std::shared_ptr<const sdf::v12::Element>&, std::unordered_map<std::__cxx11::basic_string<char>, rmf_building_sim_common::DoorCommon::DoorElement>&)’
  165 |       doors.value());
      |                    ^
In file included from /home/matteocarlone/namespc_ws/src/rmf/rmf_simulation/rmf_building_sim_gz_plugins/src/door.cpp:14:
/opt/ros/galactic/include/rmf_building_sim_common/door_common.hpp:61:38: note: candidate: ‘template<class SdfPtrT> static std::shared_ptr<rmf_building_sim_common::DoorCommon> rmf_building_sim_common::DoorCommon::make(const string&, rclcpp::Node::SharedPtr, SdfPtrT&)’
   61 |   static std::shared_ptr<DoorCommon> make(
      |                                      ^~~~
/opt/ros/galactic/include/rmf_building_sim_common/door_common.hpp:61:38: note:   template argument deduction/substitution failed:
/home/matteocarlone/namespc_ws/src/rmf/rmf_simulation/rmf_building_sim_gz_plugins/src/door.cpp:165:20: note:   candidate expects 3 arguments, 4 provided
  165 |       doors.value());
      |                    ^
make[2]: *** [CMakeFiles/door.dir/build.make:76: CMakeFiles/door.dir/src/door.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:118: CMakeFiles/door.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Chosen answer

Answer chosen by @MatteoCarlone at 2023-03-20T14:53:26Z.
Answered by @Yadunund:

Hi there, can I clarify what workspace you’re building? It seems like you’re building a workspace with open-rmf source code after installing open-rmf binaries. Mixing binary and source installation is not a good idea as colcon will detect the older binaries and attempt to build other packages against the API from those binaries. You should have seen a warning from colcon when you started building.
If you’d want to build and run from source, first remove the binaries by running
sudo apt purge ros-galactic-rmf-*

Posted by @Yadunund:

Hi there, can I clarify what workspace you’re building? It seems like you’re building a workspace with open-rmf source code after installing open-rmf binaries. Mixing binary and source installation is not a good idea as colcon will detect the older binaries and attempt to build other packages against the API from those binaries. You should have seen a warning from colcon when you started building.
If you’d want to build and run from source, first remove the binaries by running
sudo apt purge ros-galactic-rmf-*


This is the chosen answer.