赞
踩
由于换电脑、重装系统、系统奔溃、换固态,不到一年已经重装OpenCV不下十次了,本以为装了这么多次应该没什么问题了,可最奔溃的是几乎每次都会出错,而且出的错每次都不一样,心疼自己。。。把这次出现的问题记录一下。
ubuntu14.04
opencv3.3.1
opencv_contrib-3.3.1
Failed to download tiny-dnn sources
> -- Looking for tiny_dnn.h
> -- Looking for tiny_dnn.h - not found
> -- Module opencv_dnn_modern disabled because tiny-dnn was not found
> -- checking for one of the modules 'freetype2'
> -- checking for one of the modules 'harfbuzz'
> -- freetype2: NO
> -- harfbuzz: NO
> -- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS)
> -- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
> -- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
> -- Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
> -- Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
> -- Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
> -- Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
> -- checking for modules 'tesseract;lept'
> -- package 'tesseract' not found
> -- package 'lept' not found
> -- Tesseract: NO
> -- xfeatures2d/boostdesc: Download: boostdesc_bgm.i
> CMake Warning at ~/workspace/opencv/opencv-master/cmake/OpenCVDownload.cmake:170 (message):
> xfeatures2d/boostdesc: Download failed: 1;"Unsupported protocol"
> Call Stack (most recent call first):
> ~/workspace/opencv_contrib-master/modules/xfeatures2d/cmake/download_boostdesc.cmake:22 (ocv_download)
> ~/workspace/opencv_contrib-master/modules/xfeatures2d/CMakeLists.txt:8 (download_boost_descriptors)
In file included from ~/workspace/opencv/opencv-master/modules/stitching/include/opencv2/stitching.hpp:49:0,
from ~/workspace/opencv/opencv-master/modules/stitching/src/precomp.hpp:59,
from ~/workspace/build/modules/stitching/opencv_stitching_pch_dephelp.cxx:1:
~/workspace/opencv/opencv-master/modules/stitching/include/opencv2/stitching/detail/matchers.hpp:52:42: fatal error: opencv2/xfeatures2d/cuda.hpp: No such file or directory
# include "opencv2/xfeatures2d/cuda.hpp"
^
①看了cmake时的提示,估计是opencv_contrib-3.3.1/modules/dnn_modern
中文件下载出错,于是参考网上的方法离线下载放入对应的路径中,但还是没有解决。又怀疑是网络问题更换了国外的源,并启用了代理,也是没有下载成功。
②又根据make时报错的提示,想可能时cuda的因素,尝试不启用也没有解决。
cmake过程中会下载很多需要的文件,没有下载成功也不会报错,所以没注意的话一般就直接执行下一步了,然后make时报错,通常根据make时的提示寻找问题,但其实根源是在cmake时出现的,所以先解决cmake的问题。
参考github上的issue:https://github.com/opencv/opencv_contrib/issues/1131
有网友根据提示Download failed: 1;"unsupported protocol"
认为是因为下载出错引起的,所用的cmake版本没有支持HTTPS,于是重新安装了cmake(之前用的时3.11版本,然后卸载按下面的方式安装了3.9.0)
wget --no-check-certificate https://cmake.org/files/v3.9/cmake-3.9.0.tar.gz
tar -zxvf cmake-3.9.0.tar.gz
cd cmake-3.9.0
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install zlib1g-dev
./bootstrap --system-curl
sudo make && sudo make install
安装完之后然后重新cmake,cmake两遍看出现的问题2(第一遍出错时信息太多,没显示出错的地方,cmake第二遍)
(安装支持HTTPS的cmake不是直接解决问题,而是可以更清楚地看问题的根源)
Invalid escape sequence \,
Call Stack (most recent call first):
/home/tank/Programming/opencv/cmake/OpenCVDownload.cmake:162 (ocv_download_log)
/home/tank/Programming/opencv_contrib/modules/xfeatures2d/cmake/download_boostdesc.cmake:22 (ocv_download)
/home/tank/Programming/opencv_contrib/modules/xfeatures2d/CMakeLists.txt:8 (download_boost_descriptors)
-- Configuring incomplete, errors occurred!
See also "/home/tank/Programming/opencv/build/CMakeFiles/CMakeOutput.log".
See also "/home/tank/Programming/opencv/build/CMakeFiles/CMakeError.log".
Github上有网友指出是因为OpenCVDownload.cmake
在日志记录功能中出现问题,找到文件~/opencv-3.3.1/cmake/OpenCVDownload.cmake
将以下代码
macro(ocv_download_log)
file(APPEND "${OPENCV_DOWNLOAD_LOG}" "${ARGN}\n")
endmacro()
修改成
function(ocv_download_log)
file(APPEND "${OPENCV_DOWNLOAD_LOG}" "${ARGN}\n")
endfunction()
然后重新cmake,make,make install 成功。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。