Search code examples
c++opencvcudnn

building c++ opencv 4 with cuda ubuntu 16/04


I'm trying to build opencv' with cuda 10.2. When the following command :

cmake -DCMAKE_BUILD_TYPE=RELEASE \
-DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-DWITH_TBB=ON -DWITH_CUDA=ON \
-DBUILD_opencv_cudacodec=OFF \
-DENABLE_FAST_MATH=1 \
-DWITH_CUBLAS=1 \
 -DWITH_V4L=ON  \
 -DWITH_OPENGL=ON  \
 -DWITH_GSTREAMER=ON  \
 -DOPENCV_GENERATE_PKGCONFIG=ON  \
 -DOPENCV_ENABLE_NONFREE=ON \
 -DBUILD_EXAMPLES=TRUE \
 -DBUILD_PERF_TESTS=FALSE \
 -DEBUILD_TESTS=FALSE ../../opencv

I have the following issue :

Could NOT find CUDNN (missing:  CUDNN_LIBRARY CUDNN_INCLUDE_DIR) (Required is at least version "6")

of course I have installed cudnn7 corresponding to cuda 10.2, I the installation test passed.

Can someone help ?


Solution

  • To fix the problem I added the following options for cmake :

    -DCUDNN_INCLUDE_DIR=/usr/local/cuda/include \
    -DCUDNN_LIBRARY=/usr/local/cuda/lib64/libcudnn.so.7.6.5 \