CMakeLists cannot find opencv library, although i defined it - opencv

I try using ROS with opencv, but when I 'catkin-make', it gives me this:
CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
fls_package/CMakeLists.txt:10 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/vered/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/vered/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:318: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
with cmake-gui, I defined:
1. CMAKE_PREFIX_PATH = /home/vered/opencv/build (where OpenCVConfig.cmake is)
2. OpenCV_DIR = /usr/local/include/opencv4/opencv2 (where opencv.hpp is)
configured, generated and then sudo make install,
and still when catkin-make, i've got the same problem.
any ideas?

It seems that i tried all the solutions in the site, except this one:
ROS "catkin_make" cannot find OpenCVConfig.cmake
and that's what worked for me...

Related

cannt able to compile bcc

I have tried many times to build bcc with LLVM but always failed.
CMake Error at CMakeLists.txt:99 (find_package):
Could not find a package configuration file provided by "LLVM" with any of
the following names:
LLVMConfig.cmake
llvm-config.cmake
Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
"LLVM_DIR" to a directory containing one of the above files. If "LLVM"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
See also "/root/bcc/build/CMakeFiles/CMakeOutput.log".
See also "/root/bcc/build/CMakeFiles/CMakeError.log".

How do i include opencv into my catkin_workspace?

I am currently having issues with the find_package(opencv) which give me the error message:
-- Could not find the required component 'OpenCV'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
So.. Yeah, a solution would add the prefix_path, but how do i make it work with find_package() without explicitly stating the path it has to look for.. why can't it find it in the first place, the problem by doing this is that the CMakelist is shared amongst a group a people, in which I am the only one having this issue despite, having the .cmake file at the same location..
I am running it on a ubuntu machine.
OpenCV v2.4.8
And the .cmake files are located at
/usr/local/share/OpenCV/OpenCVConfig.cmake
/usr/share/OpenCV/OpenCVConfig.cmake
opencv is installed as sudo apt-get install libopencv-dev

Gtest_main _dir not found while installing libqi for ros-nao

I am trying to install libqi for nao-ros and it gives me error: I already have gtest package but gtest_main is missing.
CMake Error at /home/shruti/d-prefix/share/cmake/qibuild/internal/uselib.cmake:80 (find_package): By not providing "FindGTEST_MAIN.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "GTEST_MAIN", but CMake did not find one.
Could not find a package configuration file provided by "GTEST_MAIN" with any of the following names:
GTEST_MAINConfig.cmake
gtest_main-config.cmake
Add the installation prefix of "GTEST_MAIN" to CMAKE_PREFIX_PATH or set "GTEST_MAIN_DIR" to a directory containing one of the above files. If "GTEST_MAIN" provides a separate development package or SDK, be sure it has been installed.
Any one knows about it?
I had the same problem when trying to build libqi and fixed it by:
cd /usr/share/cmake-3.0/Modules
ln -s FindGTest.cmake FindGTEST_MAIN.cmake

Build errors while following the instructions given on a website

Hi i've tried following the instructions from this website http://robotica.unileon.es/mediawiki/index.php/Objects_recognition_and_position_calculation_(webcam)
At the part where they asked to add this :
find_package(OpenCV "VERSION" REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
...
target_link_libraries("PROGRAM_NAME" ${OpenCV_LIBS})
i added and tried to build the package but it resulted in the errors:
Parse error. Expected a command name, got unquoted argument with text "...".
-- Configuring incomplete, errors occurred!
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
Could any one please help me resolve this error?
This basically describes how you're able to add OpenCV to your own program, if you're actually using CMake.
The text in quotes has to be replaced with your actual values/project names, for example, if my target is called myopencvthing and I'd want to use OpenCV 2.0 or newer, then I'd setup something like this:
# First tell CMake the minimal version of CMake expected
cmake_minimum_required(VERSION 2.8)
# Define a project
project(myopencvproject)
# Tell CMake to look for OpenCV 2.0 (and tell it that it's required, not optional)
find_package(OpenCV 2.0 REQUIRED)
# Tell CMake to add the OpenCV include directory for the preprocessor
include_directories(${OpenCV_INCLUDE_DIRS})
# Add the source files to a variable
set(SOURCES main.cpp processing.cpp somethingelse.cpp)
# Define the actual executable target and the source files
add_executable(myopencvthing ${SOURCES})
# Finally, add the dependencies of our executable (i.e. OpenCV):
target_link_libraries(myopencvthing ${OpenCV_LIBS})
Now you'll just have to run CMake to create your actual makefiles or project files and then build everything, e.g.:
cd /my/build/dir
cmake /path/to/my/source
make
If CMake fails to find the specified dependencies, then you'll have to open the CMakeCache.txt file and edit those paths by hand (or use cmake-gui in case you prefer a more visual editor).
I think you should replace "VERSION" and "PROGRAM_NAME" with the Version number and the program name.
This is
2.4 for VERSION
and
the program name by whatever you named your executable.

Error while building CI2CV using cmake

I am trying to build CI2CV on windows using cmake for the first time. I get below errors while building
"CMake Error at CMakeLists.txt:17 (find_package):Could not find a package configuration file provided by "OpenCV" with any of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set "OpenCV_DIR" to a directory containing one of the above files. If "OpenCV" provides a separate development package or SDK, be sure it has been installed."
Tried to set CMAKE_PREFIX_PATH to location where OpenCVConfig.cmake file resides also tried the same with OpenCV_DIR. But no luck.
Please let me know way out of this.
You need to create a variable OpenCV_DIR and set that to the location where OpenCVConfig.cmake is:
cmake -DOpenCV_DIR:PATH=C:/opencv ..
Add to CMakeLists.txt:
set(OpenCV_DIR THE_PATH)

Resources