0
$\begingroup$

Rosanswers logo

Hi everyone,

I am trying to have a simple RQT template to use in the future whenever I need to create a new GUI. The main idea of my minimal (not) working example (MNWE) is to have:

  • TemplatePlugin class that is exported as plugin for RQT;
  • TemplateWidget class that implements an RQT widget that is then included in TemplatePlugin.

This is a similar approach employed in rqt_multiplot where there's one main MultiplotPlugin that includes different widgets.

I'm able to compile my (MNWE) , but when I launch the gui I get the following error:

[ERROR] [1511538332.555287110]: Failed to load nodelet [rqt_template_plugin::TemplatePlugin_0] of type [rqt_template_plugin::TemplatePlugin]: Failed to load library /home/marco/catkin_ws/devel/lib//librqt_template_plugin.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 (Poco exception = /home/marco/catkin_ws/devel/lib//librqt_template_plugin.so: undefined symbol: _ZN19rqt_template_plugin14TemplatePluginD1Ev)

RosPluginlibPluginProvider::load_explicit_type(rqt_template_plugin::TemplatePlugin) failed creating instance PluginManager._load_plugin() could not load plugin "rqt_template_plugin::TemplatePlugin": RosPluginlibPluginProvider.load() could not load plugin "rqt_template_plugin::TemplatePlugin"

Even though the error suggests that I don't have the macro "PLUGINLIB_EXPORT_CLASS", it is actually present in my cpp file: PLUGINLIB_EXPORT_CLASS. So I guess I am not linking the plugin at compile time correctly and then having issue at run time. I tried the solution proposed in this other thread question/215487, but adding "set(CMAKE_AUTOMOC ON)" to make CMakeLists.txt file prevents me compiling the whole package.

Update of 27/11/2017

Running the command

for f in $(find ~/catkin_ws -name "*.so"); do echo $f; objdump -TC $f | grep _ZN19rqt_template_plugin14TemplatePluginD1Ev; done

the symbol "_ZN19rqt_template_plugin14TemplatePluginD1Ev" is not found at all. Whereas if I run the command

for f in $(find ~/catkin_ws -name "*.so"); do echo $f; objdump -TC $f | grep rqt_template_plugin; done

Then I obtain:

/home/marco/catkin_ws/devel/lib/librqt_template_plugin.so
/home/marco/catkin_ws/devel/lib/librqt_template_plugin.so:     file format elf64-x86-64
0000000000000000      D  *UND*  0000000000000000              
rqt_template_plugin::TemplatePlugin::~TemplatePlugin()
0000000000000000      D  *UND*  0000000000000000              
rqt_template_plugin::TemplatePlugin::~TemplatePlugin()
0000000000000000      D  *UND*  0000000000000000              non-virtual thunk to 
rqt_template_plugin::TemplatePlugin::~TemplatePlugin()
0000000000000000      D  *UND*  0000000000000000              non-virtual thunk to 
rqt_template_plugin::TemplatePlugin::~TemplatePlugin()

** End Update **

I was wondering if anyone could give me a hint about what I should try next.

Thanks a lot,

Marco.


Originally posted by Femer on ROS Answers with karma: 253 on 2017-11-24

Post score: 1


Original comments

Comment by Ruben Alves on 2017-11-24:
Not an answer but maybe helps. You can see if the symbol exists in any library on your catkin_ws with:

for f in $(find ~/catkin_ws -name "*.so"); do echo $f; objdump -TC $f | grep _ZN19rqt_template_plugin14TemplatePluginD1Ev; done

If is defined, it will be printed after the name of the .so

Comment by Ruben Alves on 2017-11-24:
If you see that the symbol is defined, then is just because it's not being loaded at runtime.

See if the path to the library is on your LD_LIBRARY_PATH with: env | grep LD_LIBRARY_PATH

Comment by Femer on 2017-11-27:
Hi Ruben, thanks for your comment! With your first command the symbol was not found at all. Instead if I grep rqt_template then I get the result I just pasted in the updated question ... any idea?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Hi @Femer !

The problem is that you missed the implementation of the destructor. You can solve just by defining TemplatePlugin::~TemplatePlugin(){} on your TemplatePlugin.cpp.

I've discovered this by running c++filt _ZN19rqt_template_plugin14TemplatePluginD1Ev that give us the following output: rqt_template_plugin::TemplatePlugin::~TemplatePlugin().

I've created a video (https://youtu.be/4xZKflNlJho) that shows that this was the only problem.

Ruben.


Originally posted by Ruben Alves with karma: 1038 on 2017-11-28

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by Femer on 2017-11-28:
Awesome! That was it! Thanks for spotting this!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.