8

也许我遗漏了一些东西,但我无法构建 opencv 的静态库。

设置:

库本图 12.04

海合会 4.6.3

制作 3.81

cmake 2.8.7

opencv 2.4.6.1(现场最后可用)

我手动完成所有工作。我尝试使用 cmake-gui 没有更多成功。

我按照它写的去做。

$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D WITH_QT=ON -D BUILD_SHARED_LIBRARIES=OFF ..

(我也尝试使用 BUILD_SHARED_LIBRARIES=NO)

我得到的是(例如核心):

  • libopencv_core.so
  • libopencv_core.so.2.4
  • libopencv_core.so.2.4.6
  • libopencv_core_pch_dephelp.a

说实话,我期待libopencv_core.a

我是在 Linux 上构建包/库的新手。我确定我做错了什么,但我不知道是什么。另外我不想使用动态库...

谢谢你的帮助!

编辑删除了 cmake 命令行中 -D ... 之间的空格

Result:

-- General configuration for OpenCV 2.4.6.1 =====================================
--   Version control:               unknown
-- 
--   Platform:
--     Host:                        Linux 3.2.0-51-generic x86_64
--     CMake:                       2.8.7
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
-- 
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/c++  (ver 4.6)
--     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG -ggdb3
--     C Compiler:                  /usr/bin/gcc
--     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG -ggdb3
--     Linker flags (Release):      
--     Linker flags (Debug):        
--     Precompiled headers:         YES
-- 
--   OpenCV modules:
--     To be built:                 core imgproc flann highgui features2d calib3d ml video objdetect contrib photo legacy gpu nonfree java python stitching superres ts videostab

...

-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_PYTHON_SUPPORT
    BUILD_SHARED_LIBRARIES

我仍然看到Built as dynamic libs?: YES并且它告诉我它不关心BUILD_SHARED_LIBRARIES变量!

4

1 回答 1

16

查看OpenCV 的 CMakeLists.txt,看起来好像您为 OpenCV CMake 选项使用了错误的名称。

BUILD_SHARED_LIBRARIES应该是BUILD_SHARED_LIBS而且BUILD_PYTHON_SUPPORT应该是BUILD_opencv_python

于 2013-08-14T02:55:57.963 回答