64 ビットの OpenCV ライブラリをコンパイルしようとしているときに問題が発生しました。これは私がこれまでに行ったことです:
- svnを使ってソースコードを取得
opencv
私はそのmkdir build
時cd build
cmake -G "Unix Makefiles" -D CMAKE_OSX_ARCHITECTURES=x86_64 -D CMAKE_C_FLAGS=-m64 -D CMAKE_CXX_FLAGS=-m64 ..
これにより、出力(以下)が残りますが、多くのパッケージが見つからないため、心配です。この投稿OSX Snow Leopard での EmguCV の構築WITH_CUDA
で提案されているように、フラグを無効にしようとしましたが、役に立たないようです。
-- Extracting svn version, please wait...
-- SVNVERSION: svn:9029
-- checking for module 'libdc1394-2'
-- package 'libdc1394-2' not found
-- checking for module 'libdc1394'
-- package 'libdc1394' not found
-- checking for module 'libavcodec'
-- package 'libavcodec' not found
-- checking for module 'libavformat'
-- package 'libavformat' not found
-- checking for module 'libavutil'
-- package 'libavutil' not found
-- checking for module 'libswscale'
-- package 'libswscale' not found
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - not found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named sphinx
--
-- General configuration for OpenCV 2.4.9 =====================================
-- Version control: svn:9029
--
-- Platform:
-- Host: Darwin 11.4.0 i386
-- CMake: 2.8.8
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: Release
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ Compiler: /usr/bin/c++
-- C++ flags (Release): -m64 -O3 -DNDEBUG
-- C++ flags (Debug): -m64 -g
-- C Compiler: /usr/bin/gcc
-- C flags (Release): -m64 -O3 -DNDEBUG
-- C flags (Debug): -m64 -g
-- Linker flags (Release):
-- Linker flags (Debug):
-- Precompiled headers: NO
--
-- OpenCV modules:
-- To be built: core imgproc flann highgui features2d calib3d ml video objdetect contrib nonfree legacy gpu photo python stitching ts videostab
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: androidcamera java
--
-- GUI:
-- QT 4.x: NO
-- Cocoa: YES
-- OpenGL support: NO
--
-- Media I/O:
-- ZLib: build (ver 1.2.6)
-- JPEG: build (ver 62)
-- PNG: build (ver 1.5.9)
-- TIFF: build (ver 42 - 4.0.1)
-- JPEG 2000: build (ver 1.900.1)
-- OpenEXR: 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
-- OpenNI: NO
-- OpenNI PrimeSensor Modules: NO
-- PvAPI: NO
-- QuickTime: NO
-- QTKit: YES
--
-- Other third-party libraries:
-- Use IPP: NO
-- Use TBB: NO
-- Use Cuda: NO
-- Use Eigen: NO
-- Use Clp: NO
--
-- Python:
-- Interpreter: /usr/bin/python (ver 2.7.1)
-- Libraries: /usr/lib/libpython2.7.dylib (ver 2.7.1)
-- numpy: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include (ver 1.5.1)
-- packages path: lib/python2.7/site-packages
--
-- Documentation:
-- Build Documentation: NO
-- Sphinx: NO
-- PdfLaTeX compiler: /usr/texbin/pdflatex
--
-- Tests and samples:
-- Tests: YES
-- Performance tests: YES
-- Examples: NO
--
-- Install path: /usr/local
--
-- cvconfig.h is in: /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/build
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/build
次に試しmake -j8
てみると、次のように始まり、しばらく続く何かが得られます。
[ 0%] [ 0%] [ 0%] [ 1%] [ 1%] [ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/adler32.c.o
Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/compress.c.o
Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/crc32.c.o
Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngerror.c.o
Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/png.c.o
Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/deflate.c.o
[ 1%] [ 1%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_cm.c.o
Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jcapimin.c.o
In file included from /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/pngerror.c:19:
/Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/pngpriv.h:45:20: error: stdlib.h: No such file or directory
In file included from /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/pngpriv.h:127,
from /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/pngerror.c:19:
/Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/png.h:442:26: error: setjmp.h: No such file or directory
/Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/png.h:450:24: error: time.h: No such file or directory
In file included from /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/png.c:14:
/Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/pngpriv.h:45:20: error: stdlib.h: No such file or directory
In file included from /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/pngpriv.h:127,
from /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/png.c:14:
/Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/png.h:442:26: error: setjmp.h: No such file or directory
/Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/png.h:450:24: error: time.h: No such file or directory
In file included from /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/zlib/zlib.h:34,
from /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/zlib/compress.c:9:
/Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/build/3rdparty/zlib/zconf.h:403:48: error: sys/types.h: No such file or directory
手順
- https://github.com/Itseez/opencvから zip をダウンロードします。
- 解凍すると、「opencv-master」というフォルダーが残っているはずです。そこに cd します。
- mkdir ビルド
- cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON ..
- 作る
- sudo make install