构建OpenCV时CMake的问题

时间:2011-09-18 12:49:39

标签: gcc image-processing opencv cmake

我正在尝试在最小的VPS上构建最新版本的OpenCV但是遇到了CMake的麻烦。我不熟悉CMake所以我发现很难解释日志输出,因此如何继续调试问题。

从命令行(未安装x11)和devel / OpenCV / -2.3.1 / release中发出以下内容

sudo cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. 

,结果如下:

-- Extracting svn version, please wait...
-- SVNVERSION: exported
-- Detected version of GNU GCC: 44 (404)
-- Could NOT find ZLIB  (missing:  ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Could NOT find ZLIB  (missing:  ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Could NOT find PNG  (missing:  PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
-- Could NOT find TIFF  (missing:  TIFF_LIBRARY TIFF_INCLUDE_DIR)
-- Could NOT find JPEG  (missing:  JPEG_LIBRARY JPEG_INCLUDE_DIR)
--     Use NumPy headers from: /usr/lib/python2.6/site-packages/numpy-1.6.1-py2.6-linux-i686.egg/numpy/core/include
--     Found Sphinx 0.6.6: /usr/bin/sphinx-build
-- Parsing 'cvconfig.h.cmake'
--
-- General configuration for opencv 2.3.1 =====================================
--
--     Built as dynamic libs?:     YES
--     Compiler:                   /usr/bin/c++
--     C++ flags (Release):          -Wall -pthread -march=i686 -ffunction-sections  -O3 -DNDEBUG  -fomit-frame-pointer -msse -msse2 -mfpmath=387 -DNDEBUG\

--     C++ flags (Debug):            -Wall -pthread -march=i686 -ffunction-sections  -g  -O0 -DDEBUG -D_DEBUG -ggdb3
--     Linker flags (Release):
--     Linker flags (Debug):
--
--   GUI:
--     GTK+ 2.x:                   NO
--     GThread:                    NO
--
--   Media I/O:
--     ZLib:                       build
--     JPEG:                       build
--     PNG:                        build
--     TIFF:                       build
--     JPEG 2000:                  FALSE
--     OpenEXR:                    NO
--     OpenNI:                     NO
--     OpenNI PrimeSensor Modules: NO
--     XIMEA:                      NO
--
--   Video I/O:
--     DC1394 1.x:                 NO
--     DC1394 2.x:                 NO
--     FFMPEG:                     NO
--       codec:                    NO
--       format:                   NO
--       util:                     NO
--       swscale:                  NO
--       gentoo-style:             NO
--     GStreamer:                  NO
--     UniCap:                     NO
--     PvAPI:                      NO
--     V4L/V4L2:                   FALSE/FALSE
--     Xine:                       NO
--
--   Other third-party libraries:
--     Use IPP:                    NO
--     Use TBB:                    NO
--     Use ThreadingFramework:     NO
--     Use Cuda:                   NO
--     Use Eigen:                  NO
--
--   Interfaces:
--     Python:                     NO
--     Python interpreter:         /usr/bin/python2.6 -B (ver 2.6)
--     Python numpy:               YES
--     Java:                       NO
--
--   Documentation:
--     Sphinx:                     /usr/bin/sphinx-build (ver 0.6.6)
--     PdfLaTeX compiler:          NO
--     Build Documentation:        NO
--
--   Tests and samples:
--     Tests:                      YES
--     Examples:                   NO
--
--   Install path:                 /usr/local
--
--   cvconfig.h is in:             /home/ec2-user/OpenCV-2.3.1/release
-- -----------------------------------------------------------------
--
-- Configuring incomplete, errors occurred!

此外,当我运行该命令时,我似乎也收到以下错误消息     CMakeLists.txt上的CMake错误:44(set_property):     给定无效范围CACHE的set_property。有效范围是GLOBAL,     目录,目标,来源,测试。

第42-45行如下:

set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
if(DEFINED CMAKE_BUILD_TYPE)
    set_property( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} )
endif()

但是我不确定这意味着什么? aNyone有什么指针吗?

非常感谢

2 个答案:

答案 0 :(得分:3)

检查您的CMake版本。在{2.8}中实施了对set_property(CACHE ... )的支持。

如果升级CMake不是您的选择 - 我想对第44行进行评论是安全的。它似乎用于为GUI中的下拉列表创建值。

http://www.kitware.com/blog/home/post/82

http://blog.bethcodes.com/cmake-tips-tricks-drop-down-list

答案 1 :(得分:0)

我在构建opencv时遇到了很多错误,这些错误是由错误的OpenCV版本引起的。我使用cmake 3.0成功构建了opencv 3.0(虽然cmake 2.6对我不起作用)。然后,当我发现我必须降级到opencv 2.4.9时,我不得不回到我系统的默认cmake 2.6,因为cmake 3.0不起作用。在opencv中运行cmake时,首先检查是否出现错误是该版本。