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

opencv pkg-config configuration problem in ubuntu with fuerte

asked 2012-07-17 03:26:53 -0500

updated 2012-07-17 22:40:17 -0500

After ros-fuerte installation in ubuntu 12.04, I am having problems to compile my opencv programs.
I am getting the following results:

/usr/bin/ld: cannot find -lopencv_nonfree
/usr/bin/ld: cannot find -lopencv_photo
/usr/bin/ld: cannot find -lopencv_stitching
/usr/bin/ld: cannot find -lopencv_ts
/usr/bin/ld: cannot find -lopencv_videostab

I realised that ros-fuerte packages for ubuntu changes default pkg-config configuration file for opencv library, pointing to the files in the ros installation.

# 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
  • Why is ros changing the default opencv configuration for compilation?
  • Can't just use a different pkg-config configuration file such as ros-opencv.pc?
  • And, in case the default configuration must be changed, why it is not compatible with previous opencv configurations?

Update

I have found the problem. The setup.sh script of ros-fuerte updates the variable that uses pkg-config to find the configuration files

PKG_CONFIG_PATH=/opt/ros/fuerte/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH

Now pkg-config gives preference to ROS configuration.

So the answer now is: Is this really needed to be in the setup.sh script?

Maybe rosmake can set this variable when using pkg-config to configure the compilation.

edit retag flag offensive close merge delete

Comments

Have you installed ros-feurte-vision-opencv using apt-get?

Mani gravatar image Mani  ( 2012-07-17 07:09:18 -0500 )edit

Yes. I installed all ros fuerte using apt-get system.

Pablo Urcola gravatar image Pablo Urcola  ( 2012-07-17 22:34:01 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2012-12-13 09:31:28 -0500

BeLioN gravatar image

When pkg-config has to find your package, it looks for the right paths in the PKG_CONFIG_PATH variable. And the order of the paths in this variable actually matters. If you do:

export PKG_CONFIG_PATH=/opt/ros/fuerte/lib/pkgconfig:$PKG_CONFIG_PATH

You are giving priority to the packages of ROS, because it is found first in the list of paths.

You can use the same to override the ROS package and use the standalone OpenCV. After sourcing the file /opt/ros/fuerte/setup.sh you can add the path to the standalone OpenCV installation (note that I add the path in the left side of the variable):

export PKG_CONFIG_PATH=$HOME/bin/opencv/lib/pkgconfig/:${PKG_CONFIG_PATH}

If you want to change to ROS packages, just source /opt/ros/fuerte/setup.sh again.

edit flag offensive delete link more
0

answered 2014-03-14 04:51:34 -0500

Latif Anjum gravatar image

so what is the solution?

I have these lines

PKG_CONFIG_PATH=/opt/ros/fuerte/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH

already in my fuerte setup.sh file but it still cannot find opencv packages. Should I delete them?

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2012-07-17 03:26:53 -0500

Seen: 4,492 times

Last updated: Mar 14 '14