对于Python3.4.3、Ubuntu14.04、CUDA8和最新版本的OpenCV,请从opencv网站下载,并使用以下命令:
(cv2) mona@pascal:~/computer_vision/opencv-3.2.0/build$ cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..我得到以下错误。请建议修复方法。
-- checking for module 'libgphoto2'
-- package 'libgphoto2' not found
-- ICV: Downloading ippicv_linux_20151201.tgz...
-- ICV: Unpacking ippicv_linux_20151201.tgz to /home/mona/computer_vision/opencv-3.2.0/build/3rdparty/ippicv...
-- ICV: Package successfully downloaded
-- found IPP (ICV version): 9.0.1 [9.0.1]
-- at: /home/mona/computer_vision/opencv-3.2.0/build/3rdparty/ippicv/ippicv_lnx
-- CUDA detected: 8.0
-- CUDA NVCC target flags: -gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-D_FORCE_INLINES
CMake Error at cmake/OpenCVFindMKL.cmake:32 (file):
file STRINGS file "/opt/intel/mkl/include/mkl_version.h" cannot be read.
Call Stack (most recent call first):
cmake/OpenCVFindMKL.cmake:72 (get_mkl_version)
cmake/OpenCVFindLAPACK.cmake:10 (include)
CMakeLists.txt:559 (include)<!--
CMake Error at cmake/OpenCVFindMKL.cmake:90 (if):
if given arguments:
"VERSION_GREATER" "11.3.0" "OR" "VERSION_EQUAL" "11.3.0"
Unknown arguments specified
Call Stack (most recent call first):
cmake/OpenCVFindLAPACK.cmake:10 (include)
CMakeLists.txt:559 (include)
-- Configuring incomplete, errors occurred!以下是cmake/OpenCVFindMKL.cmake文件中存在的内容:http://pastebin.com/Yxq8GQTZ Cmake log http://pastebin.com/JQSi2me3
发布于 2017-01-19 10:55:40
安装最新版本的英特尔MKL即可解决此问题。我的机器上有一个更老的版本。基本上,只需下载l_mkl_2017.0.098.tgz并键入sudo ./install.sh,然后按照对话框中的正确选择进行操作。这是一个简单的安装。
在使用cmake成功之后,您应该会得到一个类似于以下内容的报告:
-- General configuration for OpenCV 3.2.0 =====================================
-- Version control: unknown
--
-- Platform:
-- Timestamp: 2017-01-19T02:54:29Z
-- Host: Linux 3.13.0-62-generic x86_64
-- CMake: 2.8.12.2
-- 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 5.4.1)
-- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -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-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -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-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /usr/bin/cc
-- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release):
-- Linker flags (Debug):
-- ccache: NO
-- Precompiled headers: YES
-- Extra dependencies: /usr/lib/x86_64-linux-gnu/libwebp.so /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libtiff.so /usr/lib/x86_64-linux-gnu/libjasper.so /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so gtk-3 gdk-3 atk-1.0 gio-2.0 pangocairo-1.0 gdk_pixbuf-2.0 cairo-gobject pango-1.0 cairo gobject-2.0 glib-2.0 gthread-2.0 gstbase-0.10 gstreamer-0.10 gmodule-2.0 xml2 gstvideo-0.10 gstapp-0.10 gstriff-0.10 gstpbutils-0.10 dc1394 avcodec avformat avutil swscale vtkRenderingOpenGL vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport dl m pthread rt /opt/intel/mkl/lib/intel64/libmkl_core.so /opt/intel/mkl/lib/intel64/libmkl_intel_lp64.so /opt/intel/mkl/lib/intel64/libmkl_sequential.so -lpthread -lm -ldl cudart nppc nppi npps cufft -L/usr/local/cuda-8.0/lib64
-- 3rdparty dependencies:
--
-- OpenCV modules:
-- To be built: cudev core cudaarithm flann imgproc ml video viz cudabgsegm cudafilters cudaimgproc cudawarping imgcodecs photo shape videoio cudacodec highgui objdetect ts features2d calib3d cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo java stitching superres videostab python2
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: python3
--
-- GUI:
-- QT: NO
-- GTK+ 3.x: YES (ver 3.10.8)
-- GThread : YES (ver 2.40.2)
-- GtkGlExt: NO
-- OpenGL support: NO
-- VTK support: YES (ver 6.0.0)
--
-- Media I/O:
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)
-- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
-- WEBP: /usr/lib/x86_64-linux-gnu/libwebp.so (ver encoder: 0x0202)
-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.50)
-- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 4.0.3)
-- JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
-- OpenEXR: /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so (ver 1.6.1)
-- GDAL: NO
-- GDCM: NO
--
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: YES (ver 2.2.1)
-- FFMPEG: YES
-- avcodec: YES (ver 54.35.1)
-- avformat: YES (ver 54.20.4)
-- avutil: YES (ver 52.3.0)
-- swscale: YES (ver 2.1.1)
-- avresample: NO
-- GStreamer:
-- base: YES (ver 0.10.36)
-- video: YES (ver 0.10.36)
-- app: YES (ver 0.10.36)
-- riff: YES (ver 0.10.36)
-- pbutils: YES (ver 0.10.36)
-- OpenNI: NO
-- OpenNI PrimeSensor Modules: NO
-- OpenNI2: NO
-- PvAPI: NO
-- GigEVisionSDK: NO
-- Aravis SDK: NO
-- UniCap: NO
-- UniCap ucil: NO
-- V4L/V4L2: NO/YES
-- XIMEA: NO
-- Xine: NO
-- gPhoto2: NO
--
-- Parallel framework: pthreads
--
-- Other third-party libraries:
-- Use IPP: 9.0.1 [9.0.1]
-- at: /home/mona/computer_vision/opencv-3.2.0/build/3rdparty/ippicv/ippicv_lnx
-- Use IPP Async: NO
-- Use VA: NO
-- Use Intel VA-API/OpenCL: NO
-- Use Lapack: YES (/opt/intel/mkl/lib/intel64/libmkl_core.so /opt/intel/mkl/lib/intel64/libmkl_intel_lp64.so /opt/intel/mkl/lib/intel64/libmkl_sequential.so /opt/intel/mkl/lib/intel64/libmkl_core.so /opt/intel/mkl/lib/intel64/libmkl_intel_lp64.so /opt/intel/mkl/lib/intel64/libmkl_sequential.so /opt/intel/mkl/lib/intel64/libmkl_core.so /opt/intel/mkl/lib/intel64/libmkl_intel_lp64.so /opt/intel/mkl/lib/intel64/libmkl_sequential.so -lpthread -lm -ldl)
-- Use Eigen: YES (ver 3.2.0)
-- Use Cuda: YES (ver 8.0)
-- Use OpenCL: YES
-- Use OpenVX: NO
-- Use custom HAL: NO
--
-- NVIDIA CUDA
-- Use CUFFT: YES
-- Use CUBLAS: NO
-- USE NVCUVID: NO
-- NVIDIA GPU arch: 20 30 35 37 50 52 60 61
-- NVIDIA PTX archs:
-- Use fast math: NO
--
-- OpenCL: <Dynamic loading of OpenCL library>
-- Include path: /home/mona/computer_vision/opencv-3.2.0/3rdparty/include/opencl/1.2
-- Use AMDFFT: NO
-- Use AMDBLAS: NO
--
-- Python 2:
-- Interpreter: /usr/bin/python2.7 (ver 2.7.6)
-- Libraries: /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.6)
-- numpy: /usr/local/lib/python2.7/dist-packages/numpy/core/include (ver 1.11.1)
-- packages path: lib/python2.7/dist-packages
--
-- Python 3:
-- Interpreter: /home/mona/.virtualenvs/cv2/bin/python3.4 (ver 3.4.3)
--
-- Python (for build): /usr/bin/python2.7
--
-- Java:
-- ant: /usr/bin/ant (ver 1.9.3)
-- JNI: /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include
-- Java wrappers: YES
-- Java tests: YES
--
-- Matlab:
-- mex: /usr/local/MATLAB/R2014b/bin/mex
-- Compiler/generator: Not working (bindings will not be generated)
--
-- Documentation:
-- Doxygen: /usr/bin/doxygen (ver 1.8.6)
--
-- Tests and samples:
-- Tests: YES
-- Performance tests: YES
-- C/C++ Examples: NO
--
-- Install path: /usr/local
--
-- cvconfig.h is in: /home/mona/computer_vision/opencv-3.2.0/build
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mona/computer_vision/opencv-3.2.0/build发布于 2017-05-20 00:13:06
在Ubuntu12.04机器上,我下载的最新的MKL版本(l_mkl_2017.3.196)需要Ubuntu14.04,所以Mona的解决方案在这种情况下不起作用。
对我来说起作用的是在第71行之后添加一个if到opencv-3.2.0/cmake/OpenCVFindMKL.cmake:
set(MKL_INCLUDE_DIRS ${MKL_ROOT_DIR}/include)
if(NOT EXISTS "${MKL_INCLUDE_DIRS}/mkl_version.h") # added these 3 lines
mkl_fail() #
endif() #
get_mkl_version(${MKL_INCLUDE_DIRS}/mkl_version.h)这是"official" fix for the issue的简化版本。
https://stackoverflow.com/questions/41732696
复制相似问题