ros2 / ros1_bridge

ROS 2 package that provides bidirectional communication between ROS 1 and ROS 2
Apache License 2.0
425 stars 275 forks source link

ros1_bridge fails to build #385

Closed Anouar35 closed 1 year ago

Anouar35 commented 1 year ago

Bug report

Required Info:

Steps to reproduce issue

1- Clone all workspaces from : here 2- Clone this to bridge_ws sources 3- Build ros1_ws and ros2_ws using respectively catkin_make and colcon build 4- Issue the following commands before building the ros1_bridge, by the same order:

source /opt/ros/noetic/setup.bash
source /opt/ros/foxy/setup.bash 

# source the ROS workspaces
source <ros1_ws_dir>/devel/setup.bash
source <ros2_ws_dir>/install/setup.bash

5 - Build the ros1_bridge using colcon build --symlink-install --packages-select ros1_bridge --cmake-force-configure

Expected behavior

It is expected that the ros1_bridge builds successfully.

Actual behavior

Output from the console:

Starting >>> ros1_bridge
--- stderr: ros1_bridge                              
In file included from /home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/build/ros1_bridge/generated/custom_msg_ros2_factories.hpp:6,
                 from /home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/build/ros1_bridge/generated/custom_msg_ros2__msg__CustomMessage__factories.cpp:3:
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:30: error: ‘SharedLibrary’ is not a member of ‘rcpputils’
  358 |   std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
      |                              ^~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:30: error: ‘SharedLibrary’ is not a member of ‘rcpputils’
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:43: error: template argument 1 is invalid
  358 |   std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
      |                                           ^
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp: In constructor ‘ros1_bridge::Factory<ROS1_T, ROS2_T>::Factory(const string&, const string&)’:
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:46:23: error: ‘get_typesupport_library’ is not a member of ‘rclcpp’
   46 |     ts_lib_ = rclcpp::get_typesupport_library(ros2_type_name, "rosidl_typesupport_cpp");
      |                       ^~~~~~~~~~~~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:48:31: error: ‘get_typesupport_handle’ is not a member of ‘rclcpp’
   48 |       type_support_ = rclcpp::get_typesupport_handle(
      |                               ^~~~~~~~~~~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:50:10: error: invalid type argument of unary ‘*’ (have ‘int’)
   50 |         *ts_lib_);
      |          ^~~~~~~
In file included from /home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/build/ros1_bridge/generated/action_msgs_factories.hpp:6,
                 from /home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/build/ros1_bridge/generated/action_msgs_factories.cpp:3:
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:30: error: ‘SharedLibrary’ is not a member of ‘rcpputils’
  358 |   std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
      |                              ^~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:30: error: ‘SharedLibrary’ is not a member of ‘rcpputils’
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:43: error: template argument 1 is invalid
  358 |   std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
      |                                           ^
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp: In constructor ‘ros1_bridge::Factory<ROS1_T, ROS2_T>::Factory(const string&, const string&)’:
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:46:23: error: ‘get_typesupport_library’ is not a member of ‘rclcpp’
   46 |     ts_lib_ = rclcpp::get_typesupport_library(ros2_type_name, "rosidl_typesupport_cpp");
      |                       ^~~~~~~~~~~~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:48:31: error: ‘get_typesupport_handle’ is not a member of ‘rclcpp’
   48 |       type_support_ = rclcpp::get_typesupport_handle(
      |                               ^~~~~~~~~~~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:50:10: error: invalid type argument of unary ‘*’ (have ‘int’)
   50 |         *ts_lib_);
      |          ^~~~~~~
In file included from /home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/builtin_interfaces_factories.hpp:29,
                 from /home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/src/builtin_interfaces_factories.cpp:21:
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:30: error: ‘SharedLibrary’ is not a member of ‘rcpputils’
  358 |   std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
      |                              ^~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:30: error: ‘SharedLibrary’ is not a member of ‘rcpputils’
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:43: error: template argument 1 is invalid
  358 |   std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
      |                                           ^
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp: In constructor ‘ros1_bridge::Factory<ROS1_T, ROS2_T>::Factory(const string&, const string&)’:
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:46:23: error: ‘get_typesupport_library’ is not a member of ‘rclcpp’
   46 |     ts_lib_ = rclcpp::get_typesupport_library(ros2_type_name, "rosidl_typesupport_cpp");
      |                       ^~~~~~~~~~~~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:48:31: error: ‘get_typesupport_handle’ is not a member of ‘rclcpp’
   48 |       type_support_ = rclcpp::get_typesupport_handle(
      |                               ^~~~~~~~~~~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:50:10: error: invalid type argument of unary ‘*’ (have ‘int’)
   50 |         *ts_lib_);
      |          ^~~~~~~
