Ubuntu安装 opencv 3.4.1 遇到的问题

 这里说一下make阶段遇到的问题,前排感谢大佬们的智慧。

1.找不到包。

OpenCV3.3编译安装+部分问题解决 - 灰信网(软件开发博客聚合)

缺少的包											解决方法
-- No package 'gtk+-3.0' found          		sudo apt-get install libgtk-3-dev
-- No package 'gstreamer-base-1.0' found		sudo apt-get -y install libgstreamer-plugins-base1.0-dev
-- No package 'gstreamer-video-1.0' found 
-- No package 'gstreamer-app-1.0' found
-- No package 'gstreamer-riff-1.0' found		(这四个装下面这个包)
-- No package 'gstreamer-pbutils-1.0' found		sudo apt-get -y install libgstreamer1.0-dev
-- No package 'libavresample' found				sudo apt-get -y install libavresample-dev
-- No package 'libgphoto2' found				sudo apt-get -y install libgphoto2-dev

缺少库

-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing:  Atlas_CBLAS_INCLUDE_DIR Atlas_CLAPACK_INCLUDE_DIR 	Atlas_CBLAS_LIBRARY Atlas_BLAS_LIBRARY Atlas_LAPACK_LIBRARY) 
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- Could NOT find JNI (missing:  JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
-- Could NOT find Matlab (missing:  MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS 		MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) 
-- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file

解决:JNI和MATLAB我没有管,最后还是报没有。

sudo apt-get install libopenblas-dev

2.cmake报错

The fllowing variables are used in this project,but they are set to notfound:

CUDA_nppicom_LIBRARY(ADVANCED)

    linked by ...

Ubuntu安装 opencv 3.4.1 遇到的问题_第1张图片

Opencv 4.3(CUDA11 ) 编译踩坑记录 - Geoffrey_one - 博客园

解决:在cmake 后面加

-D CUDA_nppicom_LIBRARY=stdc++ 

3.找不到文件

fatal error: dynlink_nvcuvid.h: 没有那个文件或目录
         #include

解决“fatal error: dynlink_nvcuvid.h: 没有那个文件或目录#include <dynlink_nvcuvid.h>“问题_Sherwin He的博客-CSDN博客

解决:在cmake 后加

-D WITH_CUDA=OFF ..

由此,完整的cmake:

cmake -D CUDA_nppicom_LIBRARY=stdc++  -D WITH_CUDA=OFF ..

4.Unsupported gpu architecture 'compute_30'

据说是cuda11放弃了30,我的做法就是在报错的文件,删掉30这一行。删掉后如下图所示。这个需要多运行几遍,看看有哪些文件报这个错误。

set(CUDA_NVCC_FLAGS -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;-gencode;arch=compute_70,code=sm_70;

你可能感兴趣的:(ubuntu,opencv,matlab)