0
$\begingroup$

Rosanswers logo

Hi, I'm using ubuntu 13.04 an I have created a package using catkin_create_pkg tutorial_opencv image_transport roscpp std_msgs opencv2 cv_bridge uvc_camera.There is c++ program in my package called DisplayImage.The pkg is in my catkin workspace .When I built it I had an error
CMake Error at /opt/ros/hydro/share/catkin/cmake/catkinConfig.cmake:72 (find_package):
Could not find a package configuration file provided by "opencv2" with any
of the following names:
opencv2Config.cmake
opencv2-config.cmake
I included in the CMakelist.txt

" FIND_PACKAGE(OpenCV REQUIRED)
include_directories( ${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
add_executable( DisplayImage DisplayImage.cpp )
TARGET_LINK_LIBRARIES(DisplayImage ${OpenCV_LIBS}<br> ${catkin_LIBRARIES})"

Here is the full content of my **CMakelist.txt** plus the output of "**VERBOSE=1 catkin_make -j1** " https://gist.github.com/Leyonce/9731649 I am supposing the problem has to do with the fact that thoses files don't exsit in the opencv2 package and In my utmost arrogant opinion they don't exist at all.What I see is the **OpenCvConfig.cmake** file and the **OpenCVConfig-version.cmake** file in the OPENCV directory which is supposed to be a library. Can anyone help?

Originally posted by Leyonce on ROS Answers with karma: 97 on 2014-03-21

Post score: 0


Original comments

Comment by demmeln on 2014-03-23:
the link to the gist is dead

Comment by Leyonce on 2014-03-23:
I've made a new one.Thanks for your patience.I'm really grateful.

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Hi there,

OpenCV is no longer packed inside ROS, instead now it is a system dependency. I guess that the information on the tutorials that you mention is outdated. You should remove all references to opencv2 in your CMakeList.txt.

The correct way to link your node to opencv is by adding the following to CMakeList.txt :

find_package(OpenCV REQUIRED)
add_executable(my_cool_node src/my_cool_node.cpp)
target_link_libraries(my_cool_node ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})

I hope this helps you.


Originally posted by Martin Peris with karma: 5625 on 2014-03-30

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Leyonce on 2014-03-30:
@Martin, Thanks.Could you point me to the where I can find the updated info?

Comment by Martin Peris on 2014-03-31:
Hi Leonce, I am glad the answer was useful. You can find the updated information here: http://wiki.ros.org/vision_opencv

Comment by Leyonce on 2014-04-01:
Thanks @Martin but I think there's an error in the link,the page doesn't exist yet.

Comment by Martin Peris on 2014-04-01:
Sorry, I don't know why there was a "</p>" attached to the end of the link... just remove it and you should be fine

$\endgroup$
0
$\begingroup$

Rosanswers logo

Did you add an executable or library called my_target? If not, having a statement like target_link_libraries(my_target ${OpenCV_LIBRARIES}) does not make sense. This seems to be your cmake error.

I would be best if you edit your question to provide the full contents of your CMakeLists.txt and the full output of VERBOSE=1 catkin_make -j1 (don't use rosmake with a catkin package).

Edit:

For sure the following line should be removed: https://gist.github.com/Leyonce/9731649#file-cmakelist-L11

And it would be good to move line https://gist.github.com/Leyonce/9731649#file-cmakelist-L9 to around line 105 to keep things in order.

You are not building any executables or libraries. What is your package supposed to build?


Originally posted by demmeln with karma: 4306 on 2014-03-22

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by Leyonce on 2014-03-23:
yes I thought so too but I was just following the tutorials.I don't know yet how to add that library.

Comment by demmeln on 2014-03-23:
If you need any further help, please edit your question to provide the information I asked for. Thanks

Comment by demmeln on 2014-03-23:
If it is lengthy, put the files/output on pastebin.com or gist.github.com and post the links.

Comment by Leyonce on 2014-03-23:
?? Well I haven't placed any .cpp file in my src file. I sought to build the tutorial_opencv package i guess.

Comment by demmeln on 2014-03-28:
Ok, do the changes and the package should build. But since it is an empty package not much will happen when you build it. What is your goal with this package?

Comment by Leyonce on 2014-03-30:
Thanks.I've done the changes.That solved the problem due to the target library but not that due to the package configuration files.The package did not build.

$\endgroup$

Your Answer

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