也许我错过了一些东西,但我无法构建opencv的静态库。
设置:
Kubuntu 12.04
gcc 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.a 。
我是在Linux上构建package / libs的新手。我确定我做错了但我不知道是什么。我也不想使用动态库......
感谢您的帮助!
编辑删除了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_SHARED_LIBRARIES 变量!
答案 0 :(得分:16)
查看OpenCV's CMakeLists.txt,好像您使用的是OpenCV CMake选项的错误名称。
BUILD_SHARED_LIBRARIES
应为BUILD_SHARED_LIBS
而BUILD_PYTHON_SUPPORT
应为BUILD_opencv_python