I wanted to install the previously installed opencv3.2.0+opencv-contrib3.2.0 in another place, but there was an error. Obviously nothing was changed, so I had to bite the bullet and change the error. (It was later discovered that it was caused by CUDA)
At first I learned from the CMakeError.log file that there are the following errors: (This error has always been recorded in CMakeError.log, but it does not seem to be the main reason, and this error is not displayed in the compiled terminal. It is not clear whether it must be modified This error)
opencv-3.2.0/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10:
fatal error: sys/videoio.h: No such file or directory
Reference link: https://stackoverflow.com/questions/45582565/opencv-cmake-error-no-such-file-or-directory-on-ubuntu
The following error is displayed in the terminal:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_nppi_LIBRARY (ADVANCED)
linked by target “opencv_cudev” in directory D:/Cproject/opencv/opencv/sources/modules/cudev
linked by target “opencv_cudev” in directory D:/Cproject/opencv/opencv/sources/modules/cudev
linked by target “opencv_test_cudev” in directory D:/Cproject/opencv/opencv/sources/modules/cudev/test
…
This blog solves this problem very well: https://blog.csdn.net/u014613745/article/details/78310916
Blogger explained: The main reason for the error is that cuda9 no longer supports the 2.0 architecture. (Suddenly, I just changed the NVIDA display driver recently, downloaded the new version of CUDA, and checked my CUDA version as 10.1.1243. Before the update, I used the Nouveau display driver that comes with the system, and I didn’t download or update CUDA, so No error in previous compilation) NIVIDA official cuda download
nvcc fatal: Unsupported gpu architecture'compute_20' error
Found cmake/OpenCVDetectCUDA.cmake
file
修改
set(__cuda_arch_bin "2.0 3.0 3.5 3.7 5.0 5.2 6.0 6.1")
为
set(__cuda_arch_bin "3.0 3.5 3.7 5.0 5.2 6.0 6.1")
Reference link: https://www.twblogs.net/a/5b7ecca02b717767c6abdf22 (This one has encountered many similar problems, so the summary is more comprehensive)
You can also use cmake-gui to modify in the gui, refer to the link: https://blog.csdn.net/Sanviolet/article/details/79081363
Then it can be compiled smoothly, but it took a long time, and there are a lot of warnings related to cudev. ( Whether there will be any problems to use it to be determined~)
For these warnings, some people explain it like this: shfl without sync causes a warning in CUDA 9.2, but shfl with sync causes an error in CUDA 8.0