OpenCV 4.2 with geforce 3050Ti

Hi,

i am quite new at this and battling to install OpenCV 4.2 in my laptop.
I have a lenovo P5 AMD Ryzen 5 with geforce 3050Ti (Ampere 8.6)

As far as I understand I have to use cuda 11+ with this card. Also I installes nvidia 470 as driver (535 was not working from scratch)
I tryed to install opencv 4.2 with cuda 11.4 but couldnt make it, I think I had issues with gcc 8/9 and with the arch_bin compatibility

any clues??

thanks

You need to use CUDA >= 11.1 to support that card.

No our powers of deduction are not that great, can you provide the CMake input and configuration output please?

Thanks!
so, i have cuda 11.4 and the cmake I use is

cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_C_COMPILER=/usr/bin/gcc-8
-D CMAKE_CXX_COMPILER=/usr/bin/g++8
-D CMAKE_CXX_FLAGS=“-Wno-error=missing-prototypes”
-D CMAKE_INSTALL_PREFIX=/usr/local
-D INSTALL_PYTHON_EXAMPLES=ON
-D INSTALL_C_EXAMPLES=OFF
-D WITH_TBB=ON
-D BUILD_opencv_cudacodec=OFF
-D ENABLE_FAST_MATH=1
-D CUDA_FAST_MATH=1
-D WITH_CUDA=ON
-D WITH_CUBLAS=1
-D WITH_V4L=ON
-D WITH_QT=OFF
-D WITH_OPENGL=ON
-D WITH_GSTREAMER=ON
-D OPENCV_GENERATE_PKGCONFIG=ON
-D OPENCV_PC_FILE_NAME=opencv.pc
-D OPENCV_ENABLE_NONFREE=ON
-D OPENCV_PYTHON3_INSTALL_PATH=~/.virtualenvs/cv/lib/python3.8/site-packages
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-4.2.0/modules
-D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python
-D BUILD_EXAMPLES=OFF
-D WITH_CUDNN=ON
-D CUDA_HOST_COMPILER=/usr/bin/gcc-9
-D OPENCV_DNN_CUDA=ON
-D CUDA_ARCH_BIN=8.6
-D CUDNN_LIBRARY=/usr/local/cuda-11.4/lib64/libcudnn.so.8.9.3
-D CUDNN_INCLUDE_DIR=/usr/local/cuda-11.4/include
-D WITH_OPENCL=ON
-D OpenCL_INCLUDE_DIR=/usr/local/cuda-11.4/targets/x86_64-linux/include
-D OpenCL_LIBRARY=/usr/lib/x86_64-linux-gnu/libOpenCL.so.1 …

I am getting this error now

Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_nppicom_LIBRARY (ADVANCED)

Can you post the full CMake output?

I would very much recommend NOT building OpenCV v4.2. use the latest release.

I need 4.2 for compatibility reasons with ROS noetic

If that’s the case and without the viewing your CMake output, I would add the patch for CUDA 11.0 to OpenCV 4.2.0 by adding

if(NOT CUDA_VERSION VERSION_LESS 11.0)
# CUDA 11.0 removes nppicom
ocv_list_filterout(CUDA_nppi_LIBRARY “nppicom”)
ocv_list_filterout(CUDA_npp_LIBRARY “nppicom”)
endif()

here.

I could manage to solve de missing libray problem, now dealing with not detecting CUDNN

– Could NOT find CUDNN: Found unsuitable version “…”, but required is at least “7.5” (found /usr/local/cuda-11.4/lib64/libcudnn.so.8.9.3)

cudnn is installed, but for some reason it is not recognizgin it

– Detected processor: x86_64
– Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version “2.7”)
– Looking for ccache - not found
– Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version “1.2.11”, minimum required is “1.2.3”)
– Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR)
– Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version “1.2.11”)
– Found TBB (cmake): /usr/lib/x86_64-linux-gnu/libtbb.so.2
– found Intel IPP (ICV version): 2019.0.0 [2019.0.0 Gold]
– at: /home/fede/opencv-4.2.0/build/3rdparty/ippicv/ippicv_lnx/icv
– found Intel IPP Integration Wrappers sources: 2019.0.0
– at: /home/fede/opencv-4.2.0/build/3rdparty/ippicv/ippicv_lnx/iw
– Could NOT find CUDNN: Found unsuitable version “…”, but required is at least “7.5” (found /usr/local/cuda-11.4/lib64/libcudnn.so.8.9.3)
– CUDA detected: 11.4
– CUDA NVCC target flags: -gencode;arch=compute_86,code=sm_86;-D_FORCE_INLINES
– Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
– Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
– Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR)
– A library with LAPACK API found.
– Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
– The imported target “vtkParseOGLExt” references the file
“/usr/bin/vtkParseOGLExt-7.1”
but this file does not exist. Possible reasons include:

  • The file was deleted, renamed, or moved to another location.
  • An install or uninstall procedure did not complete successfully.
  • The installation package was faulty and contained
    “/usr/lib/cmake/vtk-7.1/VTKTargets.cmake”
    but not all the files it references.

