文章目录
- 七 opencv安装报错
- fatal error: boostdesc_bgm.i: No such file or directory
- fatal error: opencv2/xfeatures2d/cuda.hpp: No such file or directory
- nonfree.hpp no such file
- Perhaps you should add the directory containing `OpenCV.pc' to the PKG_CONFI
- 7.4 opencv cmake编译过程中的红色警告
七 opencv安装报错
这个错误并不常见,在我按照之前安装的步骤安装时一直没有错误。但有一次安装的时候死活报下面这个错误。一般这种情况时没配置PKG_CONFIG_PATH的变量。不过我弄好了,还是这样。后来发现是代码中的opencv库都用小写就行。
fatal error: opencv2/OpenCV: No such file or directory
代码
#include <opencv2/opencv.hpp>
g++ -o main main.cpp `pkg-config --libs --cflags opencv`
虽说Linux大小写敏感,可是之前为什么就可以呢。
usr/local/include/中文件夹opencv2,文件名opencv.hpp都是小写。
遇到找不到文件,一方面利用find全局搜索,看看文件在哪里。包含路径进去 另一方面,可以使用apt-file serach package名 找出该缺失文件所在的包,然后将缺失的包安装
fatal error: boostdesc_bgm.i: No such file or directory
在执行sudo make -j8
的过程中,有可能遇到这个编译错误,到这一步就是下载吧下来,这时候,直接解压压缩包里的所有文件,放到opencv_contrib/modules/xfeatures2d/src/
路径下即可。
5
GitHub英文教程:https://github.com/opencv/opencv_contrib/issues/1301
fatal error: opencv2/xfeatures2d/cuda.hpp: No such file or directory
这个错误在github中找到了答案,因为需要把cuda.hpp的绝对路径替换掉,一般情况不会出现这种错误。
打开opencv-3.4.0/modules/stitching/include/opencv2/stitching/detail/matchers.hpp
文件,将第52行的opencv2/xfeatures2d/cuda.hpp
换成绝对路径/home/cw/mytool/opencv-3.4.6/opencv_contrib-3.4.6/modules/xfeatures2d/include/opencv2/xfeatures2d/cuda.hpp
没有cuda就找一下这两个OpenCV文件夹。
okay, I added this path “/home/cw/mytool/opencv-3.4.6/opencv_contrib-3.4.6/modules/xfeatures2d/include/opencv2/xfeatures2d/cuda.hpp” replacing 52 line that is “opencv2/xfeatures2d/cuda.hpp” in file which path is “opencv-3.4.0/modules/stitching/include/opencv2/stitching/detail/matchers.hpp”
https://github.com/opencv/opencv_contrib/issues/1534
nonfree.hpp no such file
https://www.freesion.com/article/3840595876/
Perhaps you should add the directory containing `OpenCV.pc’ to the PKG_CONFI
大小写的问题,其实在/usr/local/lib/pkgconfig/中有opencv.hpp,并且/usr/local/lib/pkgconfig/也加入了pkgconfig的路径中,只是因为g++ -o main main.cpp
pkg-config --libs --cflags OpenCV`一开始是大写,所以才找不到OpenCV.pc。
7.4 opencv cmake编译过程中的红色警告
CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
IPPICV: Download failed: 7;"Couldn't connect to server"
For details please refer to the download log file:
/home/dji/Downloads/opencv-4.5.0/build/CMakeDownloadLog.txt
Call Stack (most recent call first):
3rdparty/ippicv/ippicv.cmake:37 (ocv_download)
cmake/OpenCVFindIPP.cmake:244 (download_ippicv)
cmake/OpenCVFindLibsPerf.cmake:12 (include)
CMakeLists.txt:696 (include)
以前ippicv下载吧成功是无法构建的。现在可以忽略,但还是建议根据这个log解决问题。根据CMakeDownloadLog.txt指定的版本下载。
如果你照着网上的各种教程去下载文件并且各种转移就落了下乘。报错的原因是无法连接到网络。去报错提示的/home/dji/Downloads/opencv-4.5.0/build/CMakeDownloadLog.txt
看知道有这么一段话:
TCP_NODELAY set Connected to raw.githubusercontent.com (151.101.0.133) port 443 (#0) schannel: SSL/TLS connection with raw.githubusercontent.com port 443 (step 1/3) schannel: disabled server certificate revocation checks schannel: sending initial handshake data: sending 199 bytes...
连不上
raw.githubusercontent.com
因为被墙了。
在网址https://www.ipaddress.com/
中搜索raw.githubusercontent.com
,我这里显示ip是199.232.68.133
执行以下操作。(你看到的ip可能和我的不一样。这是一种临时解决方案。)
sudo vi /etc/hosts
199.232.68.133 raw.githubusercontent.com#文件末尾添加这段话