Friday, 14 May 2021

CUDA_CUDA_LIBRARY, CUDA_nvcuvid_LIBRARY, cudacodec, CMake Generate step failed?

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_CUDA_LIBRARY (ADVANCED)
    linked by target "opencv_cudacodec" in directory /home/ccng/workspace/opencv_contrib-4.4.0/modules/cudacodec
CUDA_nvcuvid_LIBRARY (ADVANCED)
    linked by target "opencv_cudacodec" in directory /home/ccng/workspace/opencv_contrib-4.4.0/modules/cudacodec

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.


============================

 

This bug is due to the nvcuvid and nvidia-encode not set in a correct path.

 

step1: download the correct driver and library into a specific path:-

For nvidia driver 450, cuda10.2 and gpu2080ti:-

download video_codec_sdk from NVIDIA (***very important***)
cd /home/ninja/installer/Video_Codec_SDK_10.0.26/Interface
sudo cp ./* /usr/local/cuda-10.2/include
cd /home/ccng/installer/Video_Codec_SDK_10.0.26/Interface
sudo cp ./* /usr/local/cuda-10.2/targets/x86_64-linux/lib/stubs
(make sure libnvidia-encode.so and libnvcuvid.so are inside the folder)
sudo ln -s /usr/local/cuda-10.2/targets/x86_64-linux/lib/stubs/libnvcuvid.so /usr/local/cuda-10.2/targets/x86_64-linux/lib/stubs/libnvcuvid.so.1
sudo ln -s /usr/local/cuda-10.2/targets/x86_64-linux/lib/stubs/libnvidia-encode.so /usr/local/cuda-10.2/targets/x86_64-linux/lib/stubs/libnvidia-encode.so.1


step2: adding the following configuration in opencv cmake:-

        -DCMAKE_LIBRARY_PATH=/usr/local/cuda-10.2/targets/x86_64-linux/lib/stubs \
        -DCUDA_nvcuvid_LIBRARY=/usr/local/cuda-10.2/targets/x86_64-linux/lib/stubs/libnvcuvid.so.1 \
        -DCUDA_nvcuvenc_LIBRARY=/usr/local/cuda-10.2/targets/x86_64-linux/lib/stubs/libnvidia-encode.so \
        -DCUDA_nvcuvid_LIBRARIES=/usr/local/cuda-10.2/targets/x86_64-linux/lib/stubs/libnvcuvid.so \
        -DCUDA_nvcuvenc_LIBRARIES=/usr/local/cuda-10.2/targets/x86_64-linux/lib/stubs/libnvidia-encode.so \

No comments:

Post a Comment