Ask Your Question
0

cmake linking error OpenCV_FOUND to FALSE UBUNTU 13.04

asked 2014-06-16 05:40:27 -0600

luisruiz gravatar image

updated 2014-06-24 23:39:00 -0600

Hello,

I was following the tutorials, but then I noticed that I was using the ROS OpenCV installation instead of the local OpenCV which was installed manually. After a long web search I managed to use the local version. I am using OpenCV 2.4.9 which is OK. If I run:

python
import cv2
print cv2.__version__

I get:

2.4.9

I was getting 2.4.6 I have a code in a folder, to build it I am using cmake. The CMakeLists file is:

cmake_minimum_required(VERSION 2.8)
project( Tutorials ) to 
find_package( OpenCV REQUIRED )

add_executable( bin/findContours_demo src/findContours_demo.cpp )
target_link_libraries( bin/findContours_demo ${OpenCV_LIBS} )

file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/bin)

Which was working fine. Now with OpenCV 2.4.9 installed from source, when I execute cmake I get this:

  CMake Warning at /usr/local/opencv-2.4.9/cmake/OpenCVConfig.cmake:161 (message):
  Found OpenCV Windows Pack but it has not binaries compatible with your
  configuration.

   You should manually point CMake variable OpenCV_DIR to your build of OpenCV
  library.
Call Stack (most recent call first):
  CMakeLists.txt:3 (find_package)


CMake Error at CMakeLists.txt:3 (find_package):
  Found package configuration file:

    /usr/local/opencv-2.4.9/cmake/OpenCVConfig.cmake

  but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
  NOT FOUND.


-- Configuring incomplete, errors occurred!

I alredy went back to the ROS OpenCV and I can get it done, but if I change to 2.4.9 from source I get the same error. I am using UBUNTU 13.04 with ROS hydro. Is this error telling me I am using Windows??? I already search the web but the solutions posted are for Windows. I think something is broken with my cmake but I have no idea what is it.

Thanks.

EDIT 1

I already tried everything I could possibly imagine but nothing happens, I am still getting the same error. Has somebody tried to do this and got it done? Using ROS with the OpenCV from source?

EDIT 2

The problem was not the OpenCV installation, but the cmake instruction. It did not have the rules to find the OpenCV package, what I did was:

Get OpenCV from source.

Unzip it, I am doing it in /usr/local, so I have /usr/local/opencv-2.4.9.

In /usr/local/opencv-2.4.9 do:

sudo mkdir build
cd build

Compile OpenCV, e.g. I am using this cmake instruction:

sudo cmake -D BUILD_DOCS=ON -D WITH_QT=ON -D WITH_XINE=ON -D WITH_OPENGL=ON -D WITH_TBB=ON -D WITH_OPENNI=ON -D BUILD_EXAMPLES=ON -D WITH_OPENCL=ON -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/opencv-2.4.9 ..
sudo make
sudo make install

Add to the file /etc/ld.so.conf:

/usr/local/opencv-2.4.9/lib

Then:

sudo ldconfig

Add the paths to OpenCV to your .bashrc, for me was:

source /opt/ros/hydro/setup.bash
CMAKE_PREFIX_PATH=/usr/local/opencv-2.4.9:$CMAKE_PREFIX_PATH
CPATH=/usr/local/opencv-2.4.9/include:$CPATH
LD_LIBRARY_PATH=/usr/local/opencv-2.4.9/lib:$LD_LIBRARY_PATH ...
(more)
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2014-11-03 20:31:05 -0600

alealv gravatar image

Hi, I'm having exactly the same error, but I have opencv-2.4.10


-- OpenCV ARCH: -- OpenCV RUNTIME: -- OpenCV STATIC: OFF CMake Warning at /usr/local/opencv-2.4.10/cmake/OpenCVConfig.cmake:161 (message): Found OpenCV Windows Pack but it has not binaries compatible with your configuration.

You should manually point CMake variable OpenCV_DIR to your build of OpenCV library. Call Stack (most recent call first): CMakeLists.txt:9 (find_package)

CMake Error at CMakeLists.txt:9 (find_package): Found package configuration file:

/usr/local/opencv-2.4.10/cmake/OpenCVConfig.cmake

but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be NOT FOUND.

-- Configuring incomplete, errors occurred!`


But creating the FindOpenCV.cmake it's not working for me. When I include it I get:


`-- OpenCV ARCH: -- OpenCV RUNTIME: -- OpenCV STATIC: OFF CMake Warning at /usr/local/opencv-2.4.10/cmake/OpenCVConfig.cmake:161 (message): Found OpenCV Windows Pack but it has not binaries compatible with your configuration.

You should manually point CMake variable OpenCV_DIR to your build of OpenCV library. Call Stack (most recent call first): /usr/share/cmake-2.8/Modules/FindOpenCV.cmake:103 (include) CMakeLists.txt:9 (find_package)

CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message): Could NOT find OpenCV (missing: OpenCV_LIBS) Call Stack (most recent call first): /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-2.8/Modules/FindOpenCV.cmake:297 (find_package_handle_standard_args) CMakeLists.txt:9 (find_package)

-- Configuring incomplete, errors occurred!`


Even though I get

$ pkg-config --libs opencv/usr/local/opencv-2.4.10/lib/libopencv_calib3d.so /usr/local/opencv-2.4.10/lib/libopencv_contrib.so /usr/local/opencv-2.4.10/lib/libopencv_core.so /usr/local/opencv-2.4.10/lib/libopencv_features2d.so /usr/local/opencv-2.4.10/lib/libopencv_flann.so /usr/local/opencv-2.4.10/lib/libopencv_gpu.so /usr/local/opencv-2.4.10/lib/libopencv_highgui.so /usr/local/opencv-2.4.10/lib/libopencv_imgproc.so /usr/local/opencv-2.4.10/lib/libopencv_legacy.so /usr/local/opencv-2.4.10/lib/libopencv_ml.so /usr/local/opencv-2.4.10/lib/libopencv_nonfree.so /usr/local/opencv-2.4.10/lib/libopencv_objdetect.so /usr/local/opencv-2.4.10/lib/libopencv_ocl.so /usr/local/opencv-2.4.10/lib/libopencv_photo.so /usr/local/opencv-2.4.10/lib/libopencv_stitching.so /usr/local/opencv-2.4.10/lib/libopencv_superres.so /usr/local/opencv-2.4.10/lib/libopencv_ts.a /usr/local/opencv-2.4.10/lib/libopencv_video.so /usr/local/opencv-2.4.10/lib/libopencv_videostab.so /usr/local/opencv-2.4.10/lib/libopencv_viz.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGLU.so -ltbb -lrt -lpthread -lm -ldl

and

$ pkg-config --cflags opencv -I/usr/local/opencv-2.4.10/include/opencv -I/usr/local/opencv-2.4.10/include

Does anyone knows what it's happening?

edit flag offensive delete link more

Comments

This was posted a long time ago, but I was having the same issue and I figured I'd post how I fixed it. For me it was just an outdated build directory. Remove your build directory and try again. You will also need to set your OpenCV_DIR, ie. set (OpenCV_DIR /home/skymeson/opencv/build) in your CMakeLists.txt file before find_package is called.

skymeson gravatar imageskymeson ( 2016-03-14 12:19:51 -0600 )edit

Question Tools

Stats

Asked: 2014-06-16 05:40:27 -0600

Seen: 15,101 times

Last updated: Nov 03 '14