– The imported target “vtkRenderingPythonTkWidgets” references the file
“/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so”
but this file does not exist. Possible reasons include:

  • The file was deleted, renamed, or moved to another location.
  • An install or uninstall procedure did not complete successfully.
  • The installation package was faulty and contained
    “/usr/lib/cmake/vtk-7.1/VTKTargets.cmake”
    but not all the files it references.

– The imported target “vtk” references the file
“/usr/bin/vtk”
but this file does not exist. Possible reasons include:

  • The file was deleted, renamed, or moved to another location.
  • An install or uninstall procedure did not complete successfully.
  • The installation package was faulty and contained
    “/usr/lib/cmake/vtk-7.1/VTKTargets.cmake”
    but not all the files it references.

– The imported target “pvtk” references the file
“/usr/bin/pvtk”
but this file does not exist. Possible reasons include:

  • The file was deleted, renamed, or moved to another location.
  • An install or uninstall procedure did not complete successfully.
  • The installation package was faulty and contained
    “/usr/lib/cmake/vtk-7.1/VTKTargets.cmake”
    but not all the files it references.

– Found VTK 7.1.1 (/usr/lib/cmake/vtk-7.1/UseVTK.cmake)
– OpenCV Python: during development append to PYTHONPATH: /home/fede/opencv-4.2.0/build/python_loader
– Caffe: NO
– Protobuf: NO
– Glog: YES
– freetype2: YES (ver 23.1.17)
– harfbuzz: YES (ver 2.6.4)
– HDF5: Using hdf5 compiler wrapper to determine C configuration
– Module opencv_ovis disabled because OGRE3D was not found
– No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
– Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
– Detected gflags version: 2.2.2
– Found installed version of Eigen: /usr/lib/cmake/eigen3
– Found required Ceres dependency: Eigen version 3.3.7 in /usr/include/eigen3
– Found required Ceres dependency: glog
– Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
– Detected gflags version: 2.2.2
– Found required Ceres dependency: gflags
– Found Ceres version: 1.14.0 installed in: /usr with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, CXSparse, SchurSpecializations, OpenMP, Multithreading]
– Checking SFM deps… TRUE
– Checking for module ‘tesseract’
– No package ‘tesseract’ found
– Tesseract: NO
– HDF5: Using hdf5 compiler wrapper to determine C configuration
– Registering hook ‘INIT_MODULE_SOURCES_opencv_dnn’: /home/fede/opencv-4.2.0/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
– opencv_dnn: filter out cuda4dnn source code
– No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
– Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
– Detected gflags version: 2.2.2
– Found installed version of Eigen: /usr/lib/cmake/eigen3
– Found required Ceres dependency: Eigen version 3.3.7 in /usr/include/eigen3
– Found required Ceres dependency: glog
– Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
– Detected gflags version: 2.2.2
– Found required Ceres dependency: gflags
– Found Ceres version: 1.14.0 installed in: /usr with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, CXSparse, SchurSpecializations, OpenMP, Multithreading]
– Checking SFM deps… TRUE
CMake Warning at cmake/OpenCVGenSetupVars.cmake:54 (message):
CONFIGURATION IS NOT SUPPORTED: validate setupvars script in install
directory
Call Stack (most recent call first):
CMakeLists.txt:947 (include)


– General configuration for OpenCV 4.2.0 =====================================
– Version control: unknown

– Extra modules:
– Location (extra): /home/fede/opencv_contrib-4.2.0/modules
– Version control (extra): unknown

– Platform:
– Timestamp: 2023-08-08T13:06:43Z
– Host: Linux 5.15.0-67-generic x86_64
– CMake: 3.16.3
– CMake generator: Unix Makefiles
– CMake build tool: /usr/bin/make
– Configuration: RELEASE

