ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

symbol lookup error in lib<PKG>__rosidl_typesupport_introspection_cpp.so:

asked 2020-08-24 12:48:31 -0500

federico.ferri gravatar image

updated 2020-08-24 13:48:13 -0500

gvdhoorn gravatar image

I'm developing a library on Ubuntu 20.04 and ROS2 Foxy, as an ament package "xyz" and its relative interfaces package "xyz_interfaces".

The problem is that when loading the library I get this error:

symbol lookup error:
/home/user/ros2_ws/install/xyz_interfaces/lib/libxyz_interfaces__rosidl_typesupport_introspection_cpp.so:
undefined symbol:
_ZN36rosidl_typesupport_introspection_cpp31get_message_type_support_handleIN13geometry_msgs3msg8Point32_ISaIvEEEEEPK29rosidl_message_type_support_tv

demangled:

rosidl_message_type_support_t const* rosidl_typesupport_introspection_cpp::get_message_type_support_handle<geometry_msgs::msg::Point32_<std::allocator<void> > >()

The interfaces packages uses messages from the geometry_msgs and shape_msgs packages. If we look at the undefined symbols in the above shared library, we see that exactly those get_message_type_support_handle functions related to those packages are undefined.

❯ nm -uC install/xyz_interfaces/lib/libxyz_interfaces__rosidl_typesupport_introspection_cpp.so
                 U __cxa_begin_catch@@CXXABI_1.3
                 U __cxa_end_catch@@CXXABI_1.3
                 w __cxa_finalize@@GLIBC_2.2.5
                 U __cxa_rethrow@@CXXABI_1.3
                 U get_message_typesupport_handle_function
                 U get_service_typesupport_handle_function
                 w __gmon_start__
                 U __gxx_personality_v0@@CXXABI_1.3
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 U memmove@@GLIBC_2.2.5
                 U __stack_chk_fail@@GLIBC_2.4
                 U _Unwind_Resume@@GCC_3.0
                 U operator delete(void*)@@GLIBCXX_3.4
                 U rosidl_typesupport_introspection_cpp::typesupport_identifier
                 U rosidl_message_type_support_t const* rosidl_typesupport_introspection_cpp::get_message_type_support_handle<shape_msgs::msg::Mesh_<std::allocator<void> > >()
                 U rosidl_message_type_support_t const* rosidl_typesupport_introspection_cpp::get_message_type_support_handle<geometry_msgs::msg::Quaternion_<std::allocator<void> > >()
                 U rosidl_message_type_support_t const* rosidl_typesupport_introspection_cpp::get_message_type_support_handle<geometry_msgs::msg::Pose_<std::allocator<void> > >()
                 U rosidl_message_type_support_t const* rosidl_typesupport_introspection_cpp::get_message_type_support_handle<geometry_msgs::msg::Point32_<std::allocator<void> > >()
                 U rosidl_message_type_support_t const* rosidl_typesupport_introspection_cpp::get_message_type_support_handle<geometry_msgs::msg::Vector3_<std::allocator<void> > >()
                 U std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(char const*)@@GLIBCXX_3.4.21
                 U std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)@@GLIBCXX_3.4.21
                 U std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()@@GLIBCXX_3.4.21
                 U std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()@@GLIBCXX_3.4.21
                 U operator new(unsigned long)@@GLIBCXX_3.4
                 U std::__throw_bad_alloc()@@GLIBCXX_3.4
                 U std::__throw_length_error(char const*)@@GLIBCXX_3.4

Did I forget something in the CMakeLists.txt files?

Here are the relevant files:

xyz_interfaces/package.xml:

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>xyz_interfaces</name>
  <version>1.0.0</version>
  <description>XYZ interfaces package</description>
  <maintainer email="admin@localhost">admin</maintainer>
  <license>BSD2</license>

  <buildtool_depend>ament_cmake</buildtool_depend>
  <buildtool_depend>rosidl_default_generators</buildtool_depend>

  <depend>geometry_msgs</depend>
  <depend>shape_msgs</depend>

  <exec_depend>rosidl_default_runtime</exec_depend>

  <member_of_group>rosidl_interface_packages</member_of_group>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>

xyz_interfaces/CMakeLists.txt:

cmake_minimum_required(VERSION 3.5)
project(xyz_interfaces)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
    set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    #add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(shape_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)

rosidl_generate_interfaces(${PROJECT_NAME}
    msg/Variant.msg
    srv/GetXYZ.srv
    ...
)

ament_export_dependencies(
    rosidl_default_runtime
    geometry_msgs
    shape_msgs
)
ament_package()

xyz/package.xml:

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>xyz</name>
  <version>1.0.0</version>
  <description>XYZ package</description>
  <maintainer email="admin@localhost">admin</maintainer>
  <license>BSD2</license>

  <buildtool_depend>ament_cmake</buildtool_depend>

  <depend>rclcpp</depend>
  <depend>xyz_interfaces</depend>

  <test_depend>ament_lint_auto</test_depend>
  <test_depend>ament_lint_common</test_depend>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>

xyz/CMakeLists.txt:

cmake_minimum_required(VERSION 3.5)
project(xyz ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
4

answered 2021-09-17 09:54:48 -0500

trueckel gravatar image

updated 2021-09-17 12:57:48 -0500

I had the same issue and solved it by referencing the dependencies for the messages and services of the xyz_interfaces package directly within the rosidl_generate_interfaces statement.

CMakeList.txt of xyz_interfaces:

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)

rosidl_generate_interfaces(${PROJECT_NAME}
    msg/Variant.msg
    srv/GetXYZ.srv
    ...
    DEPENDENCIES shape_msgs geometry_msgs
)
edit flag offensive delete link more

Comments

Ran into this exact issue today and following the solution from @trueckel solved it for me!! Thanks!

swiz23 gravatar image swiz23  ( 2021-10-04 18:11:06 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-08-24 12:48:31 -0500

Seen: 1,156 times

Last updated: Sep 17 '21