Ask Your Question
0

why do I get an error when building my pakage?

asked 2014-03-21 23:31:15 -0500

Leyonce gravatar image

updated 2014-03-30 12:47:47 -0500

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}
${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?

edit retag flag offensive close merge delete

Comments

the link to the gist is dead

demmeln gravatar image demmeln  ( 2014-03-23 13:46:08 -0500 )edit

I've made a new one.Thanks for your patience.I'm really grateful.

Leyonce gravatar image Leyonce  ( 2014-03-23 13:55:18 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2014-03-30 16:02:41 -0500

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.

edit flag offensive delete link more

Comments

@martin, Thanks.Could you point me to the where I can find the updated info?

Leyonce gravatar image Leyonce  ( 2014-03-30 22:21:14 -0500 )edit

Hi Leonce, I am glad the answer was useful. You can find the updated information here: http://wiki.ros.org/vision_opencv

Martin Peris gravatar image Martin Peris  ( 2014-03-31 15:19:07 -0500 )edit

Thanks @martin but I think there's an error in the link,the page doesn't exist yet.

Leyonce gravatar image Leyonce  ( 2014-04-01 10:50:46 -0500 )edit

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

Martin Peris gravatar image Martin Peris  ( 2014-04-01 14:45:23 -0500 )edit
1

answered 2014-03-22 00:20:35 -0500

demmeln gravatar image

updated 2014-03-23 14:05:00 -0500

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

And it would be good to move line https://gist.github.com/Leyonce/97316... to around line 105 to keep things in order.

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

edit flag offensive delete link more

Comments

yes I thought so too but I was just following the tutorials.I don't know yet how to add that library.

Leyonce gravatar image Leyonce  ( 2014-03-23 12:41:21 -0500 )edit

If you need any further help, please edit your question to provide the information I asked for. Thanks

demmeln gravatar image demmeln  ( 2014-03-23 12:49:17 -0500 )edit

If it is lengthy, put the files/output on pastebin.com or gist.github.com and post the links.

demmeln gravatar image demmeln  ( 2014-03-23 13:02:04 -0500 )edit

?? Well I haven't placed any .cpp file in my src file. I sought to build the tutorial_opencv package i guess.

Leyonce gravatar image Leyonce  ( 2014-03-23 21:32:07 -0500 )edit

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?

demmeln gravatar image demmeln  ( 2014-03-28 01:22:22 -0500 )edit

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.

Leyonce gravatar image Leyonce  ( 2014-03-30 12:49:35 -0500 )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-21 23:31:15 -0500

Seen: 1,195 times

Last updated: Mar 30 '14