Có thể tôi thiếu một số thứ nhưng tôi không thể xây dựng các thư viện tĩnh của opencv.Xây dựng OpenCV làm thư viện tĩnh
Setup:
Kubuntu 12.04
gcc 4.6.3
làm cho 3,81
cmake 2.8.7
opencv 2.4.6.1 (mới nhất có sẵn trên trang web)
Tôi thực hiện tất cả công việc theo cách thủ công. Tôi đã thử với cmake-gui không thành công hơn.
Tôi làm những gì nó được viết.
$ cmake -D CMAKE_BUILD_TYPE = CHÍ -D CMAKE_INSTALL_PREFIX =/usr/local -D BUILD_PYTHON_SUPPORT = ON -D WITH_QT = ON -D BUILD_SHARED_LIBRARIES = OFF ..
(Tôi cũng đã cố gắng với BUILD_SHARED_LIBRARIES = NO)
Những gì tôi nhận được là (cho lõi ví dụ):
- libopencv_core.so
- libopencv_core.so.2.4
- libopencv_ core.so.2.4.6
- libopencv_core_pch_dephelp.a
Để nói sự thật, tôi mong đợi libopencv_core.a.
Tôi là người mới sử dụng xây dựng gói/libs trên Linux. Tôi chắc rằng có điều gì đó tôi đã làm sai nhưng tôi không biết điều gì. Ngoài ra, tôi không muốn sử dụng thư viện động ...
Cảm ơn sự giúp đỡ của bạn!
EDIT Removed không gian trống giữa -D ... trong cmake dòng lệnh
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
tôi vẫn thấy Được xây dựng như libs động ?: YES và nó cho tôi biết rằng nó không quan tâm đến biến số BUILD_SHARED_LIBRARIES!
Bạn đã thử gọi CMake không gian giữa 'cờ -D' và giá trị của họ? Vì vậy, ví dụ: 'cmake. -DCMAKE_BUILD_TYPE = Phát hành ...-DBUILD_SHARED_LIBRARIES = OFF' – Fraser
Tôi đã thử nó không thành công. Xem ** EDIT ** trong câu hỏi của tôi. –
Ngu ngốc tôi! Đó là ** - DBUILD_SHARED_LIBS = NO **! Không BUILD_SHARED_LIBRARIES ... –