0
$\begingroup$

Rosanswers logo

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!


Originally posted by davheld on ROS Answers with karma: 3 on 2011-11-13

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Mac with karma: 4119 on 2011-11-13

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Mac on 2011-11-13:
It did. Everything turns green, as you may have noticed.

Comment by davheld on 2011-11-13:
OK I tried to accept your answer - did it work? (Thanks again!)

Comment by Mac on 2011-11-13:
That does seem strange. Go ahead and accept my answer, please. (Karma!)

Comment by davheld on 2011-11-13:
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?

$\endgroup$

Your Answer

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