OctoMap / octomap_rviz_plugins

RViz display plugins for visualizing octomap messages in ROS
http://ros.org/wiki/octomap_rviz_plugins
93 stars 65 forks source link

Failed to load library /opt/ros/humble/lib/liboctomap_rviz_plugins.so #48

Closed mmcza closed 1 week ago

mmcza commented 2 months ago

Hi, I was using the plugin for rviz that I installed using apt-get install ros-humble-octomap-rviz-plugins. It was working until I rebuilt the docker image last week (the previous docker image was over a month old). Now I get a following error:

ColorOccupancyGrid
The class required for this display, 'octomap_rviz_plugins/ColorOccupancyGrid', could not be loaded.
Error:
Failed to load library /opt/ros/humble/lib/liboctomap_rviz_plugins.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string: Could not load library dlopen error: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined symbol: _ZTIN7octomap13OcTreeStampedE, at ./src/shared_library.c:99

I saw a similar issue here but there it was resolved as there was some update. I did what was mentioned in that issue, but resourcing and reinstalling didn't fix the problem.

Here is response I got from ldd /opt/ros/humble/lib/liboctomap_rviz_plugins.so (it was mentioned in that issue to send the information)

        linux-vdso.so.1 (0x00007fff09e2c000)
    liboctomap_msgs__rosidl_typesupport_cpp.so => /opt/ros/humble/lib/liboctomap_msgs__rosidl_typesupport_cpp.so (0x0000734f3b559000)
    librviz_default_plugins.so => /opt/ros/humble/lib/librviz_default_plugins.so (0x0000734f3abe4000)
    librviz_common.so => /opt/ros/humble/lib/librviz_common.so (0x0000734f3aa4d000)
    librviz_rendering.so => /opt/ros/humble/lib/librviz_rendering.so (0x0000734f3a9ee000)
    libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x0000734f3a474000)
    libOgreMain.so.1.12.1 => /opt/ros/humble/opt/rviz_ogre_vendor/lib/libOgreMain.so.1.12.1 (0x0000734f3a089000)
    libclass_loader.so => /opt/ros/humble/lib/libclass_loader.so (0x0000734f3a076000)
    libmessage_filters.so => /opt/ros/humble/lib/libmessage_filters.so (0x0000734f3a071000)
    librclcpp.so => /opt/ros/humble/lib/librclcpp.so (0x0000734f39e7b000)
    liblibstatistics_collector.so => /opt/ros/humble/lib/liblibstatistics_collector.so (0x0000734f39e74000)
    librcl.so => /opt/ros/humble/lib/librcl.so (0x0000734f39e36000)
    libstatistics_msgs__rosidl_typesupport_cpp.so => /opt/ros/humble/lib/libstatistics_msgs__rosidl_typesupport_cpp.so (0x0000734f39e2f000)
    libtracetools.so => /opt/ros/humble/lib/libtracetools.so (0x0000734f39e2a000)
    libconsole_bridge.so.1.0 => /usr/lib/x86_64-linux-gnu/libconsole_bridge.so.1.0 (0x0000734f39e24000)
    libmap_msgs__rosidl_typesupport_cpp.so => /opt/ros/humble/lib/libmap_msgs__rosidl_typesupport_cpp.so (0x0000734f39e1a000)
    librmw.so => /opt/ros/humble/lib/librmw.so (0x0000734f39e0e000)
    librcutils.so => /opt/ros/humble/lib/librcutils.so (0x0000734f39df6000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x0000734f39bc8000)
    libm.so.6 => /usr/lib/x86_64-linux-gnu/libm.so.6 (0x0000734f39ae1000)
    libgcc_s.so.1 => /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 (0x0000734f39ac1000)
    libc.so.6 => /usr/lib/x86_64-linux-gnu/libc.so.6 (0x0000734f39898000)
    librosidl_typesupport_cpp.so => /opt/ros/humble/lib/librosidl_typesupport_cpp.so (0x0000734f39892000)
    libimage_transport.so => /opt/ros/humble/lib/x86_64-linux-gnu/libimage_transport.so (0x0000734f397ba000)
    libinteractive_markers.so => /opt/ros/humble/lib/libinteractive_markers.so (0x0000734f396d1000)
    liblaser_geometry.so => /opt/ros/humble/lib/liblaser_geometry.so (0x0000734f396c8000)
    libnav_msgs__rosidl_typesupport_cpp.so => /opt/ros/humble/lib/libnav_msgs__rosidl_typesupport_cpp.so (0x0000734f396c0000)
    liburdf.so => /opt/ros/humble/lib/liburdf.so (0x0000734f39684000)
    libvisualization_msgs__rosidl_typesupport_cpp.so => /opt/ros/humble/lib/libvisualization_msgs__rosidl_typesupport_cpp.so (0x0000734f3967c000)
    libignition-math6.so.6 => /usr/lib/x86_64-linux-gnu/libignition-math6.so.6 (0x0000734f39629000)
    libresource_retriever.so => /opt/ros/humble/lib/libresource_retriever.so (0x0000734f39620000)
    libsensor_msgs__rosidl_typesupport_cpp.so => /opt/ros/humble/lib/libsensor_msgs__rosidl_typesupport_cpp.so (0x0000734f39615000)
    liborocos-kdl.so.1.5 => /usr/lib/x86_64-linux-gnu/liborocos-kdl.so.1.5 (0x0000734f39559000)
    libtf2_ros.so => /opt/ros/humble/lib/libtf2_ros.so (0x0000734f394bf000)
    libtf2.so => /opt/ros/humble/lib/libtf2.so (0x0000734f394a0000)
    libtf2_msgs__rosidl_typesupport_cpp.so => /opt/ros/humble/lib/libtf2_msgs__rosidl_typesupport_cpp.so (0x0000734f39498000)
    libgeometry_msgs__rosidl_typesupport_cpp.so => /opt/ros/humble/lib/libgeometry_msgs__rosidl_typesupport_cpp.so (0x0000734f3948b000)
    libstd_msgs__rosidl_typesupport_cpp.so => /opt/ros/humble/lib/libstd_msgs__rosidl_typesupport_cpp.so (0x0000734f39480000)
    libQt5Widgets.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 (0x0000734f38dbf000)
    libQt5Gui.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 (0x0000734f386e1000)
    libament_index_cpp.so => /opt/ros/humble/lib/libament_index_cpp.so (0x0000734f386d6000)
    librcpputils.so => /opt/ros/humble/lib/librcpputils.so (0x0000734f386c8000)
    libtinyxml2.so.9 => /usr/lib/x86_64-linux-gnu/libtinyxml2.so.9 (0x0000734f386ae000)
    libyaml-cpp.so.0.7 => /usr/lib/x86_64-linux-gnu/libyaml-cpp.so.0.7 (0x0000734f3866f000)
    /lib64/ld-linux-x86-64.so.2 (0x0000734f3b646000)
    libOgreOverlay.so.1.12.1 => /opt/ros/humble/opt/rviz_ogre_vendor/lib/libOgreOverlay.so.1.12.1 (0x0000734f38611000)
    libassimp.so.5 => /usr/lib/x86_64-linux-gnu/libassimp.so.5 (0x0000734f37ecb000)
    libGLX.so.0 => /usr/lib/x86_64-linux-gnu/libGLX.so.0 (0x0000734f37e97000)
    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x0000734f37d55000)
    libz.so.1 => /usr/lib/x86_64-linux-gnu/libz.so.1 (0x0000734f37d39000)
    libdouble-conversion.so.3 => /usr/lib/x86_64-linux-gnu/libdouble-conversion.so.3 (0x0000734f37d24000)
    libicui18n.so.70 => /usr/lib/x86_64-linux-gnu/libicui18n.so.70 (0x0000734f379f5000)
    libicuuc.so.70 => /usr/lib/x86_64-linux-gnu/libicuuc.so.70 (0x0000734f377fa000)
    libpcre2-16.so.0 => /usr/lib/x86_64-linux-gnu/libpcre2-16.so.0 (0x0000734f37770000)
    libzstd.so.1 => /usr/lib/x86_64-linux-gnu/libzstd.so.1 (0x0000734f3769f000)
    libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x0000734f37565000)
    librcl_interfaces__rosidl_typesupport_cpp.so => /opt/ros/humble/lib/librcl_interfaces__rosidl_typesupport_cpp.so (0x0000734f3755a000)
    librcl_yaml_param_parser.so => /opt/ros/humble/lib/librcl_yaml_param_parser.so (0x0000734f3754e000)
    librosgraph_msgs__rosidl_typesupport_cpp.so => /opt/ros/humble/lib/librosgraph_msgs__rosidl_typesupport_cpp.so (0x0000734f37549000)
    librmw_implementation.so => /opt/ros/humble/lib/librmw_implementation.so (0x0000734f3753a000)
    librcl_logging_interface.so => /opt/ros/humble/lib/librcl_logging_interface.so (0x0000734f37535000)
    librcl_logging_spdlog.so => /opt/ros/humble/lib/librcl_logging_spdlog.so (0x0000734f3752e000)
    librcl_interfaces__rosidl_typesupport_c.so => /opt/ros/humble/lib/librcl_interfaces__rosidl_typesupport_c.so (0x0000734f37525000)
    librcl_interfaces__rosidl_generator_c.so => /opt/ros/humble/lib/librcl_interfaces__rosidl_generator_c.so (0x0000734f37509000)
    librosidl_runtime_c.so => /opt/ros/humble/lib/librosidl_runtime_c.so (0x0000734f374fc000)
    libcurl.so.4 => /usr/lib/x86_64-linux-gnu/libcurl.so.4 (0x0000734f37455000)
    librclcpp_action.so => /opt/ros/humble/lib/librclcpp_action.so (0x0000734f37434000)
    libaction_msgs__rosidl_typesupport_cpp.so => /opt/ros/humble/lib/libaction_msgs__rosidl_typesupport_cpp.so (0x0000734f3742e000)
    libGL.so.1 => /usr/lib/x86_64-linux-gnu/libGL.so.1 (0x0000734f373a5000)
    libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x0000734f3736a000)
    libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x0000734f3729b000)
    libmd4c.so.0 => /usr/lib/x86_64-linux-gnu/libmd4c.so.0 (0x0000734f37289000)
    libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x0000734f371c1000)
    libdraco.so.4 => /usr/lib/x86_64-linux-gnu/libdraco.so.4 (0x0000734f36f52000)
    libminizip.so.1 => /usr/lib/x86_64-linux-gnu/libminizip.so.1 (0x0000734f36c00000)
    libGLdispatch.so.0 => /usr/lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x0000734f36e9a000)
    libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x0000734f36e70000)
    libicudata.so.70 => /usr/lib/x86_64-linux-gnu/libicudata.so.70 (0x0000734f34fe2000)
    libpcre.so.3 => /usr/lib/x86_64-linux-gnu/libpcre.so.3 (0x0000734f34f6c000)
    libyaml.so => /opt/ros/humble/lib/libyaml.so (0x0000734f36e4c000)
    libspdlog.so.1 => /usr/lib/x86_64-linux-gnu/libspdlog.so.1 (0x0000734f34ef1000)
    librosidl_typesupport_c.so => /opt/ros/humble/lib/librosidl_typesupport_c.so (0x0000734f36e46000)
    libbuiltin_interfaces__rosidl_generator_c.so => /opt/ros/humble/lib/libbuiltin_interfaces__rosidl_generator_c.so (0x0000734f36e41000)
    libnghttp2.so.14 => /usr/lib/x86_64-linux-gnu/libnghttp2.so.14 (0x0000734f36e15000)
    libidn2.so.0 => /usr/lib/x86_64-linux-gnu/libidn2.so.0 (0x0000734f34ed0000)
    librtmp.so.1 => /usr/lib/x86_64-linux-gnu/librtmp.so.1 (0x0000734f34eb1000)
    libssh.so.4 => /usr/lib/x86_64-linux-gnu/libssh.so.4 (0x0000734f34e44000)
    libpsl.so.5 => /usr/lib/x86_64-linux-gnu/libpsl.so.5 (0x0000734f34e30000)
    libssl.so.3 => /usr/lib/x86_64-linux-gnu/libssl.so.3 (0x0000734f34d8c000)
    libcrypto.so.3 => /usr/lib/x86_64-linux-gnu/libcrypto.so.3 (0x0000734f34948000)
    libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x0000734f348f4000)
    libldap-2.5.so.0 => /usr/lib/x86_64-linux-gnu/libldap-2.5.so.0 (0x0000734f34895000)
    liblber-2.5.so.0 => /usr/lib/x86_64-linux-gnu/liblber-2.5.so.0 (0x0000734f34884000)
    libbrotlidec.so.1 => /usr/lib/x86_64-linux-gnu/libbrotlidec.so.1 (0x0000734f34876000)
    librcl_action.so => /opt/ros/humble/lib/librcl_action.so (0x0000734f34863000)
    libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x0000734f3483c000)
    libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x0000734f36e0b000)
    libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x0000734f34834000)
    libfmt.so.8 => /usr/lib/x86_64-linux-gnu/libfmt.so.8 (0x0000734f34813000)
    libunistring.so.2 => /usr/lib/x86_64-linux-gnu/libunistring.so.2 (0x0000734f34669000)
    libgnutls.so.30 => /usr/lib/x86_64-linux-gnu/libgnutls.so.30 (0x0000734f3447c000)
    libhogweed.so.6 => /usr/lib/x86_64-linux-gnu/libhogweed.so.6 (0x0000734f34434000)
    libnettle.so.8 => /usr/lib/x86_64-linux-gnu/libnettle.so.8 (0x0000734f343ee000)
    libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x0000734f3436c000)
    libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x0000734f342a1000)
    libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x0000734f34270000)
    libcom_err.so.2 => /usr/lib/x86_64-linux-gnu/libcom_err.so.2 (0x0000734f3426a000)
    libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x0000734f3425c000)
    libsasl2.so.2 => /usr/lib/x86_64-linux-gnu/libsasl2.so.2 (0x0000734f34241000)
    libbrotlicommon.so.1 => /usr/lib/x86_64-linux-gnu/libbrotlicommon.so.1 (0x0000734f3421e000)
    libbsd.so.0 => /usr/lib/x86_64-linux-gnu/libbsd.so.0 (0x0000734f34204000)
    libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x0000734f340c9000)
    libtasn1.so.6 => /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x0000734f340b1000)
    libkeyutils.so.1 => /usr/lib/x86_64-linux-gnu/libkeyutils.so.1 (0x0000734f340aa000)
    libresolv.so.2 => /usr/lib/x86_64-linux-gnu/libresolv.so.2 (0x0000734f34096000)
    libmd.so.0 => /usr/lib/x86_64-linux-gnu/libmd.so.0 (0x0000734f34087000)
    libffi.so.8 => /usr/lib/x86_64-linux-gnu/libffi.so.8 (0x0000734f3407a000)