In file included from /home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/build/ros1_bridge/generated/custom_msg_ros2_factories.hpp:6,
                 from /home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/build/ros1_bridge/generated/custom_msg_ros2_factories.cpp:3:
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:30: error: ‘SharedLibrary’ is not a member of ‘rcpputils’
  358 |   std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
      |                              ^~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:30: error: ‘SharedLibrary’ is not a member of ‘rcpputils’
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:43: error: template argument 1 is invalid
  358 |   std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
      |                                           ^
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp: In constructor ‘ros1_bridge::Factory<ROS1_T, ROS2_T>::Factory(const string&, const string&)’:
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:46:23: error: ‘get_typesupport_library’ is not a member of ‘rclcpp’
   46 |     ts_lib_ = rclcpp::get_typesupport_library(ros2_type_name, "rosidl_typesupport_cpp");
      |                       ^~~~~~~~~~~~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:48:31: error: ‘get_typesupport_handle’ is not a member of ‘rclcpp’
   48 |       type_support_ = rclcpp::get_typesupport_handle(
      |                               ^~~~~~~~~~~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:50:10: error: invalid type argument of unary ‘*’ (have ‘int’)
   50 |         *ts_lib_);
      |          ^~~~~~~
In file included from /home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/build/ros1_bridge/generated/get_factory.cpp:3:
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:30: error: ‘SharedLibrary’ is not a member of ‘rcpputils’
  358 |   std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
      |                              ^~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:30: error: ‘SharedLibrary’ is not a member of ‘rcpputils’
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:43: error: template argument 1 is invalid
  358 |   std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
      |                                           ^
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp: In constructor ‘ros1_bridge::Factory<ROS1_T, ROS2_T>::Factory(const string&, const string&)’:
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:46:23: error: ‘get_typesupport_library’ is not a member of ‘rclcpp’
   46 |     ts_lib_ = rclcpp::get_typesupport_library(ros2_type_name, "rosidl_typesupport_cpp");
      |                       ^~~~~~~~~~~~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:48:31: error: ‘get_typesupport_handle’ is not a member of ‘rclcpp’
   48 |       type_support_ = rclcpp::get_typesupport_handle(
      |                               ^~~~~~~~~~~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:50:10: error: invalid type argument of unary ‘*’ (have ‘int’)
   50 |         *ts_lib_);
      |          ^~~~~~~
In file included from /home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/build/ros1_bridge/generated/action_msgs_factories.hpp:6,
                 from /home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/build/ros1_bridge/generated/action_msgs__msg__GoalInfo__factories.cpp:3:
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:30: error: ‘SharedLibrary’ is not a member of ‘rcpputils’
  358 |   std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
      |                              ^~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:30: error: ‘SharedLibrary’ is not a member of ‘rcpputils’
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:43: error: template argument 1 is invalid
  358 |   std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
      |                                           ^
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp: In constructor ‘ros1_bridge::Factory<ROS1_T, ROS2_T>::Factory(const string&, const string&)’:
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:46:23: error: ‘get_typesupport_library’ is not a member of ‘rclcpp’
   46 |     ts_lib_ = rclcpp::get_typesupport_library(ros2_type_name, "rosidl_typesupport_cpp");
      |                       ^~~~~~~~~~~~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:48:31: error: ‘get_typesupport_handle’ is not a member of ‘rclcpp’
   48 |       type_support_ = rclcpp::get_typesupport_handle(
      |                               ^~~~~~~~~~~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:50:10: error: invalid type argument of unary ‘*’ (have ‘int’)
   50 |         *ts_lib_);
      |          ^~~~~~~
make[2]: *** [CMakeFiles/ros1_bridge.dir/build.make:1174 : CMakeFiles/ros1_bridge.dir/generated/action_msgs_factories.cpp.o] Erreur 1
make[2]: *** Attente des tâches non terminées....
In file included from /home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/build/ros1_bridge/generated/action_msgs_factories.hpp:6,
                 from /home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/build/ros1_bridge/generated/action_msgs__msg__GoalStatus__factories.cpp:3:
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:30: error: ‘SharedLibrary’ is not a member of ‘rcpputils’
  358 |   std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
      |                              ^~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:30: error: ‘SharedLibrary’ is not a member of ‘rcpputils’
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:43: error: template argument 1 is invalid
  358 |   std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
      |                                           ^
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp: In constructor ‘ros1_bridge::Factory<ROS1_T, ROS2_T>::Factory(const string&, const string&)’:
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:46:23: error: ‘get_typesupport_library’ is not a member of ‘rclcpp’
   46 |     ts_lib_ = rclcpp::get_typesupport_library(ros2_type_name, "rosidl_typesupport_cpp");
      |                       ^~~~~~~~~~~~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:48:31: error: ‘get_typesupport_handle’ is not a member of ‘rclcpp’
   48 |       type_support_ = rclcpp::get_typesupport_handle(
      |                               ^~~~~~~~~~~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:50:10: error: invalid type argument of unary ‘*’ (have ‘int’)
   50 |         *ts_lib_);
      |          ^~~~~~~
