I am trying to build opencv with cmake and am running into issues.
I have downloaded the Windows opencv 2.3.1 to C:/Users/chris/opencv. I open up the CMake GUI (2.8.5 version of CMake) and put the source directory as C:/Users/chris/opencv/modules and the "Where to build the binaries" at C:/temp/opencv_binaries
I hit Configure and chose Visual Studio 2010. I then hit Configure again and get the following error output:
CMake Error at calib3d/CMakeLists.txt:1 (define_opencv_module):
Unknown CMake command "define_opencv_module".
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 2.8)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
Configuring incomplete, errors occurred!
What gives? What should I do to fix this?
Unless it has changed recently, the source directory should be C:/Users/chris/opencv/ - it will be the highest-level directory with a CMakeLists.txt file in it.
This warning is for project developers. Use -Wno-dev to suppress it.
To turn -Wno-dev on you just need to select Options -> Suppress dev Warnings (-Wno-dev) in the menu of CMake GUI.
what is the content of your CMakeLists.txt file?
for avoiding the warning, insert "cmake_minimum_required(VERSION 2.8)" into the first line of your CMakeLists.txt
Related
I'm trying to install a program on Mac terminal, but I've been stuck on this step: "cmake -DCMAKE_BUILD_TYPE=Release .. && make"
This is the error I initially got:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
GMP_LIBRARY
linked by target "ipknot" in directory /Users/samuellee/Downloads/ipknot-master
LTDL_LIBRARY
linked by target "ipknot" in directory /Users/samuellee/Downloads/ipknot-master
MPFR_LIBRARY
linked by target "ipknot" in directory /Users/samuellee/Downloads/ipknot-master
CMake Warning at CMakeLists.txt:77 (target_link_libraries):
Target "ipknot" requests linking to directory "/usr/local/lib". Targets
may link only to libraries. CMake is dropping the item.
CMake Warning at CMakeLists.txt:77 (target_link_libraries):
Target "ipknot" requests linking to directory
"/Library/gurobi1001/macos_universal01/macos_universal2/lib". Targets may link only to
libraries. CMake is dropping the item.
CMake Warning at CMakeLists.txt:77 (target_link_libraries):
Target "ipknot" requests linking to directory
"/Library/gurobi1001/macos_universal2/lib". Targets may link only to
libraries. CMake is dropping the item.
I found GMP_LIBRARY and MPFR_LIBRARY but I can't find LTDL_LIBRARY anywhere on my laptop nor on the internet. Any help?
P.S. I tried finding it in /usr but nothing came up. I also tried installing libtool (even though my friend said that it should already be installed by default). Nothing came up.
I'm trying to compile a project with CMake. I'm getting an error:
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:
C:/Users/Ghenja/AppData/Local/opencv/build/OpenCVConfig.cmake
but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
NOT FOUND.
I don't understand what is happening. Please help me to solve this problem.
Clean your project and remove CMakeCache.txt. OpenCV_FOUND is probably cached now.
If that doesn't work, then run your cmake command with additional flags just to be sure:
cmake -DOpenCV_FOUND:BOOL=ON -DOpenCV_DIR=/path/to/your/OpenCV
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
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.
I am compiling a dependency for a project on Ubuntu 10.10, and instead of having it install to /usr/local by default, I am instead installing it to /tmp/stage/usr/local. How do I go about informing CMake of the location of this custom installed dependency when I call it to generate the build files for said project.
I am running CMake 2.8.1, and I have tried to set CMAKE_PREFIX_PATH on the cmake command line, like so
cmake -D CMAKE_PREFIX_PATH=/tmp/stage/usr/local
but this doesn't seem to make a difference - the project doesn't seem to detect the dependency.
Also, if it matters, the project in question is OpenCV 2.2, and the dependency in question is FFMPEG...
I figured out how to fix my problem, and trying to point CMake at the appropriate install location isn't the issue.
Apparently, CMake is unable to find the pkg-config files for FFMPEG (i.e. libavcodec.pc, libavdevice.pc, etc.) that tell it where the FFMPEG headers and libraries are located. In a typical install scenario, these files would be located at /usr/lib/pkgconfig. However because of the custom install location, they are instead located at /tmp/stage/usr/local/lib/pkgconfig.
So that CMake could find these files, I had to add the following environment variable:
export PKG_CONFIG_PATH=/tmp/stage/usr/local/lib/pkgconfig
After which point, OpenCV built against FFMPEG as expected.