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

Groovy + OpenCV 2.4.7 WITH_CUDA

asked 2014-01-27 02:07:48 -0600

DiJuMx gravatar image

updated 2014-01-28 17:06:34 -0600

ngrennan gravatar image

I've built OpenCV 2.4.7 with CUDA support and tried to link it to my package. When I run my node, I get this error error.

OpenCV Error: No GPU support (The library is compiled without CUDA support) in mallocPitch, file /tmp/buildd/ros-groovy-opencv2-2.4.6-1precise-20131020-2316/modules/core/src/gpumat.cpp, line 879 terminate called after throwing an instance of 'cv::Exception' what():  /tmp/buildd/ros-groovy-opencv2-2.4.6-1precise-20131020-2316/modules/core/src/gpumat.cpp:879: error: (-216) The library is compiled without CUDA support in function mallocPitch

When I compile, I get the following errors:

runtime library [libopencv_videostab.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib
runtime library [libopencv_video.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib
runtime library [libopencv_superres.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib
runtime library [libopencv_stitching.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib
runtime library [libopencv_photo.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib
runtime library [libopencv_objdetect.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib
runtime library [libopencv_nonfree.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib
runtime library [libopencv_ml.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib
runtime library [libopencv_legacy.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib
runtime library [libopencv_imgproc.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib
runtime library [libopencv_highgui.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib
runtime library [libopencv_gpu.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib
runtime library [libopencv_flann.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib
runtime library [libopencv_features2d.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib
runtime library [libopencv_core.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib
runtime library [libopencv_contrib.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib
runtime library [libopencv_calib3d.so.2.4] in /usr/local/lib may be hidden by files in:
  /opt/ros/groovy/lib

My CMakeLists.txt file is as follows:

cmake_minimum_required(VERSION 2.8.3)
project(objectdetect)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED 
    COMPONENTS 
    roscpp
    message_generation
    cv_bridge
    sensor_msgs
    std_msgs
    )
#Find opencv packages 
find_package(OpenCV 2.4.7 REQUIRED)

#Find the CUDA packages
find_package(CUDA REQUIRED)
#Fix for error messages ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-01-27 02:14:16 -0600

bchr gravatar image

updated 2014-01-27 03:46:37 -0600

You have a problem similar to this one: http://answers.ros.org/question/32284/cmakelist-find_package-opencv-svn or even this one http://answers.ros.org/question/47249/problem-with-using-opencv_gpu-inside-ros

Try to export OpenCV_DIR to your local installation of OpenCV. More details are available in the answer to the first similar question and in the documentation of find_package.

Having both OpenCV versions installed can lead to clashes between libraries. You can try to update your LD_LIBRARY_PATH/PKG_CONFIG_PATH (if the scripts rely on pkg-config) accordingly, i.e. something like:

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

You may also need to set CMAKE_LIBRARY_PATH="/usr/local/lib" for CMake.

If you just need OpenCV with CUDA support for ROS, you can recompile the package with CUDA support activated.

edit flag offensive delete link more

Comments

Unfortunately exporting CMAKE_PREFIX_PATH and OpenCV_DIR seems to fix the compile errors but not the runtime errors. It's still looking for groovy libs.

DiJuMx gravatar image DiJuMx  ( 2014-01-27 02:37:05 -0600 )edit

For the runtime error, add the directory to LD_LIBRARY_PATH before the ROS directory. It basically stops at the first correct library it finds (in your case, the one in /opt/ros/groovy/lib must appear first in LD_LIBRARY_PATH).

bchr gravatar image bchr  ( 2014-01-27 02:54:19 -0600 )edit

I have /usr/local/lib first in LD_LIBRARY_PATH and it's still giving me runtime errors.

DiJuMx gravatar image DiJuMx  ( 2014-01-27 03:07:18 -0600 )edit

Is the only reason for you to use this second OpenCV the CUDA support? It may be smarter to just use the ROS one that you recompile with CUDA support (-DWITH_CUDA=ON).

bchr gravatar image bchr  ( 2014-01-27 03:13:52 -0600 )edit

That's right. However, I consider rebuilding ROS a last resort as I'm on a University Computer. I'm more concerned with why catkin is linking to ROS libraries rather than the libraries specified.

DiJuMx gravatar image DiJuMx  ( 2014-01-27 03:23:15 -0600 )edit

Can you try with: export CMAKE_PREFIX_PATH=/usr/local:$CMAKE_PREFIX_PATH ? (cf. second answer I linked)

bchr gravatar image bchr  ( 2014-01-27 03:24:48 -0600 )edit

It's already in my .bashrc ... do you want it before or after the Lines where I source my setup.bash files?

DiJuMx gravatar image DiJuMx  ( 2014-01-27 03:27:48 -0600 )edit

The problem with catkin/CMake is that it tends to hide errors when trying to link with other libraries. I had a lot of problems when linking with Ogre 1.8 on a system with Ogre 1.9 installed. CMAKE_LIBRARY_PATH + PKG_CONFIG_PATH + LD_LIBRARY_PATH seemed to do the trick for all possible scenarios.

bchr gravatar image bchr  ( 2014-01-27 03:42:43 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-01-27 02:07:48 -0600

Seen: 2,038 times

Last updated: Jan 27 '14