Robotics StackExchange | Archived questions

Failed to load plugin undefined symbol

Hi, I'm new at gazebo/ROS and wanted to write my own plugin after i tried the tutorial. but i get the following error:

 Error [Plugin.hh:156] Failed to load plugin /home/student/gazebo_plugin_tutorial/build/libTestPlugin.so: /home/student/gazebo_plugin_tutorial/build/libTestPlugin.so: undefined symbol: _ZN6gazebo10TestPlugin4InitEv

This is my CMakelist.

  cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

find_package(Boost REQUIRED COMPONENTS system)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})

include (FindPkgConfig)
if (PKG_CONFIG_FOUND)
  pkg_check_modules(GAZEBO gazebo)
endif()
include_directories(${GAZEBO_INCLUDE_DIRS})

link_directories(${GAZEBO_LIBRARY_DIRS})


add_library(TestPlugin SHARED TestPlugin.cc)


target_link_libraries(  TestPlugin ${GAZEBO_LIBRARIES} ${Boost_LIBRARIES} ${catkin_LIBRARIES} )

Thanks in advance for every answer

Asked by gazbegin on 2015-11-26 15:50:28 UTC

Comments

Answers

Hi there,

the error appears because the plugin was not correctly linked. You probably missing a link_directories variable.

I would just start with the given working plugins from the tutorials, and grow from there. Here is the link: http://gazebosim.org/tutorials?tut=plugins_hello_world

Cheers, Andrei

Asked by AndreiHaidu on 2015-11-26 16:37:37 UTC

Comments

Thanks for the fast answer.

Yeah I already did those tutorials from there and they are working fine. So the difference in the plugins is that I want to use the plugin with a publisher and subscriber.

Asked by gazbegin on 2015-11-26 17:47:28 UTC

Comments

ros or gazebo publisher/subscriber?

Asked by AndreiHaidu on 2015-11-27 04:16:07 UTC

I want to publish velocity, angle in ros. Subscribe it in the gazebo plugin. And publish the actuell velocity, position etc from gazebo to ros

Asked by gazbegin on 2015-11-27 04:38:37 UTC

did you look over the gazebo-ros tutorials, there are many working examples and explanations there http://gazebosim.org/tutorials?cat=connect_ros

Asked by AndreiHaidu on 2015-11-27 05:23:24 UTC

in my case I was doing an extension of a plugin (the FlashLightPlugin) and I did not link mine with that.

adding the following on my CMakeLists.txt and recompiling resolved the issue.

target_link_libraries(flash_light_extension_plugin ${GAZEBO_LIBRARIES} FlashLightPlugin)

Asked by lauracorssac on 2022-01-28 11:15:11 UTC

Comments