Rosanswers logo


I am starting to use nodelets in my image processing pipeline, and I am having trouble loading nodelets. I am using the freenect_stack package as a sample to get started. Whether I use the nodelet loader in c++, a launch file, or command line arguments, the loader refuses to create the nodelets. I am using ROS Hydro, that I compiled from source on Ubuntu 14.04.2 LTS.

I would appreciate any help or troubleshooting steps.

Thanks, Daniel

This is the error, whether I use the command line, roslaunch, or the loader library in c++. The command line and roslaunch also say "service call failed":

Failed to load nodelet [/face_foo] of type [face_provider/face_finder]: MultiLibraryClassLoader: Could not create object of class type face_provider::face_finder as no factory exists for it. Make sure that the library exists and was explicitly loaded through MultiLibraryClassLoader::loadLibrary()

This is the exported face_provider.xml file.

<library path="lib/libface_provider_nodelets">
<class name="face_provider/face_finder" type="face_provider::face_finder" base_class_type="nodelet::Nodelet">
        Finds faces in images, publishes center.
<class name="face_provider/face_recognition" type="face_provider::Recognizer" base_class_type="nodelet::Nodelet"><description>
        Identifies faces in images, publishes ID.

If I look under the ~/catkin_ws/devel/lib directory, I find the "libface_provider_nodelets.so" file, and inspecting it shows that there that looks like it loads my nodelets. This is the code I am using to load the plugins:

#include <ros/ros.h>
#include <nodelet/loader.h>

int main(int arc, char **argv) {
    ros::init(arc, argv, "face_provider_node");
    nodelet::Loader manager(true);
    //nodelet::M_string remap(ros::names::getRemappings());
    nodelet::M_string remap;
    nodelet::V_string nargv;
    std::string nodelet_name = ros::this_node::getName();
    manager.load(nodelet_name, "face_provider/face_finder", remap, nargv);
    //manager.load(nodelet_name, "face_provider/face_recognition", remap, nargv);

My pluginlib macros look like this:

PLUGINLIB_DECLARE_CLASS(face_provider, face_finder, face_provider::face_finder, nodelet::Nodelet);
//where the namespace is face_provider, the header file is face_finder.h, and the class name is face_finder, I was trying different class names, please excuse my syntax. 


PLUGINLIB_DECLARE_CLASS(face_provider, face_recognition, face_provider::Recognizer, nodelet::Nodelet);
//where the namespace is face_provider, the header file is face_recognition.h, and the class name is Recognizer

EDIT: So I am going back and rewriting this from scratch (as opposed to copying code from my nodes), and I notice that once I include the opencv, imagetransport, and cv_bridge headers, the problem arises. The error code was different, complaining that it couldn't find the library path using some_path/lib//libface_provider_nodelets. Changing my face_provider.xml file changes to "liblibface_provider_nodelets" gives me the familiar "Failed to load nodelet error"


So I backtracked a bit, and took most of the the openCV code out. However, whenever I include the header for the nodelet where I have opencv code, I get

[ERROR] [1437070859.100828548]: Failed to load nodelet [face_recognizer_nodelet] of type [face_provider/Recognizer]: Failed to load library /home/daniel/catkin_ws/devel/lib//libface_provider_nodelets.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/daniel/catkin_ws/devel/lib//libface_provider_nodelets.so: undefined symbol: _ZTVN13face_provider6FinderE)

maybe something is out of date? I'll try a dist upgrade...

Originally posted by daniel_dsouza on ROS Answers with karma: 258 on 2015-07-15

Post score: 1

Original comments

Comment by daniel_dsouza on 2015-07-16:
now if only i could solve the segfaults from creating Publishers, I would be golden...

Program received signal SIGSEGV, Segmentation fault.
0x00007fffec052819 in boost::detail::atomic_increment (pw=0xfffffffffffffff4)
at /usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:66

1 Answer 1


Rosanswers logo

A dist upgrade was not the answer.

It turns out that the undefined symbol was referring to the destructor I had used in my class. After taking out the destructor, my library loaded correctly. A constructor is needed though.

Originally posted by daniel_dsouza with karma: 258 on 2015-07-16

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by lucasw on 2017-07-06:
I just ran into this error message when I was passing a callback to a timer that was in the header but wasn't defined in the cpp - the compilation into a library assumed it would be provided from elsewhere so didn't error out there.


Your Answer

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