aosmw commented 2 months ago

Seeing the same here on multiple systems after an apt upgrade.

sudo apt install liboctomap-dev ros-humble-octomap-ros ros-humble-octomap-rviz-plugins ros-humble-octomap-msgs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
liboctomap-dev is already the newest version (1.9.7+dfsg-3).
ros-humble-octomap-msgs is already the newest version (2.0.0-3jammy.20240728.220605).
ros-humble-octomap-ros is already the newest version (0.4.4-1jammy.20240728.221134).
ros-humble-octomap-rviz-plugins is already the newest version (2.1.0-1jammy.20240730.174119).
ld /opt/ros/humble/lib/liboctomap_rviz_plugins.so 
ld: warning: cannot find entry symbol _start; not setting start address
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `octomap::Pointcloud::Pointcloud()'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `octomap::Pointcloud::~Pointcloud()'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `octomath::Pose6D::Pose6D(octomath::Pose6D const&)'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `octomap::OcTreeNode::addValue(float const&)'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `octomap::OcTreeNode::OcTreeNode()'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `octomap::OcTreeNode::~OcTreeNode()'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `octomap::AbstractOcTree::createTree(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double)'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `octomap::Pointcloud::transform(octomath::Pose6D)'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `octomath::Pose6D::~Pose6D()'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `typeinfo for octomap::OcTreeStamped'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `octomap::OcTree::OcTree(double)'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `octomath::Pose6D::inv() const'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `octomap::ColorOcTree::ColorOcTree(double)'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `octomath::operator<<(std::ostream&, octomath::Vector3 const&)'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `octomath::Pose6D::transform(octomath::Vector3 const&) const'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `octomap::Pointcloud::Pointcloud(octomap::Pointcloud const&)'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `typeinfo for octomap::ColorOcTree'
ld: /opt/ros/humble/lib/liboctomap_rviz_plugins.so: undefined reference to `octomap::OcTreeNode::getMaxChildLogOdds() const'
ls -al $(dpkg-query -L liboctomap-dev | grep liboctomap.[aso] )
-rw-r--r-- 1 root root 694434 Aug 27  2021 /usr/lib/x86_64-linux-gnu/liboctomap.a
lrwxrwxrwx 1 root root     17 Aug 27  2021 /usr/lib/x86_64-linux-gnu/liboctomap.so -> liboctomap.so.1.9
ls -al /opt/ros/humble/lib/liboctomap_rviz_plugins.so 
-rw-r--r-- 1 root root 932056 Jul 31 03:41 /opt/ros/humble/lib/liboctomap_rviz_plugins.so
aosmw commented 2 months ago

Possibly related

aosmw commented 2 months ago

Workaround

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/liboctomap.so ros2 run rviz2 rviz2

mmcza commented 2 months ago

Thank you @aosmw . The workaround is working

aosmw commented 2 months ago

@mmcza Are you able to reopen this issue? The real fix will require this PR https://github.com/OctoMap/octomap_rviz_plugins/pull/49 and a re-release.

Cakem1x commented 2 months ago

Hi there, I have experienced the same issue. Here's my info on it:

Info

The Problem

When selecting any of the octomap occupancy grid displays (e.g. OccupancyGrid), loading the plugin fails with the following error message from rviz:

[ERROR] [1724688835.264146998] [rviz2]: PluginlibFactory: The plugin for class 'octomap_rviz_plugins/OccupancyGrid' failed to load. Error: Failed to load library /home/docker/ros_ws/install/octomap_rviz_plugins/lib/liboctomap_rviz_plugins.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string: Could not load library dlopen error: /home/docker/ros_ws/install/octomap_rviz_plugins/lib/liboctomap_rviz_plugins.so: undefined symbol: _ZTIN7octomap13OcTreeStampedE, at ./src/shared_library.c:99

So, I figure it doesn't link against the lib in which this symbol is defined; Probably, the main octomap lib.

The fix?

I managed to fix the problem by adding find_package(octomap REQUIRED) to the CMakeLists.txt. After re-building my workspace, I can add the rviz display without getting error output from rviz.

aosmw commented 2 months ago

@Cakem1x does the change in PR #49 also work for you?

Cakem1x commented 2 months ago

Yes, your fix also works for my setup. Nice!

I suspect the octomap target comes from liboctomap-dev, in the package.xml. So it should be there after running rosdep for all compatible systems :+1: .

I think my fix works because finding octomap populates the ${OCTOMAP_LIBRARIES} cmake variable, so it basically ends up doing the same thing as your fix. I am unclear about linking against octomap works with your solution, without finding it via find_package(octomap) first. Do you know why this works?

aosmw commented 2 months ago

It works because of ament_auto_find_build_dependencies() at the top of the file. It knows how to read the package.xml and call find_package() on the listed dependencies and constructs targets that can be used in target_link_libraries.

Follow this rabbit hole. https://github.com/ament/ament_cmake/blob/4c630d4c36af09e8a426ef5c1fbc8850f656019c/ament_cmake_auto/cmake/ament_auto_find_build_dependencies.cmake

wxmerkt commented 1 week ago

Thank you for the detailed documentation and fix suggestion. The corresponding PR #49 is merged and a release to Iron, Humble, and Rolling made. Should there be any issues, please feel free to tag me