Error in installing OpenCV 3.4.0 on Cuda 10

I am trying to install openCV 3.4.0 . on Cuda 10 using source file. I am getting below error.

[ 59%] Building CXX object modules/cudacodec/CMakeFiles/opencv_cudacodec_pch_dephelp.dir/opencv_cudacodec_pch_dephelp.cxx.o
In file included from /home/nvidia/Desktop/opencv-3.4.0/build/modules/cudacodec/opencv_cudacodec_pch_dephelp.cxx:1:0:
/home/nvidia/Desktop/opencv-3.4.0/modules/cudacodec/src/precomp.hpp:60:37: fatal error: dynlink_nvcuvid.h: No such file or directory
compilation terminated.
modules/cudacodec/CMakeFiles/opencv_cudacodec_pch_dephelp.dir/build.make:62: recipe for target ‘modules/cudacodec/CMakeFiles/opencv_cudacodec_pch_dephelp.dir/opencv_cudacodec_pch_dephelp.cxx.o’ failed
make[2]: *** [modules/cudacodec/CMakeFiles/opencv_cudacodec_pch_dephelp.dir/opencv_cudacodec_pch_dephelp.cxx.o] Error 1
CMakeFiles/Makefile2:7395: recipe for target ‘modules/cudacodec/CMakeFiles/opencv_cudacodec_pch_dephelp.dir/all’ failed
make[1]: *** [modules/cudacodec/CMakeFiles/opencv_cudacodec_pch_dephelp.dir/all] Error 2
Makefile:160: recipe for target ‘all’ failed
make: *** [all] Error 2

Hi, I met the exact same error while trying to build opencv 4.0.0 with CUDA 10.0.

I would be very interested if you found a solution.

EDIT : My problem is solved. I dont know for yours.

Actually, NVIDIA Video Decoder (NVCUVID) is deprecated in CUDA 10.
(https://docs.nvidia.com/cuda/video-decoder/index.html)

The issue is fixed if we desactivate the Cuda video decoder (also called NVCUVID ) with the following option in cmake : -D BUILD_opencv_cudacodec=OFF

I found this solution on https://github.com/opencv/opencv_contrib/issues/1786

I had the same issue on 3.4.5 and your suggested cmake flag helped, thanks!

cmake ... -D BUILD_opencv_cudacodec=OFF ...