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

Linking of created plugins using pluginlib

asked 2017-07-06 00:52:56 -0500

agutenkunst gravatar image

updated 2017-07-06 05:46:54 -0500

Hi,

I have the similiar situation as http://answers.ros.org/question/26493... where I build a plugin where the base class is in another package. I noticed the upon loading the plugin I will get "undefined reference" errors if miss the line:

target_link_libraries(test_plugins ${catkin_LIBRARIES} ${PROJECT_NAME})

However I am still wondering if plugins have to be linked to all the ${catkin_LIBRARIES} of the project.

Does someone know if this is best practice? I noticed that it increases the shared object by factors.

edit retag flag offensive close merge delete

Comments

May I suggest a title change? You're question is really more about linking when creating plugins, but your title does not reflect that at all.

gvdhoorn gravatar image gvdhoorn  ( 2017-07-06 01:41:46 -0500 )edit

You are right. Changed it.

agutenkunst gravatar image agutenkunst  ( 2017-07-06 05:47:23 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-07-06 01:44:36 -0500

gvdhoorn gravatar image

Yes, you'll need to link against whatever your plugin needs, as the future host of your plugin (which could be anything) does not (and cannot) 'know' what dependencies a plugin might have.

Symbols needed by dynamic libraries are resolved at run-/load time by the loader, and if something can't be found, you'll run into the undefined reference errors you mention.

You could potentially save some bytes by verifying which symbols your potential host(s) already have access to, but that will probably be quite involved, and in the end will make your plugin rather brittle: if the host(s) ever change their dependencies (ie: the libraries they load), your plugin will have a problem.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-07-06 00:52:56 -0500

Seen: 506 times

Last updated: Jul 06 '17