Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cmake linking error OpenCV_FOUND to FALSE UBUNTU 13.04

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.

cmake linking error OpenCV_FOUND to FALSE UBUNTU 13.04

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

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?

cmake linking error OpenCV_FOUND to FALSE UBUNTU 13.04

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.

EDITEDIT 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
PATH=/usr/local/opencv-2.4.9/bin:$PATH
PKG_CONFIG_PATH=/usr/local/opencv-2.4.9/lib/pkgconfig:$PKG_CONFIG_PATH
PYTHONPATH=/usr/local/opencv-2.4.9/lib/python2.7/dist-packages:$PYTHONPATH

Notice that the ROS installation is sourced BEFORE the OpenCV, if you followed the ROS tutorials you must have that line in your .bashrc, then add the OpenCV paths from source to the environment variables, put them in the FIRST PLACE, so the compiler find them first. Check if you are using ROS from source:

pkg-config --cflags opencv

The output is:

-I/usr/local/opencv-2.4.9/include/opencv -I/usr/local/opencv-2.4.9/include

And finally:

python
import cv2
print cv2.__version__
quit()

The output is:

Python 2.7.4 (default, Sep 26 2013, 03:20:26) 
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> print cv2.__version__
2.4.9
>>> quit()

ROS will tell is using OpenCV 2.4.6, if you type:

rosversion opencv2

The output is:

2.4.6

But it is actually pointing to 2.4.9, what I want!!. At this point OpenCV is compiled, and you can use it in a Makefile, but cmake cannot find it. The problem is that the file FindOpenCV.cmake is missing. I copied it from here:

FindOpenCV.cmake

Save it as /usr/share/cmake-2.8/Modules/FindOpenCV.cmake. You might need to remove the leading characters, they are just numbers:

sudo vi /usr/share/cmake-2.8/Modules/FindOpenCV.cmake

Inside the file type:

:%s/^.\{6}//

Look for the following lines and comment them, they were giving me problems:

  #string (REGEX REPLACE ".*#define CV_MAJOR_VERSION[ \t]+([0-9]+).*" "\\1" OpenCV_VERSION_MAJOR ${OpenCV_VERSIONS_TMP})
  #string (REGEX REPLACE ".*#define CV_MINOR_VERSION[ \t]+([0-9]+).*" "\\1" OpenCV_VERSION_MINOR ${OpenCV_VERSIONS_TMP})
  #string (REGEX REPLACE ".*#define CV_SUBMINOR_VERSION[ \t]+([0-9]+).*" "\\1" OpenCV_VERSION_PATCH ${OpenCV_VERSIONS_TMP})

And after those lines, put this:

  set (OpenCV_VERSION_MAJOR "2")
  set (OpenCV_VERSION_MINOR "4")
  set (OpenCV_VERSION_PATCH "9")

Which is the OpenCV version from source.

And that's all :). That worked for me. I can use ROS with OpenCV from source using catkin_make.