Karthik
Karthik

Reputation: 24

Error during the compilation of OpenCV with CUDA and FFMpeg on Ubuntu 18.04

I have a requirement to install OpenCV compiled with CUDA and FFMpeg for an optical flow calculation.

I followed this post to install on Ubuntu 18.04, but I am getting the following error shown in the below screenshot when I am trying to execute the following command:

  cmake -D CMAKE_BUILD_TYPE=RELEASE \
            -D CMAKE_INSTALL_PREFIX=/usr/local \
            -D INSTALL_C_EXAMPLES=ON \
            -D INSTALL_PYTHON_EXAMPLES=ON \
            -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
            -D BUILD_EXAMPLES=ON \
            -D BUILD_opencv_python2=OFF \
            -D WITH_FFMPEG=1 \
            -D WITH_CUDA=ON \
            -D CUDA_GENERATION=Pascal \
            -D ENABLE_FAST_MATH=1 \
            -D CUDA_FAST_MATH=1 \
            -D WITH_CUBLAS=1 \
            -D PYTHON_DEFAULT_EXECUTABLE=/opt/anaconda/bin/python \
            -D PYTHON3_INCLUDE_DIR=/opt/anaconda/include/python3.5m \
            -D PYTHON3_LIBRARY=/opt/anaconda/lib/libpython3.5m.so \
            -D PYTHON3_PACKAGES_PATH=/opt/anaconda/lib/python3.5 \
            -D WITH_LAPACK=OFF \
            -D PYTHON3_NUMPY_INCLUDE_DIRS=/opt/anaconda/lib/python3.5/site-packages/numpy/core/include ..

enter image description here

I have installed the CUDA version 10.0

It would be of a great help, if you can guide me to fix this error or suggest me a different procedure to install OpenCV compiled with CUDA and FFMpeg on Ubuntu 18.04.

Thanks!

Upvotes: 0

Views: 633

Answers (1)

api55
api55

Reputation: 11420

Just to put the information as an answer

What you describe, seems to be the same issue as in this one in github of opencv. In which the CUDA_CUDA_LIBRARY is not found. One can set this manually with:

-DCUDA_CUDA_LIBRARY=/usr/local/cuda/lib64/stubs/libcuda.so

or you can also use:

-DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs

Which will give a hint of where to look for this library.

For the other problem in your comment, it seems like some python file could not be found. Most probably related to this:

        -D PYTHON_DEFAULT_EXECUTABLE=/opt/anaconda/bin/python \
        -D PYTHON3_INCLUDE_DIR=/opt/anaconda/include/python3.5m \
        -D PYTHON3_LIBRARY=/opt/anaconda/lib/libpython3.5m.so \
        -D PYTHON3_PACKAGES_PATH=/opt/anaconda/lib/python3.5 \

You should check if you have those folders/files. If the version is the correct one (3.5) or if it is a newer one (3.6 or 3.7).

Upvotes: 1

Related Questions