ros1_bridge installation error "libros1_bridge.so: undefined reference to controller_manager_msgs"
Hello,
I am trying to install ros1_bridge inside a NUC. On this NUC I have installed: the Ubuntu 20.04.4 LTS OS; the ros-noetic-desktop-full of ROS1 Noetic; the ros-foxy-desktop and ros-foxy-ros-base of ROS2 Foxy.
I followed the steps of the ros1_bridge repository (https://github.com/ros2/ros1_bridge), both the foxy branch steps and the master branch steps. But, in both cases I got the same error when I compiled the ros1_bridge with the command:
colcon build --symlink-install --packages-select ros1_bridge --cmake-force-configure
These are all the steps I have followed.
First, in a Shell_1 I have compiled my ROS1 code:
source /opt/ros/noetic/setup.bash
cd ~/catkin_ws/
catkin build
source devel/setup.bash
Then, in a Shell_2 I compiled my ROS2 code:
source /opt/ros/foxy/setup.bash
cd ~/colcon_ws
colcon build --symlink-install
source install/setup.bash
In another terminal that does not have the ROS 1 environment sourced (Shell_3), I have tried to install ros1_bridge unsuccessfully by doing the following:
source /opt/ros/foxy/setup.bash
mkdir -p ~/ros1_bridge/src
cd ~/ros1_bridge/src
git clone -b foxy https://github.com/ros2/ros1_bridge.git
cd ~/ros1_bridge
colcon build --symlink-install --packages-skip ros1_bridge
source /opt/ros/noetic/setup.bash
source ~/catkin_ws/devel/setup.bash
source /opt/ros/foxy/setup.bash
source ~/colcon_ws/install/setup.bash
colcon build --symlink-install --packages-select ros1_bridge --cmake-force-configure
And this is the error I get during compilation:
/usr/bin/ld: libros1_bridge.so: undefined reference to `ros1_bridge::Factory<controller_manager_msgs::ControllerState_<std::allocator<void> >, controller_manager_msgs::msg::ControllerState_<std::allocator<void> > >::convert_1_to_2(controller_manager_msgs::ControllerState_<std::allocator<void> > const&, controller_manager_msgs::msg::ControllerState_<std::allocator<void> >&)'
/usr/bin/ld: libros1_bridge.so: undefined reference to `ros1_bridge::Factory<controller_manager_msgs::ControllerState_<std::allocator<void> >, controller_manager_msgs::msg::ControllerState_<std::allocator<void> > >::convert_2_to_1(controller_manager_msgs::msg::ControllerState_<std::allocator<void> > const&, controller_manager_msgs::ControllerState_<std::allocator<void> >&)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/parameter_bridge.dir/build.make:451: parameter_bridge] Error 1
make[1]: *** [CMakeFiles/Makefile2:314: CMakeFiles/parameter_bridge.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/usr/bin/ld: libros1_bridge.so: undefined reference to `ros1_bridge::Factory<controller_manager_msgs::ControllerState_<std::allocator<void> >, controller_manager_msgs::msg::ControllerState_<std::allocator<void> > >::convert_1_to_2(controller_manager_msgs::ControllerState_<std::allocator<void> > const&, controller_manager_msgs::msg::ControllerState_<std::allocator<void> >&)'
/usr/bin/ld: libros1_bridge.so: undefined reference to `ros1_bridge::Factory<controller_manager_msgs::ControllerState_<std::allocator<void> >, controller_manager_msgs::msg::ControllerState_<std::allocator<void> > >::convert_2_to_1(controller_manager_msgs::msg::ControllerState_<std::allocator<void> > const&, controller_manager_msgs::ControllerState_<std::allocator<void> >&)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/static_bridge.dir/build.make:451: static_bridge] Error 1
make[1]: *** [CMakeFiles/Makefile2:233: CMakeFiles/static_bridge.dir/all] Error 2
/usr/bin/ld: warning: libconsole_bridge.so.0.4, needed by /opt/ros/noetic/lib/libcpp_common.so, may conflict with libconsole_bridge.so.1.0
/usr/bin/ld: libros1_bridge.so: undefined reference to `ros1_bridge::Factory<controller_manager_msgs::ControllerState_<std::allocator<void> >, controller_manager_msgs::msg::ControllerState_<std::allocator<void> > >::convert_1_to_2(controller_manager_msgs::ControllerState_<std::allocator<void> > const&, controller_manager_msgs::msg::ControllerState_<std::allocator<void> >&)'
/usr/bin/ld: libros1_bridge.so: undefined reference to `ros1_bridge::Factory<controller_manager_msgs::ControllerState_<std::allocator<void> >, controller_manager_msgs::msg::ControllerState_<std::allocator<void> > >::convert_2_to_1(controller_manager_msgs::msg::ControllerState_<std::allocator<void> > const&, controller_manager_msgs::ControllerState_<std::allocator<void> >&)'
collect2: error: ld returned 1 ...