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

ROS OpenCV linker error

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

davheld gravatar image

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

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/ 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 ->

lrwxrwxrwx 1 root root 26 2011-11-13 09:20 ->

-rw-r--r-- 1 root root 372344 2011-11-11 00:12

I also have $LD_LIBRARY_PATH set as follows



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/ -l/usr/lib/ -l/usr/lib/ -l/usr/lib/ -l/usr/lib/ -l/usr/lib/ -l/usr/lib/ -l/usr/lib/ -l/usr/lib/ -l/usr/lib/ -l/usr/lib/

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.


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

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

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


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

Question Tools


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

Seen: 870 times

Last updated: Nov 13 '11