cannot find lcublas when installing OpenCV with CUDA in Ubuntu 20?

asked 2020-10-15 19:18:24 -0600

e1513377 gravatar image

I'm using Ubuntu 20, CMake 3.16 and CUDA 10.1 and did

mkdir ~/opencv_build && cd ~/opencv_build
git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git

then

cd /home/me/Downloads/opencv_build/opencv
mkdir -p build && cd build

then

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_GENERATE_PKGCONFIG=ON -D OPENCV_EXTRA_MODULES_PATH=/home/me/Downloads/opencv_build/opencv_contrib/modules -DCUDA_cublas_LIBRARY=/usr/local/cuda-10.1/lib64/libcublas.so.10 -D WITH_CUDA=ON -D WITH_TBB=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D WITH_QT=OFF -D BUILD_EXAMPLES=ON ..

it worked so I then did make -j8 and got

    /usr/bin/ld: cannot find -lcublas
collect2: error: ld returned 1 exit status
make[2]: *** [modules/cudev/CMakeFiles/opencv_cudev.dir/build.make:86: lib/libopencv_cudev.so.4.5.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:5481: modules/cudev/CMakeFiles/opencv_cudev.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

since I mostly just need OpenCV and CUDA, I tried doing CMake without cublas:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_GENERATE_PKGCONFIG=ON -D OPENCV_EXTRA_MODULES_PATH=/home/me/Downloads/opencv_build/opencv_contrib/modules -DCUDA_cublas_LIBRARY=/usr/local/cuda-10.1/lib64/libcublas.so.10 -D WITH_CUDA=ON -D BUILD_EXAMPLES=ON ..

Then I get

CMake Error: the following variables are set to NOTFOUND
CUDA_cublas_LIBRARY( ADVANCED)
linked by target "opencv_cudev" 
...

can anyone help with this?

edit retag flag offensive close merge delete