构建 OpenCV 时的 CMake 问题

发布于 2024-12-05 02:44:49 字数 3803 浏览 0 评论 0原文

我正在尝试在足够小的 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): set_property 给定的范围 CACHE 无效。有效范围是 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()

但是我不确定这意味着什么?有没有人指点一下?

非常感谢

I'm trying to build the most recent version of OpenCV on a minimal enough VPS but am running into trouble with CMake. I'm not familiar with CMake so I'm finding it difficult to interpret the log output and thus how to proceed to debug the problem.

From the command line (x11 isn't installed) and within devel/OpenCV/-2.3.1/release I issue the following

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

and the result of this is the following:

-- 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!

Also when I run the command I also seem to be getting the following error message
CMake Error at CMakeLists.txt:44 (set_property):
set_property given invalid scope CACHE. Valid scopes are GLOBAL,
DIRECTORY, TARGET, SOURCE, TEST.

Line 42-45 is the following:

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()

However I'm not sure what this means? Does aNyone have any pointers?

Many thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

背叛残局 2024-12-12 02:44:49

检查您的 CMake 版本。 2.8.0 中实现了对 set_property(CACHE ... ) 的支持。

如果升级 CMake 不适合您 - 我想注释第 44 行是安全的。它似乎用于在 GUI 中为下拉列表创建值。

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

http://blog.bethcodes.com/cmake-tips-tricks-drop -下拉列表

Check your CMake version. Support for set_property(CACHE ... ) was implemented in 2.8.0.

If upgrading CMake is not an option for you - I guess it's safe to comment line #44. It seems to be used to create values for drop-down list in GUI.

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

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

执着的年纪 2024-12-12 02:44:49

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

I've experienced lots of error building opencv that were caused by the wrong version of OpenCV. I successfully built opencv 3.0 using cmake 3.0 (though cmake 2.6 did not work for me). Then when I found I had to downgrade to opencv 2.4.9 I had to go back to my system's default cmake 2.6, as cmake 3.0 did not work. The first thing to check if you get errors when running cmake in opencv is the version.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文