build立OpenCV作为静态库

也许我错过了一些东西,但我无法构buildopencv静态库

build立:

Kubuntu 12.04

gcc 4.6.3

使3.81

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上build立包/ libs的新手。 我确定有些事我做错了,但我不知道是什么。 另外我不想使用dynamic库…

谢谢你的帮助!

编辑删除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 

我仍然看到构build为dynamic库?:是的 ,它告诉我,它不关心BUILD_SHARED_LIBRARIESvariables!

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

BUILD_SHARED_LIBRARIES应该是BUILD_SHARED_LIBSBUILD_PYTHON_SUPPORT应该是BUILD_opencv_python