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

ROS OpenCV linker error

asked 2011-11-13 06:21:16 -0500

davheld gravatar image

updated 2011-11-13 06:29:49 -0500

I am trying to compile a program I have that uses opencv, and I get the following error:

--> Making UTIL -- Linking popup.o to popup (C++) /usr/bin/ld: cannot find -l/usr/lib/libopencv_contrib.so.2.3.1 collect2: ld returned 1 exit status make[2]: * [popup] Error 1 make[1]: [binaries] Error 255 make: ** [all] Error 2

However, I do seem to have the necessary files:

/usr/lib$ ls -l

lrwxrwxrwx 1 root root 24 2011-11-13 09:20 libopencv_contrib.so -> libopencv_contrib.so.2.3

lrwxrwxrwx 1 root root 26 2011-11-13 09:20 libopencv_contrib.so.2.3 -> libopencv_contrib.so.2.3.1

-rw-r--r-- 1 root root 372344 2011-11-11 00:12 libopencv_contrib.so.2.3.1

I also have $LD_LIBRARY_PATH set as follows

$echo $LD_LIBRARY_PATH

/usr/lib

The library is being searched for because I am trying to link to opencv2, in which the manifest at /opt/ros/electric/stacks/vision_opencv/opencv2/manifest.xml has:

<\export> <\cpp cflags="pkg-config opencv-2.3.1 --cflags" lflags="pkg-config opencv-2.3.1 --libs"/>

And this command returns: $pkg-config opencv-2.3.1 --libs

-l/usr/lib/libopencv_contrib.so.2.3.1 -l/usr/lib/libopencv_legacy.so.2.3.1 -l/usr/lib/libopencv_objdetect.so.2.3.1 -l/usr/lib/libopencv_calib3d.so.2.3.1 -l/usr/lib/libopencv_features2d.so.2.3.1 -l/usr/lib/libopencv_video.so.2.3.1 -l/usr/lib/libopencv_highgui.so.2.3.1 -l/usr/lib/libopencv_ml.so.2.3.1 -l/usr/lib/libopencv_imgproc.so.2.3.1 -l/usr/lib/libopencv_flann.so.2.3.1 -l/usr/lib/libopencv_core.so.2.3.1

I am using Ubuntu 10.04.3 LTS (Lucid). I also just switched from diamondback to electric, which was installed using "sudo apt-get install ros-electric-desktop-full".

Any advice would be appreciated. If this is not the appropriate place to ask this question, I apologize, and please direct me to the appropriate place. Also, if I have not provided sufficient information or explained my question in enough detail, please let me know what additional information I can provide.

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2011-11-13 07:52:04 -0500

Mac gravatar image

In electric, opencv has become a third-party dependency. Try using

<rosdep name="opencv2.3"/>

in your manifest.xml, rather than a <depend package=... line.

Then use rosmake --rosdep-install to make sure everything's there.

edit flag offensive delete link more

Comments

That seems to have fixed it - thanks so much! I'm still curious though why the linker could not find "/usr/lib/libopencv_contrib.so.2.3.1 " when that file clearly exists in that directory. Any idea?
davheld gravatar image davheld  ( 2011-11-13 08:51:14 -0500 )edit
That does seem strange. Go ahead and accept my answer, please. (Karma!)
Mac gravatar image Mac  ( 2011-11-13 09:12:43 -0500 )edit
OK I tried to accept your answer - did it work? (Thanks again!)
davheld gravatar image davheld  ( 2011-11-13 09:14:37 -0500 )edit
It did. Everything turns green, as you may have noticed.
Mac gravatar image Mac  ( 2011-11-13 09:15:00 -0500 )edit

Question Tools

Stats

Asked: 2011-11-13 06:21:16 -0500

Seen: 876 times

Last updated: Nov 13 '11