Ask Your Question
1

ros-fuerte cannot find opencv package

asked 2014-03-14 05:05:59 -0600

Latif Anjum gravatar image

Hi there,

I have installed ros-fuerte-desktop-full. I am trying to built a package that contains opencv code, but I am getting the following error:

Cannot specify link libraries for target "MatObjects" which is not built by this project.

I have added following to CMakeLists.txt

FIND_PACKAGE( OpenCV REQUIRED )
target_link_libraries(MatObjects ${OpenCV_LIBS})

Here is the output of some flags:

#echo $PKG_CONFIG_PATH
/opt/ros/fuerte/lib/pkgconfig

This path contains opencv.pc

#pkg-config --cflags opencv
-I/opt/ros/fuerte/include/opencv -I/opt/ros/fuerte/include

#pkg-config --libs opencv
-L/opt/ros/fuerte/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

I have also tried to run the code on Geany using g++ with pkg-config --cflags opencv but it says Package opencv was not found in the pkg-config search path when it is there.

Please help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2014-03-14 06:51:20 -0600

Wolf gravatar image

With rosmake, unlike catkin, you typically do not have to find_package and target_link_libraries opencv yourself. The only thing you have to do for developing against OpenCV with ros fuerte and rosbuild is to add a depend package to your manifest.xml:

  <depend package="opencv2"/>

Add this to your manifest.xml, remove

FIND_PACKAGE( OpenCV REQUIRED )
target_link_libraries(MatObjects ${OpenCV_LIBS})

from CMakeLists.txt, and tell me if it worked;)

edit flag offensive delete link more

Comments

I'm in agreement

aparraga gravatar imageaparraga ( 2014-03-14 08:04:48 -0600 )edit

Thanks sir. It worked. I am a bit surprised. I had ros-fuerte installed (before I refreshed ubuntu and installed fuerte again) and my previous method (linking libraries in CMakeLists.txt) was working. Has it changed recently?

Latif Anjum gravatar imageLatif Anjum ( 2014-03-14 10:36:07 -0600 )edit

I also use PCL libraries, so now I have to do the same for PCL libraries too? Previously, I was linking PCL libraries in CMakeLists.txt too and it was working.

Latif Anjum gravatar imageLatif Anjum ( 2014-03-14 10:36:32 -0600 )edit

One more thing: I use Geany and give build command: g++ "%f" `pkg-config --cflags --libs opencv` -o "%e". Previously it was working but not now. It says opencv.pc is not in the PKG_CONFIG path. I checked the path and opencv.pc is there. Any clue?

Latif Anjum gravatar imageLatif Anjum ( 2014-03-14 10:39:05 -0600 )edit

Geany Error: Package opencv was not found in the pkg-config search path. Perhaps you should add the directory containing `opencv.pc' to the PKG_CONFIG_PATH environment variable No package 'opencv' found

Latif Anjum gravatar imageLatif Anjum ( 2014-03-14 10:41:17 -0600 )edit

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: 2014-03-14 05:05:59 -0600

Seen: 448 times

Last updated: Mar 14 '14