– CPU/HW features:
– Baseline: SSE SSE2 SSE3
– requested: SSE3
– Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
– requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
– SSE4_1 (16 files): + SSSE3 SSE4_1
– SSE4_2 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2
– FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
– AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
– AVX2 (29 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
– AVX512_SKX (6 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX

– C/C++:
– Built as dynamic libs?: YES
– C++ Compiler: /usr/bin/g+±8 (ver 8.4.0)
– C++ flags (Release): -Wno-error=missing-prototypes -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
– C++ flags (Debug): -Wno-error=missing-prototypes -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
– C Compiler: /usr/bin/gcc-8
– C flags (Release): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
– C flags (Debug): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
– Linker flags (Release): -Wl,–gc-sections
– Linker flags (Debug): -Wl,–gc-sections
– ccache: NO
– Precompiled headers: NO
– Extra dependencies: m pthread cudart_static -lpthread dl rt nppc nppial nppicc nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cufft -L/usr/local/cuda-11.4/lib64 -L/usr/lib/x86_64-linux-gnu
– 3rdparty dependencies:

– OpenCV modules:
– To be built: aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python3 quality reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab viz xfeatures2d ximgproc xobjdetect xphoto
– Disabled: cudacodec world
– Disabled by dependency: -
– Unavailable: cnn_3dobj cvv java js matlab ovis python2
– Applications: tests perf_tests apps
– Documentation: NO
– Non-free algorithms: YES

– GUI:
– GTK+: YES (ver 3.24.20)
– GThread : YES (ver 2.64.6)
– GtkGlExt: NO
– OpenGL support: NO
– VTK support: YES (ver 7.1.1)

– Media I/O:
– ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
– JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
– WEBP: /usr/lib/x86_64-linux-gnu/libwebp.so (ver encoder: 0x020e)
– PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
– TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.1.0)
– JPEG 2000: build (ver 1.900.1)
– OpenEXR: build (ver 2.3.0)
– HDR: YES
– SUNRASTER: YES
– PXM: YES
– PFM: YES

– Video I/O:
– DC1394: YES (2.2.5)
– FFMPEG: YES
– avcodec: YES (58.54.100)
– avformat: YES (58.29.100)
– avutil: YES (56.31.100)
– swscale: YES (5.5.100)
– avresample: YES (4.0.0)
– GStreamer: YES (1.16.3)
– v4l/v4l2: YES (linux/videodev2.h)

– Parallel framework: TBB (ver 2020.1 interface 11101)

– Trace: YES (with Intel ITT)

– Other third-party libraries:
– Intel IPP: 2019.0.0 Gold [2019.0.0]
– at: /home/fede/opencv-4.2.0/build/3rdparty/ippicv/ippicv_lnx/icv
– Intel IPP IW: sources (2019.0.0)
– at: /home/fede/opencv-4.2.0/build/3rdparty/ippicv/ippicv_lnx/iw
– Lapack: NO
– Eigen: YES (ver 3.3.7)
– Custom HAL: NO
– Protobuf: build (3.5.1)

– NVIDIA CUDA: YES (ver 11.4, CUFFT CUBLAS FAST_MATH)
– NVIDIA GPU arch: 86
– NVIDIA PTX archs:

– cuDNN: NO

– OpenCL: YES (no extra features)
– Include path: /home/fede/opencv-4.2.0/3rdparty/include/opencl/1.2
– Link libraries: Dynamic load

– Python 3:
– Interpreter: /home/fede/.virtualenvs/cv/bin/python3 (ver 3.8.10)
– Libraries: /usr/lib/x86_64-linux-gnu/libpython3.8.so (ver 3.8.10)
– numpy: /home/fede/.virtualenvs/cv/lib/python3.8/site-packages/numpy/core/include (ver 1.24.4)
– install path: /home/fede/.virtualenvs/cv/lib/python3.8/site-packages/cv2/python-3.8

– Python (for build): /home/fede/.virtualenvs/cv/bin/python3

– Java:
– ant: NO
– JNI: NO
– Java wrappers: NO
– Java tests: NO

– Install to: /usr/local


To be on the safe side as your using a version of OpenCV which is nearly 4 years old I would install the recommended version cuDNN (7.5).

wont t I have any compat problems cuda 11.4 with cudNN 7.5?

Ignore my previous comment, I think you need to add these lines

because the naming of the headers changed see PR to update to CUDA 11.0 below

for details.

As @crackwitz alluded to you are using an old version of OpenCV which pre-dates CUDA 11.0 so many many things could fail even if you manage to build it.