Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to resolve undefined symbol referenced from my plugin for ray sensor?

I've created a Gazebo Plugin that inherits from the RayPlugin type.

class CustomPlugin : public RayPlugin

It compiles just fine (using Gazebo 9), but when I launch Gazebo I get the following error.

[Err] [Plugin.hh:180] Failed to load plugin {path_to_plugin}/libcustom_plugin.so: {path_to_plugin}/libcustom_plugin.so: undefined symbol:
_ZTIN6gazebo9RayPluginE

I am referencing it in my model file like this:

   <plugin name="custom_plugin" filename="libcustom_plugin.so">
      <!--Parameters-->
   </plugin>

In my CMakeLists.txt, I am linking like this:

add_library(custom_plugin SHARED plugins/custom_plugin.cpp)
target_link_libraries(custom_plugin ${GAZEBO_LIBRARIES} ${IGNITION-MSGS_LIBRARIES})

I've done two things to ensure that the GAZEBO_PLUGIN_PATH is set correctly. First, I've used the tag in package.xml.

  <export>
    <!-- Other tools can request additional information be placed here -->
    <gazebo_ros plugin_path="${prefix}/lib" gazebo_media_path="${prefix}" gazebo_model_path="${prefix}/models"/>
  </export>

Secondly, I've manually set the variable to reference both the native Gazebo plugins and the lib folder.

export GAZEBO_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/gazebo-9/plugins:{path_to_ros_package}/devel/lib

I've verified that /usr/lib/x86_64-linux-gnu/gazebo-9/plugins contains libRayPlugin.so. Neither of these two works.

I am at a loss. Any thoughts?