0
$\begingroup$

Rosanswers logo

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.0: undefined reference to `SSLeay@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `X509_NAME_ENTRY_get_object@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `TLSv1_method@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_new@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_load_error_strings@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `ASN1_STRING_data@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_get_current_cipher@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_get_error@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `EVP_get_digestbyname@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `X509_NAME_get_entry@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_set_accept_state@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_write@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `BIO_s_file@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `EVP_MD_CTX_cleanup@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `CRYPTO_free@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `X509V3_EXT_get@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_set_connect_state@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `X509_get_ext@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `RAND_add@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `X509_free@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `ASN1_item_d2i@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_CTX_load_verify_locations@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `ASN1_STRING_length@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_CTX_use_PrivateKey_file@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_CIPHER_get_name@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_do_handshake@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `ERR_peek_last_error@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `sk_num@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `X509_get_serialNumber@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_free@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_ctrl@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `ASN1_STRING_to_UTF8@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `ERR_clear_error@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `RAND_egd@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `X509_get_issuer_name@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_get_rbio@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `EVP_DigestUpdate@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_set_fd@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_CIPHER_get_bits@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `OpenSSL_add_all_digests@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `BIO_s_mem@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_read@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_set_read_ahead@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `PEM_read_bio_X509_AUX@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `GENERAL_NAME_free@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `ASN1_INTEGER_get@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `X509_NAME_oneline@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `OBJ_obj2txt@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_CTX_ctrl@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `EVP_DigestInit@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `GENERAL_NAME_print@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `X509_get_ext_by_NID@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_pending@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `ERR_get_state@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSLv3_method@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSLv23_method@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `BIO_new@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `OPENSSL_add_all_algorithms_noconf@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_library_init@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `X509_get_subject_name@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `ERR_error_string@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_CTX_set_cipher_list@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `X509_NAME_ENTRY_get_data@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `EVP_MD_size@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `sk_value@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `sk_pop_free@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `CRYPTO_set_id_callback@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `BIO_gets@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_shutdown@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `BIO_free@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `SSL_get_peer_certificate@OPENSSL_1.0.0'
/usr/lib/libpython2.7.so.1.0: undefined reference to `EVP_MD_block_size@OPENSSL_1.0.0'
collect2: ld returned 1 exit status
make[2]: *** [/home/ntraft/Development/catkin_ws/devel/lib/sgpp/cpptest] Error 1
make[1]: *** [sampled-gradient-path-planning/sgpp/CMakeFiles/cpptest.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed

This simplified example doesn't use Matlab, but my actual program does require the Matlab C libraries and this is what's causing the trouble. Concretely, this compiles:

add_executable(cpptest src/test.cpp)
target_link_libraries(cpptest ${catkin_LIBRARIES})

but this doesn't:

add_executable(cpptest src/test.cpp)
target_link_libraries(cpptest ${catkin_LIBRARIES} ${MATLAB_LIBRARIES})

Where the value of MATLAB_LIBRARIES is:

/usr/local/MATLAB/R2014a/bin/glnxa64/libmex.so;/usr/local/MATLAB/R2014a/bin/glnxa64/libmx.so;/usr/local/MATLAB/R2014a/bin/glnxa64/libeng.so

libmx.so requires many dynamic libraries and Matlab ships with custom versions of these libraries. One of these libraries is libssl.so.1.0.0; another is Boost. Normally, on a successful compile (without Matlab) it would link up like this:

$  ldd devel/lib/sgpp/cpptest | grep ssl
        libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f015012c000)

I'm still pretty new to C++ so I have no idea where to begin solving this. Thanks for your help.


Originally posted by Neil Traft on ROS Answers with karma: 205 on 2015-03-12

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by gvdhoorn with karma: 86574 on 2015-03-13

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Neil Traft on 2015-03-14:
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.

Comment by Neil Traft on 2015-03-14:
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.

$\endgroup$

Your Answer

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