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

ld: cannot find -lsensor_msgs (ROS fuerte on ubuntu12.04)

asked 2012-06-29 03:32:03 -0500

cduguet gravatar image

updated 2014-04-20 14:09:32 -0500

ngrennan gravatar image


I have not idea what have happened, but trying to solve another problem (out of the scope of this question, but related to that cvOpticalFlowPyrLK could not be found on cv::) suddenly, when compiling i find this problem :

Linking CXX executable bin/Optical_Flow
/usr/bin/cmake -E cmake_link_script CMakeFiles/Optical_Flow.dir/link.txt --verbose=1
/usr/bin/c++   -O2 -g    -Wl,-rpath,/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/lib -Wl,-rpath,/opt/ros/fuerte/stacks/image_common/image_transport/lib -Wl,-rpath,/opt/ros/fuerte/stacks/pluginlib/lib -Wl,-rpath,/opt/ros/fuerte/stacks/image_common/camera_info_manager/lib -Wl,-rpath,/opt/ros/fuerte/stacks/image_common/camera_calibration_parsers/lib -Wl,-rpath,/opt/ros/fuerte/stacks/geometry/tf/lib -Wl,-rpath,/opt/ros/fuerte/stacks/bullet/lib -pthread CMakeFiles/Optical_Flow.dir/src/Optical_Flow.o  -o bin/Optical_Flow -rdynamic -L/opt/ros/fuerte/lib -L/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/lib -L/opt/ros/fuerte/stacks/image_common/image_transport/lib -L/opt/ros/fuerte/stacks/pluginlib/lib -L/opt/ros/fuerte/stacks/image_common/camera_info_manager/lib -L/opt/ros/fuerte/stacks/image_common/camera_calibration_parsers/lib -L/opt/ros/fuerte/stacks/geometry/tf/lib -L/opt/ros/fuerte/stacks/bullet/lib -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_ts -lopencv_video -lopencv_videostab -lcv_bridge -lsensor_msgs -limage_transport -lpoco_lite -lboost_fs_wrapper -ltinyxml -lroslib -lmessage_filters -lroscpp -lrostime -lrosconsole -lroscpp_serialization -lxmlrpcpp -lcamera_info_manager -lcamera_calibration_parsers -ltf -lboost_thread-mt -lBulletDynamics -lBulletCollision -lLinearMath -Wl,-rpath,/opt/ros/fuerte/lib:/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/lib:/opt/ros/fuerte/stacks/image_common/image_transport/lib:/opt/ros/fuerte/stacks/pluginlib/lib:/opt/ros/fuerte/stacks/image_common/camera_info_manager/lib:/opt/ros/fuerte/stacks/image_common/camera_calibration_parsers/lib:/opt/ros/fuerte/stacks/geometry/tf/lib:/opt/ros/fuerte/stacks/bullet/lib 
/usr/bin/ld: cannot find -lsensor_msgs
make[2]: Leaving directory `/home/dlr/ros_workspace/OpticalFlow'
collect2: ld returned 1 exit status
make[1]: Leaving directory `/home/dlr/ros_workspace/OpticalFlow'
make[2]: *** [bin/Optical_Flow] Error 1
make[1]: *** [CMakeFiles/Optical_Flow.dir/all] Error 2
make: *** [all] Error 2

I have no idea what could have happened, since it was compiling before with the exact same code. The only thing that comes to my mind it could have bee, is that I reinstalled the repos packages ros-fuerte-* . Still, my previously installed ROS is also the repos one, and I was using it almost out of the box.

In .bashrc I have:

source /opt/ros/fuerte/setup.bash
source /home/dlr/ros_workspace/setup.bash
export ROS_PACKAGE_PATH=~/ros_workspace:/opt/ros/fuerte/stacks:/opt/ros/fuerte/share:/opt/ros/fuerte/share/ros
export ROS_WORKSPACE=~/ros_workspace
export EDITOR='gedit'

in my manifest I have :

  <depend package="sensor_msgs"/>

But in /opt/ros/fuerte/lib:

$ ls *sensor*
ls: cannot access *sensor*: No such file or directory

Can somebody give me hints how to track this problem?? Thank you

edit retag flag offensive close merge delete


Just a comment on your .bashrc: it looks like you set up an overlay in ~/ros_workspace using rosinstall or rosws. If that is true, it might be better to remove the two export lines and manage the ROS_PACKAGE_PATH completely using rosws. Maybe you'll have to add OpticalFlow using rosws though.

Lorenz gravatar image Lorenz  ( 2012-06-29 03:39:54 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2012-06-29 03:34:23 -0500

Lorenz gravatar image

updated 2012-06-29 04:44:20 -0500

Since message serializers/deserializers in c++ are completely defined in header files, the corresponding (empty) libraries were removed in the most recent update. Howerver, the cmake build system didn't catch that. Just do a make clean in ~/dlr/ros_workspace/OpticalFlow and make again. To be sure to really update all packages, including dependencies, you can also use rosmake --pre-clean. This will execute make clean in each dependency before rosmaking.

edit flag offensive delete link more

answered 2012-06-29 07:05:09 -0500

cduguet gravatar image

Thank you! now it compiles.

edit flag offensive delete link more

Question Tools


Asked: 2012-06-29 03:32:03 -0500

Seen: 876 times

Last updated: Jun 29 '12