Errors while compiling publisher and subscriber from ros2_examples

asked 2019-04-17 04:21:19 -0500

Abirami_Ravi gravatar image

updated 2019-04-17 09:25:03 -0500

gvdhoorn gravatar image

Ubuntu Version: 18.04 Ros2 Crystal is installed and sourced. Step1: The examples in ros2 is cloned from the following link https://github.com/ros2/examples Step2: The folders other than "minimal_publisher" and "minimal_subscriber" is removed.

Step 3: colcon build --symlink-install command is given

Following error appears:

**Starting >>> examples_rclcpp_minimal_publisher
Starting >>> examples_rclcpp_minimal_subscriber
--- stderr: examples_rclcpp_minimal_publisher                                                                                                
CMakeFiles/publisher_not_composable.dir/not_composable.cpp.o: In function `rclcpp::Publisher<std_msgs::msg::String_<std::allocator<void> >, std::allocator<void> >::Publisher(rclcpp::node_interfaces::NodeBaseInterface*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rcl_publisher_options_t const&, std::shared_ptr<std::allocator<std_msgs::msg::String_<std::allocator<void> > > > const&)':
not_composable.cpp:(.text._ZN6rclcpp9PublisherIN8std_msgs3msg7String_ISaIvEEES4_EC2EPNS_15node_interfaces17NodeBaseInterfaceERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERK23rcl_publisher_options_tRKSt10shared_ptrISaIS5_EE[_ZN6rclcpp9PublisherIN8std_msgs3msg7String_ISaIvEEES4_EC5EPNS_15node_interfaces17NodeBaseInterfaceERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERK23rcl_publisher_options_tRKSt10shared_ptrISaIS5_EE]+0x22): undefined reference to `rosidl_message_type_support_t const* rosidl_typesupport_cpp::get_message_type_support_handle<std_msgs::msg::String_<std::allocator<void> > >()'
collect2: error: ld returned 1 exit status
make[2]: *** [publisher_not_composable] Error 1
make[1]: *** [CMakeFiles/publisher_not_composable.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
CMakeFiles/publisher_lambda.dir/lambda.cpp.o: In function `rclcpp::Publisher<std_msgs::msg::String_<std::allocator<void> >, std::allocator<void> >::Publisher(rclcpp::node_interfaces::NodeBaseInterface*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rcl_publisher_options_t const&, std::shared_ptr<std::allocator<std_msgs::msg::String_<std::allocator<void> > > > const&)':
lambda.cpp:(.text._ZN6rclcpp9PublisherIN8std_msgs3msg7String_ISaIvEEES4_EC2EPNS_15node_interfaces17NodeBaseInterfaceERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERK23rcl_publisher_options_tRKSt10shared_ptrISaIS5_EE[_ZN6rclcpp9PublisherIN8std_msgs3msg7String_ISaIvEEES4_EC5EPNS_15node_interfaces17NodeBaseInterfaceERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERK23rcl_publisher_options_tRKSt10shared_ptrISaIS5_EE]+0x22): undefined reference to `rosidl_message_type_support_t const* rosidl_typesupport_cpp::get_message_type_support_handle<std_msgs::msg::String_<std::allocator<void> > >()'
collect2: error: ld returned 1 exit status
make[2]: *** [publisher_lambda] Error 1
make[1]: *** [CMakeFiles/publisher_lambda.dir/all] Error 2
CMakeFiles/publisher_member_function.dir/member_function.cpp.o: In function `rclcpp::Publisher<std_msgs::msg::String_<std::allocator<void> >, std::allocator<void> >::Publisher(rclcpp::node_interfaces::NodeBaseInterface*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rcl_publisher_options_t const&, std::shared_ptr<std::allocator<std_msgs::msg::String_<std::allocator<void> > > > const&)':
member_function.cpp:(.text._ZN6rclcpp9PublisherIN8std_msgs3msg7String_ISaIvEEES4_EC2EPNS_15node_interfaces17NodeBaseInterfaceERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERK23rcl_publisher_options_tRKSt10shared_ptrISaIS5_EE[_ZN6rclcpp9PublisherIN8std_msgs3msg7String_ISaIvEEES4_EC5EPNS_15node_interfaces17NodeBaseInterfaceERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERK23rcl_publisher_options_tRKSt10shared_ptrISaIS5_EE]+0x22): undefined reference to `rosidl_message_type_support_t const* rosidl_typesupport_cpp::get_message_type_support_handle<std_msgs::msg::String_<std::allocator<void> > >()'
collect2: error: ld returned 1 exit status
make[2]: *** [publisher_member_function] Error 1
make[1]: *** [CMakeFiles/publisher_member_function.dir/all] Error 2
make: *** [all] Error 2
---
Failed   <<< examples_rclcpp_minimal_publisher  [ Exited with code 2 ]
--- stderr: examples_rclcpp_minimal_subscriber                                         
CMakeFiles/subscriber_lambda.dir/lambda.cpp.o: In function `rclcpp::create_subscription_factory<std_msgs::msg::String_<std::allocator<void> >, MinimalSubscriber::MinimalSubscriber()::{lambda(std::unique_ptr<std_msgs::msg::String_<std::allocator<void> >, std::default_delete<std_msgs::msg::String_<std::allocator<void> > > >)#1}, std::allocator<void>, std_msgs::msg::String_<std::allocator<void> >, rclcpp::Subscription<std_msgs::msg::String_<std::allocator<void> >, std::allocator<void> > >(MinimalSubscriber::MinimalSubscriber()::{lambda(std::unique_ptr<std_msgs::msg::String_<std::allocator<void> >, std::default_delete<std_msgs::msg::String_<std::allocator<void> > > >)#1}&&, rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::String_<std::allocator<void> >, std::allocator<void> >::SharedPtr, std::shared_ptr<std_msgs::msg::String_<std::allocator<void> > >)::{lambda(rclcpp::node_interfaces::NodeBaseInterface*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rcl_subscription_options_t&)#1}::operator()(rclcpp::node_interfaces::NodeBaseInterface, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, rcl_subscription_options_t) const':
lambda.cpp:(.text._ZZN6rclcpp27create_subscription_factoryIN8std_msgs3msg7String_ISaIvEEEZN17MinimalSubscriberC4EvEUlSt10unique_ptrIS5_St14default_deleteIS5_EEE_S4_S5_NS_12SubscriptionIS5_S4_EEEENS_19SubscriptionFactoryEOT0_NS_23message_memory_strategy21MessageMemoryStrategyIT2_T1_E9SharedPtrESt10shared_ptrISK_EENKUlPNS_15node_interfaces17NodeBaseInterfaceERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER26rcl_subscription_options_tE_clESR_SZ_S11_[_ZZN6rclcpp27create_subscription_factoryIN8std_msgs3msg7String_ISaIvEEEZN17MinimalSubscriberC4EvEUlSt10unique_ptrIS5_St14default_deleteIS5_EEE_S4_S5_NS_12SubscriptionIS5_S4_EEEENS_19SubscriptionFactoryEOT0_NS_23message_memory_strategy21MessageMemoryStrategyIT2_T1_E9SharedPtrESt10shared_ptrISK_EENKUlPNS_15node_interfaces17NodeBaseInterfaceERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER26rcl_subscription_options_tE_clESR_SZ_S11_]+0xa6): undefined reference to `rosidl_message_type_support_t const* rosidl_typesupport_cpp::get_message_type_support_handle<std_msgs::msg::String_<std::allocator<void> > >()'
collect2: error: ld returned 1 exit status
make[2]: *** [subscriber_lambda] Error 1
make[1]: *** [CMakeFiles/subscriber_lambda.dir/all] Error 2
make ...
(more)
edit retag flag offensive close merge delete

Comments

Errors while running

these appear to be compiler errors. Not runtime errors. Is that correct?

gvdhoorn gravatar imagegvdhoorn ( 2019-04-17 04:44:50 -0500 )edit

Yes these are compiler errors

Abirami_Ravi gravatar imageAbirami_Ravi ( 2019-04-17 06:32:48 -0500 )edit

Then it would seem the current title of your question is incorrect.

I've updated it to reflect your problem better.

gvdhoorn gravatar imagegvdhoorn ( 2019-04-17 09:25:47 -0500 )edit

I just tested your example (first removing most directories) and it compiles & links fine for me. Having said that, I see that there's a crystal branch on https://github.com/ros2/examples , so you probably want to git checkout that branch.

clyde gravatar imageclyde ( 2019-04-22 14:14:07 -0500 )edit