make[2]: *** [CMakeFiles/ros1_bridge.dir/build.make:1146 : CMakeFiles/ros1_bridge.dir/generated/custom_msg_ros2_factories.cpp.o] Erreur 1
make[2]: *** [CMakeFiles/ros1_bridge.dir/build.make:1188 : CMakeFiles/ros1_bridge.dir/generated/action_msgs__msg__GoalInfo__factories.cpp.o] Erreur 1
make[2]: *** [CMakeFiles/ros1_bridge.dir/build.make:1202 : CMakeFiles/ros1_bridge.dir/generated/action_msgs__msg__GoalStatus__factories.cpp.o] Erreur 1
make[2]: *** [CMakeFiles/ros1_bridge.dir/build.make:1160 : CMakeFiles/ros1_bridge.dir/generated/custom_msg_ros2__msg__CustomMessage__factories.cpp.o] Erreur 1
make[2]: *** [CMakeFiles/ros1_bridge.dir/build.make:1118 : CMakeFiles/ros1_bridge.dir/generated/get_factory.cpp.o] Erreur 1
make[2]: *** [CMakeFiles/ros1_bridge.dir/build.make:1076 : CMakeFiles/ros1_bridge.dir/src/builtin_interfaces_factories.cpp.o] Erreur 1
In file included from /home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/build/ros1_bridge/generated/action_msgs_factories.hpp:6,
                 from /home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/build/ros1_bridge/generated/action_msgs__msg__GoalStatusArray__factories.cpp:3:
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:30: error: ‘SharedLibrary’ is not a member of ‘rcpputils’
  358 |   std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
      |                              ^~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:30: error: ‘SharedLibrary’ is not a member of ‘rcpputils’
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:358:43: error: template argument 1 is invalid
  358 |   std::shared_ptr<rcpputils::SharedLibrary> ts_lib_;
      |                                           ^
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp: In constructor ‘ros1_bridge::Factory<ROS1_T, ROS2_T>::Factory(const string&, const string&)’:
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:46:23: error: ‘get_typesupport_library’ is not a member of ‘rclcpp’
   46 |     ts_lib_ = rclcpp::get_typesupport_library(ros2_type_name, "rosidl_typesupport_cpp");
      |                       ^~~~~~~~~~~~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:48:31: error: ‘get_typesupport_handle’ is not a member of ‘rclcpp’
   48 |       type_support_ = rclcpp::get_typesupport_handle(
      |                               ^~~~~~~~~~~~~~~~~~~~~~
/home/ac272844/ros2_bridge_custom_interfaces/bridge_ws/src/ros1_bridge/include/ros1_bridge/factory.hpp:50:10: error: invalid type argument of unary ‘*’ (have ‘int’)
   50 |         *ts_lib_);
      |          ^~~~~~~
make[2]: *** [CMakeFiles/ros1_bridge.dir/build.make:1216 : CMakeFiles/ros1_bridge.dir/generated/action_msgs__msg__GoalStatusArray__factories.cpp.o] Erreur 1
make[1]: *** [CMakeFiles/Makefile2:227 : CMakeFiles/ros1_bridge.dir/all] Erreur 2
make: *** [Makefile:146 : all] Erreur 2
---
Failed   <<< ros1_bridge [15.1s, exited with code 2]

Summary: 0 packages finished [15.3s]
  1 package failed: ros1_bridge
  1 package had stderr output: ros1_bridge
gbiggs commented 1 year ago

The ros1_bridge will only consider interface definitions from packages with names ending in _msg or _interfaces. You need to fix the package names for your packages.

zhuhj-tery commented 1 year ago

I faced a similar issue. In my case, I do not add any custom msgs or interfaces. I just install the original ros-noetic and ros-foxy. Before the commit 81f8b, I could build the ros1_bridge successfully. After that, the build just failed and the errors are just like the reported one. There seems to be some problems with the new functions for converting between ROS1 and ROS2 generic message.

gbiggs commented 1 year ago

If you want to build ros1_bridge with Foxy then you need to use the Foxy branch. The master branch only works with Rolling.

gabriel-azeredo commented 1 year ago

Enter the command git checkout foxy after cloning the repo to be sure that you are building the correct version

clalancette commented 1 year ago

Given the above, I'm going to close this out. If you are still having issues, please feel free to reopen.

tugbakara commented 1 year ago

If you want to build ros1_bridge with Foxy then you need to use the Foxy branch. The master branch only works with Rolling.

Is it still valid?

rmssalgueiro commented 5 months ago

zhuhj Where can I find the commit 81f8b? The commit numbers are usually bigger, with 7 digits