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

Matlab-ROS Communication with ipc_bridge_ros

asked 2012-05-04 03:53:40 -0600

mikemodanoxxx gravatar image

Hi there,

i just installed ROS fuerte (ubuntu 11.10 32bit) and now i am trying to establish a connection between matlab and ros. I found this tutorial. Is there a better way to get it working? It was the only solution i found in the web. I started the tutorial and it worked well until point 7. I can't compile the message folders. The first one seems to work, but the second gives me a long error list. Is anyone familiar with the ipc_bridge? Here is the terminal output from the "roscd ipc_std_msgs && make" command:

bash -c "mkdir -p bin" bash -c "rospack find ipc_bridge/ ." Generating std_msgs_Bool.h mex -I./include -I/home/simon/ros_workspace/ipc_msgs/ipc_roslib/include -I/home/simon/ros_workspace/ipc_bridge_stack/ipc_bridge_matlab/include -I/home/simon/ros_workspace/ipc_bridge_stack/ipc_bridge/include -I/home/simon/ros_workspace/ipc_bridge_stack/ipc/include -I/home/simon/ros_workspace/ipc_bridge_stack/ipc_bridge/include -lstdc++ -L/home/simon/ros_workspace/ipc_bridge_stack/ipc/lib -lipc mex/ -output bin/std_msgs_Bool

Warning: You are using gcc version "4.6.1-9ubuntu3)". The version currently supported with MEX is "4.4.6". For a list of currently supported compilers see:

g++ -I./include -I/home/simon/ros_workspace/ipc_msgs/ipc_roslib/include -I/home/simon/ros_workspace/ipc_bridge_stack/ipc_bridge_ros/include -I/opt/ros/fuerte/include -I/home/simon/ros_workspace/ipc_bridge_stack/ipc/include -I/home/simon/ros_workspace/ipc_bridge_stack/ipc_bridge/include -I/home/simon/ros_workspace/ipc_bridge_stack/ipc_bridge/include -lstdc++ -L/home/simon/ros_workspace/ipc_bridge_stack/ipc/lib -lipc -L/opt/ros/fuerte/lib -lroscpp -lrostime -lrosconsole -lroscpp_serialization -lxmlrpcpp ros/ -o bin/std_msgs_Bool_publisher /tmp/cc4DJBiO.o: In function main': undefined reference toros::init(int&, char, std::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&, unsigned int)' undefined reference to ros::NodeHandle::NodeHandle(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)' undefined reference toros::this_node::getName()' undefined reference to ros::console::g_initialized' undefined reference toros::console::initialize()' undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ros::console::levels::Level)' undefined reference toros::console::setLogLocationLevel(ros::console::LogLocation, ros::console::levels::Level)' undefined reference to ros::console::checkLogLocationEnabled(ros::console::LogLocation*)' undefined reference toros::this_node::getName()' undefined reference to ros::console::print(ros::console::FilterBase*, log4cxx::Logger*, ros::console::levels::Level, char const*, int, char const*, char const*, ...)' undefined reference ... (more)

edit retag flag offensive close merge delete

4 Answers

Sort by » oldest newest most voted

answered 2012-05-05 05:30:23 -0600

sj haque gravatar image

I just went through same problem recently, the solution is pretty long.

  1. you have to install older version of GCC (4.0 or 4.1 or 4.2) in your system. I could not install it through Apt-get so had to manulay install it after downloading the setup. (I am using Ubuntu 10.04)
  2. Update in the symbolic links of Matlab ( user/.matlab/(MatlabVersion)/ from "gcc" to version u installed, (eg: "gcc" to "gcc-4.1").
  3. Next problem I faced which you will also face probably. will be error in matlab while compiling " GLIBCxx_3.4.9 not found". problem:ipc_bridge is expecting the above version of libstdc++, but matlab refers to the libstdc++ version which was shipped with itself. Solution:
    • check if is present in "usr/lib/". If not then install the package
    • Update the "LDPATH_PREFIX" variable in file (MATLABINSTALLATIONPATH/bin/ for OPENGL to point to "usr/lib/"
    • Still Matlab will try to override the pointer to its own libstdc++. So remove all c++ and g++ related files from (MatlabInstallation/sys/os/glnx86). So Matlab has no choice but to use the library you installed. (may cause a bit of unstability in matlab)

PS:Backup Every file you edit or Remove.

edit flag offensive delete link more

answered 2012-08-26 12:10:21 -0600

Gus gravatar image

I had the exact same problem while using ROS Fuerte in Ubuntu 12.04, and MATLAB 2012a. You don’t need to roll back to an earlier version of Ubuntu the problem is in the the gcc and g++ symbolic links. On my Ubuntu 12.04 I had two versions so I changed the symbolic links in /usr/bin to the 4.4 versions by navigation to the directory and using the following code:

ln -s g++ g++-4.4 ln -s gcc gcc-4.4

I also changes the symbolic links to MATLAB's as shown in the answer at the link below:

Everything compiled fine and I was able to run the MATLAB publisher and subscriber tutorials at:

edit flag offensive delete link more

answered 2012-11-08 03:28:26 -0600

FTrommsdorff gravatar image

updated 2012-11-08 03:29:26 -0600

There is another way: using (I guess) any UNIX-system, you can force Matlab to use any installed gcc version (which is possible, because there can exist more than one installed version of gcc). This worked for me (of course adopting all paths and gcc-version to your required settings):

edit flag offensive delete link more

answered 2012-05-12 07:42:53 -0600

mikemodanoxxx gravatar image

Thanks i switched to ubuntu 10.04 and had to compile gcc-4.2 by myself (i didn't find any packages to install it, where did you get it from btw?) and now it works. I hope there will be a better solution soon. I will continue trying to get it work with newer ubuntu versions and without the old gcc-compiler..

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2012-05-04 03:53:40 -0600

Seen: 688 times

Last updated: Nov 08 '12