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

Matlab libraries causing conflicts / linking errors

asked 2015-03-12 17:50:34 -0600

Neil Traft gravatar image

I have a simple program that demonstrates my error. The following compiles

#include <ros/ros.h>
#include <tf/transform_listener.h>
#include <costmap_2d/costmap_2d_ros.h>

int main(int argc, char **argv) {

    ros::init(argc, argv, "finite_wall_navigate");
    ros::NodeHandle nh("~");

    tf::TransformListener tl(ros::Duration(10));
//  costmap_2d::Costmap2DROS costmap("global_costmap", tl);

    ros::spin();

    return EXIT_SUCCESS;
}

While the following does not (one line uncommented):

#include <ros/ros.h>
#include <tf/transform_listener.h>
#include <costmap_2d/costmap_2d_ros.h>

int main(int argc, char **argv) {

    ros::init(argc, argv, "finite_wall_navigate");
    ros::NodeHandle nh("~");

    tf::TransformListener tl(ros::Duration(10));
    costmap_2d::Costmap2DROS costmap("global_costmap", tl);

    ros::spin();

    return EXIT_SUCCESS;
}

And here is the error:

$  catkin_make
Base path: /home/ntraft/Development/catkin_ws
Source space: /home/ntraft/Development/catkin_ws/src
Build space: /home/ntraft/Development/catkin_ws/build
Devel space: /home/ntraft/Development/catkin_ws/devel
Install space: /home/ntraft/Development/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/ntraft/Development/catkin_ws/build"
####
####
#### Running command: "make -j4 -l4" in "/home/ntraft/Development/catkin_ws/build"
####
Scanning dependencies of target cpptest
[ 33%] [ 66%] Built target finite_wall_navigate
Building CXX object sampled-gradient-path-planning/sgpp/CMakeFiles/cpptest.dir/src/test.cpp.o
[100%] Built target sgpp_planner
Linking CXX executable /home/ntraft/Development/catkin_ws/devel/lib/sgpp/cpptest
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_CTX_new@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSLeay_version@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `RAND_status@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `X509_NAME_entry_count@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `ASN1_TIME_print@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_CTX_set_verify@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `EVP_MD_CTX_copy@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `CRYPTO_num_locks@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_CTX_get_verify_mode@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `EVP_DigestFinal@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_get_wbio@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `BIO_ctrl@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `i2d_X509@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_CIPHER_get_version@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `EVP_MD_CTX_md@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `i2a_ASN1_INTEGER@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_CTX_use_certificate_chain_file@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_get_shutdown@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_CTX_free@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `ERR_get_error@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `CRYPTO_set_locking_callback@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-03-13 03:16:49 -0600

gvdhoorn gravatar image

updated 2015-03-13 03:23:47 -0600

This is likely caused by the fact that Matlab (and any C/C++ you compile with it) is linked against different versions of those shared libraries (especially Boost). This has been an issue in the past (and will always be an issue). If you try to then link ROS nodes to Matlab code, you get version conflicts.

Other users have solved / worked around this by building ROS from source, using the Matlab supplied versions of some system dependencies. See some older - questions - about this.

Just to be complete: perhaps you can use the Robot Operating System (ROS) Support from Robotics System Toolbox from Mathworks?


Edit: the wiki of TU Darmstadt's rosmatlab package seems to have some info on how to get Matlab 2014a and ROS working together (especially the Installation page). I have no idea as to whether that package is still in working order though.

edit flag offensive delete link more

Comments

Thanks for your help. I decided the best thing for my situation would be to completely separate the Matlab nodes from the C++ nodes so that I don't need to use the Matlab C/C++ APIs. It limits the ways I can structure the program, but of course it's less limiting than a program that doesn't compile.

Neil Traft gravatar image Neil Traft  ( 2015-03-14 15:42:13 -0600 )edit

You're right that the new ROS support is extensive, and while my preference is for C++, it is probably possible to port the entire thing to Matlab. I don't have R2015a though, and ROS support is a bit more limited in previous versions. But it's still an option to consider.

Neil Traft gravatar image Neil Traft  ( 2015-03-14 15:45:30 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-03-12 17:50:34 -0600

Seen: 764 times

Last updated: Mar 13 '15