Ask Your Question
2

OpenCV linker errors in ROS Fuerte

asked 2012-04-19 08:06:01 -0500

updated 2014-01-28 17:12:01 -0500

ngrennan gravatar image

I am trying to compile and test our packages from tu-darmstadt-ros-pkg with the upcoming ROS Fuerte from the official package repositories with Ubuntu Oneiric (amd64). Whenever a package is built which depends indirectly from OpenCV, I got strange linker errors about undefined references for OpenCV functions.

In this case I am trying to compile the object_tracker package, which depends from image_geometry, which uses OpenCV. This is the output from make VERBOSE=1:

Linking CXX executable ../../bin/object_tracker
cd /opt/hector/external/tu-darmstadt-ros-pkg/hector_worldmodel/object_tracker/build/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/object_tracker.dir/link.txt --verbose=1
/usr/lib/ccache/c++   -m64  -O2 -g    -Wl,-rpath,/opt/ros/fuerte/stacks/geometry/tf/lib -I/opt/ros/fuerte/stacks/geometry/tf/msg_gen/cpp/include -I/opt/ros/fuerte/stacks/geometry/tf/srv_gen/cpp/include -Wl,-rpath,/opt/ros/fuerte/stacks/bullet/lib -Wl,-rpath,/opt/ros/fuerte/stacks/geometry/tf_conversions/lib -Wl,-rpath,/opt/ros/fuerte/stacks/orocos_kinematics_dynamics/orocos_kdl/install_dir/lib /opt/ros/fuerte/lib/libopencv_calib3d.so /opt/ros/fuerte/lib/libopencv_contrib.so /opt/ros/fuerte/lib/libopencv_core.so /opt/ros/fuerte/lib/libopencv_features2d.so /opt/ros/fuerte/lib/libopencv_flann.so /opt/ros/fuerte/lib/libopencv_gpu.so /opt/ros/fuerte/lib/libopencv_highgui.so /opt/ros/fuerte/lib/libopencv_imgproc.so /opt/ros/fuerte/lib/libopencv_legacy.so /opt/ros/fuerte/lib/libopencv_ml.so /opt/ros/fuerte/lib/libopencv_objdetect.so /opt/ros/fuerte/lib/libopencv_stitching.so /opt/ros/fuerte/lib/libopencv_ts.so /opt/ros/fuerte/lib/libopencv_video.so -Wl,-rpath,/opt/ros/fuerte/stacks/vision_opencv/image_geometry/lib /opt/ros/fuerte/lib/libopencv_calib3d.so /opt/ros/fuerte/lib/libopencv_contrib.so /opt/ros/fuerte/lib/libopencv_core.so /opt/ros/fuerte/lib/libopencv_features2d.so /opt/ros/fuerte/lib/libopencv_flann.so /opt/ros/fuerte/lib/libopencv_gpu.so /opt/ros/fuerte/lib/libopencv_highgui.so /opt/ros/fuerte/lib/libopencv_imgproc.so /opt/ros/fuerte/lib/libopencv_legacy.so /opt/ros/fuerte/lib/libopencv_ml.so /opt/ros/fuerte/lib/libopencv_objdetect.so /opt/ros/fuerte/lib/libopencv_stitching.so /opt/ros/fuerte/lib/libopencv_ts.so /opt/ros/fuerte/lib/libopencv_video.so -I/opt/hector/external/tu-darmstadt-ros-pkg/hector_worldmodel/worldmodel_msgs/msg_gen/cpp/include -I/opt/hector/external/tu-darmstadt-ros-pkg/hector_worldmodel/worldmodel_msgs/srv_gen/cpp/include -I/opt/hector/external/tu-darmstadt-ros-pkg/hector_slam/hector_nav_msgs/srv_gen/cpp/include -pthread CMakeFiles/object_tracker.dir/object_tracker.o CMakeFiles/object_tracker.dir/Object.o CMakeFiles/object_tracker.dir/ObjectModel.o  -o ../../bin/object_tracker -rdynamic -L/opt/ros/fuerte/lib -L/opt/ros/fuerte/stacks/geometry/tf/lib -L/opt/ros/fuerte/stacks/bullet/lib -L/opt/ros/fuerte/stacks/geometry/tf_conversions/lib -L/opt/ros/fuerte/stacks/orocos_kinematics_dynamics/orocos_kdl/install_dir/lib -L/opt/ros/fuerte/stacks/vision_opencv/image_geometry/lib -ltf -lboost_thread-mt -lBulletDynamics -lBulletCollision -lLinearMath -lsensor_msgs -lmessage_filters -lroscpp -lrostime -lrosconsole -lroscpp_serialization -lxmlrpcpp -ltf_conversions -lorocos-kdl -limage_geometry -Wl,-rpath,/opt/ros/fuerte/lib:/opt/ros/fuerte/stacks/geometry/tf/lib:/opt/ros/fuerte/stacks/bullet/lib:/opt/ros/fuerte/stacks/geometry/tf_conversions/lib:/opt/ros/fuerte/stacks/orocos_kinematics_dynamics/orocos_kdl/install_dir/lib:/opt/ros/fuerte/stacks/vision_opencv/image_geometry/lib 
/usr/bin/ld: CMakeFiles/object_tracker.dir/object_tracker.o: undefined reference to ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2012-05-05 18:57:23 -0500

Kei Okada gravatar image

I thinks this is due to miss configuration of opencv.pc. I created the patch and file a ticket https://code.ros.org/trac/ros-pkg/ticket/5437

edit flag offensive delete link more

Comments

sorry this is an incorrect answer, see the ticket.

Kei Okada gravatar imageKei Okada ( 2012-05-07 17:15:14 -0500 )edit

I think the solution is perfectly valid. At least it solves my problem for now. Thanks for figuring that out.

Johannes Meyer gravatar imageJohannes Meyer ( 2012-05-07 21:26:23 -0500 )edit
0

answered 2012-06-19 06:02:41 -0500

nailgg gravatar image

Try adding cxcore to your libraries.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-04-19 08:06:01 -0500

Seen: 1,435 times

Last updated: Jun 19 '12