Rqt plugin C++ undefined symbol
Hi everyone, i'm having trouble in making my own rqt plugin in c++. I want to write a plugin that subscribes to /odom topic. With the odometry data, i want to draw the trajectory of the robot with Qwt. I made the code, did the catkin_make and everything worked fine. Nevertheless when I open rqt and try to launch the plugin, i get the following error :
[ERROR] [1459848732.059769566]: Failed to load nodelet [odom_plugin/OdomPlugin_1] of type [odom_plugin/OdomPlugin]: Failed to load library /local/etienne/ros/catkin_ws/devel/lib//libodom_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 = /local/etienne/ros/catkin_ws/devel/lib//libodom_plugin.so: undefined symbol: _ZTVN11odom_plugin10OdomPluginE)
RosPluginlibPluginProvider::load_explicit_type(odom_plugin/OdomPlugin) failed creating instance PluginManager._load_plugin() could not load plugin "odom_plugin/OdomPlugin": RosPluginlibPluginProvider.load() could not load plugin "odom_plugin/OdomPlugin"
I know this is exactly the same error, of very similar to this topic : http://answers.ros.org/question/206363/rqt-plugin-undefined-symbol/ But i didn't understand how the man solved his problem.
I only have a header and source file, i give you links of the file just above :
header : http://textuploader.com/5wo0z
source : http://textuploader.com/5wo0w
plugin.xml : http://textuploader.com/5wo03
package.xml : http://textuploader.com/5wok5
CMakeLists.txt : http://textuploader.com/5wok0
I really don't know here to look, so if someone could point me on my error or give me a track it would be really nice. Thank you in advance!
Asked by etienne1234 on 2016-04-05 09:27:07 UTC
Answers
I'm having segmentation fault.
I commented everything in my .cpp and just left myWidget = new QWidget() in the initPlugin(). The plugin is shown in RQT, but when i select it it says segmentation fault and crashes. If i remove this line it works (no crash/segmentation fault)
Does this mean that my Qt libraries are not linked correctly ? I'm trying to build with Qt5, so i changed the corresponding lines in the CMakeLists.txt
EDIT : i tried with Qt4 in the Cmake and there is no more segmentation fault. Could someone help me to find the equivalent commands in CMake for Qt5 if it is possible ? Now it is working with everything, but i get the following error :
/usr/bin/python: symbol lookup error: /local/etienne/ros/catkin_ws/devel/lib//libodom_plugin.so: undefined symbol: _ZN7QwtPlotC1EP7QWidget
So i guess Qwt isnt linked correctly too, i'm new to Cmake so if you could help me. Thanks
EDIT : I was linking a Qwt version manually compiled with ... Qt5 so ofc it was failing, now i'm using a Qwt version compatible with Qt4 and it's working fine.
Seems like my problem is solved, thanks for your hints!
Asked by etienne1234 on 2016-04-08 09:47:59 UTC
Comments
RQT uses QT4, and you cannot mix different version of QT in the same executable. You'll need to use QT4 for your plugin.
(There has been some discussion of migrating rqt to use QT5 for the Kinetic release of ROS, but that has not been finalized).
Asked by ahendrix on 2016-04-08 17:53:23 UTC
Comments
The decision to use Qt 5 for Kinetic has been finalized about a month ago: http://lists.ros.org/pipermail/ros-users/2016-March/069876.html
Asked by Dirk Thomas on 2016-04-12 12:26:50 UTC
That's some useful information, i'm still on ros Indigo though, so i can use only Qt4 right ? If i migrate to ros Kinetic it's Qt5 compatible now ?
Asked by etienne1234 on 2016-04-13 04:11:48 UTC
Comments
Suggestions: put the project on github so it is easy to download. You could fork https://github.com/lucasw/rqt_mypkg/tree/master/rqt_example_cpp and adapt your code into it. Or avoid C++ rqt entirely, draw the path and publish it as an Image and view it in rqt_image_view.
Asked by lucasw on 2016-04-05 11:00:51 UTC
This is still experimental, but it may be a viable alternative to building your own plugin: https://github.com/ros-visualization/rqt_common_plugins/pull/360
Asked by ahendrix on 2016-04-05 12:36:17 UTC
Git repository for the project : https://github.com/etienne1234/odom_plugin @lucasw i'm gonna try to rebuild with your template, your other option of publishing it might be interesting, but i'm gonna have to do others RQT c++ plugin so ... @ahendrix I kinda need RQT because of existing plugins
Asked by etienne1234 on 2016-04-08 05:06:30 UTC
i'll tell you how it goes, i'm re-working on this subject today
Asked by etienne1234 on 2016-04-08 05:06:58 UTC
@etienne1234: the package I linked to is an experimental RQT plugin which plots two different topics on the X and Y axes, much like what you're describing. Still RQT, still allows you to use the other existing RQT plugins.
Asked by ahendrix on 2016-04-08 17:55:08 UTC