opencv / opencv

Open Source Computer Vision Library
https://opencv.org
Apache License 2.0
79.04k stars 55.82k forks source link

No rule to make target 'cublas', needed by 'lib/libopencv_sfm.so.4.5.2'. #23659

Closed Alex-43760 closed 1 year ago

Alex-43760 commented 1 year ago

System Information

I Use ubuntu 20.04 I have cuda 11.2 I have cuDNN version 8.1.0

Detailed description

I'm trying to install opencv 4.5.2 with cuda 11.2 and cuDNN 8.1.0 but I'm having a problem with that and it's as follows

(AIenv) ai@ai:~/nvidia/opencv-4.5.2/build$ make -j20
-- Detected processor: x86_64
-- 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")  
Cleaning INTERNAL cached variable: WEBP_LIBRARY
Cleaning INTERNAL cached variable: WEBP_INCLUDE_DIR
-- Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources
-- OpenJPEG: VERSION = 2.4.0, BUILD = opencv-4.5.2-openjp2-2.4.0
-- OpenJPEG libraries will be built from sources: libopenjp2 (version "2.4.0")
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")  
-- Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf.so
-- Found TBB (cmake): /usr/lib/x86_64-linux-gnu/libtbb.so.2
-- found Intel IPP (ICV version): 2020.0.0 [2020.0.0 Gold]
-- at: /home/ai/nvidia/opencv-4.5.2/build/3rdparty/ippicv/ippicv_lnx/icv
-- found Intel IPP Integration Wrappers sources: 2020.0.0
-- at: /home/ai/nvidia/opencv-4.5.2/build/3rdparty/ippicv/ippicv_lnx/iw
-- CUDA detected: 11.2
-- CUDA: Using CUDA_ARCH_BIN=8.6
-- CUDA NVCC target flags: -gencode;arch=compute_86,code=sm_86;-D_FORCE_INLINES
-- LAPACK(Atlas): LAPACK_LIBRARIES: /usr/lib/x86_64-linux-gnu/liblapack.so;/usr/lib/x86_64-linux-gnu/libcblas.so;/usr/lib/x86_64-linux-gnu/libatlas.so
-- LAPACK(Atlas): Support is enabled.
-- Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 AWT) 
-- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
-- OpenCV Python: during development append to PYTHONPATH: /home/ai/nvidia/opencv-4.5.2/build/python_loader
-- Caffe:   NO
-- Protobuf:   NO
-- Glog:   YES
-- freetype2:   YES (ver 23.1.17)
-- harfbuzz:    YES (ver 2.6.4)
-- HDF5 C compiler wrapper is unable to compile a minimal HDF5 program.
-- Julia not found. Not compiling Julia Bindings. 
-- Module opencv_ovis disabled because OGRE3D was not found
-- Found AMD headers in: /usr/include/suitesparse
-- Found AMD library: /usr/lib/x86_64-linux-gnu/libamd.so
-- Found CAMD headers in: /usr/include/suitesparse
-- Found CAMD library: /usr/lib/x86_64-linux-gnu/libcamd.so
-- Found CCOLAMD headers in: /usr/include/suitesparse
-- Found CCOLAMD library: /usr/lib/x86_64-linux-gnu/libccolamd.so
-- Found CHOLMOD headers in: /usr/include/suitesparse
-- Found CHOLMOD library: /usr/lib/x86_64-linux-gnu/libcholmod.so
-- Found COLAMD headers in: /usr/include/suitesparse
-- Found COLAMD library: /usr/lib/x86_64-linux-gnu/libcolamd.so
-- Found SPQR headers in: /usr/include/suitesparse
-- Found SPQR library: /usr/lib/x86_64-linux-gnu/libspqr.so
-- Found Config headers in: /usr/include/suitesparse
-- Found Config library: /usr/lib/x86_64-linux-gnu/libsuitesparseconfig.so
-- Found Intel Thread Building Blocks (TBB) library (2020.1 / 11101) include location: . Assuming SuiteSparseQR was compiled with TBB.
-- Adding librt to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing).
-- Could NOT find METIS (missing: METIS_INCLUDE_DIR METIS_LIBRARY) 
-- Tesseract:   YES (ver 4.1.1)
-- Allocator metrics storage type: 'long long'
-- HDF5 C compiler wrapper is unable to compile a minimal HDF5 program.
-- Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': /home/ai/nvidia/opencv-4.5.2/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
-- Found AMD headers in: /usr/include/suitesparse
-- Found AMD library: /usr/lib/x86_64-linux-gnu/libamd.so
-- Found CAMD headers in: /usr/include/suitesparse
-- Found CAMD library: /usr/lib/x86_64-linux-gnu/libcamd.so
-- Found CCOLAMD headers in: /usr/include/suitesparse
-- Found CCOLAMD library: /usr/lib/x86_64-linux-gnu/libccolamd.so
-- Found CHOLMOD headers in: /usr/include/suitesparse
-- Found CHOLMOD library: /usr/lib/x86_64-linux-gnu/libcholmod.so
-- Found COLAMD headers in: /usr/include/suitesparse
-- Found COLAMD library: /usr/lib/x86_64-linux-gnu/libcolamd.so
-- Found SPQR headers in: /usr/include/suitesparse
-- Found SPQR library: /usr/lib/x86_64-linux-gnu/libspqr.so
-- Found Config headers in: /usr/include/suitesparse
-- Found Config library: /usr/lib/x86_64-linux-gnu/libsuitesparseconfig.so
-- Found Intel Thread Building Blocks (TBB) library (2020.1 / 11101) include location: . Assuming SuiteSparseQR was compiled with TBB.
-- Adding librt to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing).
-- Could NOT find METIS (missing: METIS_INCLUDE_DIR METIS_LIBRARY) 
-- Building with NVIDIA Optical Flow API 2.0
-- 
-- General configuration for OpenCV 4.5.2 =====================================
--   Version control:               unknown
-- 
--   Extra modules:
--     Location (extra):            /home/ai/nvidia/opencv_contrib-4.5.2/modules
--     Version control (extra):     unknown
-- 
--   Platform:
--     Timestamp:                   2023-05-21T12:21:47Z
--     Host:                        Linux 5.15.0-72-generic x86_64
--     CMake:                       3.26.0
--     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 (17 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 (31 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
--       AVX512_SKX (7 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++ standard:                11
--     C++ Compiler:                /usr/bin/c++  (ver 9.4.0)
--     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 -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -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):           -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 -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/cc
--     C flags (Release):           -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -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=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -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,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a   -Wl,--gc-sections -Wl,--as-needed  
--     Linker flags (Debug):        -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a   -Wl,--gc-sections -Wl,--as-needed  
--     ccache:                      NO
--     Precompiled headers:         NO
--     Extra dependencies:          m pthread cudart_static dl rt nppc nppial nppicc nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda-11.2/lib64 -L/usr/lib/x86_64-linux-gnu
--     3rdparty dependencies:
-- 
--   OpenCV modules:
--     To be built:                 alphamat 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 intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python2 quality rapid reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    cudacodec world
--     Disabled by dependency:      -
--     Unavailable:                 cnn_3dobj cvv java julia matlab ovis python3 viz
--     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:                 NO
-- 
--   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:                        build (ver encoder: 0x020f)
--     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 2.4.0)
--     OpenEXR:                     /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so (ver 2_3)
--     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:                   2020.0.0 Gold [2020.0.0]
--            at:                   /home/ai/nvidia/opencv-4.5.2/build/3rdparty/ippicv/ippicv_lnx/icv
--     Intel IPP IW:                sources (2020.0.0)
--               at:                /home/ai/nvidia/opencv-4.5.2/build/3rdparty/ippicv/ippicv_lnx/iw
--     VA:                          YES
--     Lapack:                      YES (/usr/lib/x86_64-linux-gnu/liblapack.so /usr/lib/x86_64-linux-gnu/libcblas.so /usr/lib/x86_64-linux-gnu/libatlas.so)
--     Eigen:                       YES (ver 3.3.7)
--     Custom HAL:                  NO
--     Protobuf:                    build (3.5.1)
-- 
--   NVIDIA CUDA:                   YES (ver 11.2, CUFFT CUBLAS FAST_MATH)
--     NVIDIA GPU arch:             86
--     NVIDIA PTX archs:
-- 
--   cuDNN:                         YES (ver 8.1.0)
-- 
--   OpenCL:                        YES (INTELVA)
--     Include path:                /home/ai/nvidia/opencv-4.5.2/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
-- 
--   Python 2:
--     Interpreter:                 /usr/bin/python2.7 (ver 2.7.18)
--     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.18)
--     numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.16.5)
--     install path:                lib/python2.7/dist-packages/cv2/python-2.7
-- 
--   Python (for build):            /usr/bin/python2.7
-- 
--   Java:                          
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
-- 
--   Install to:                    /usr/local
-- -----------------------------------------------------------------
-- 
-- Configuring done (3.2s)
-- Generating done (0.9s)
-- Build files have been written to: /home/ai/nvidia/opencv-4.5.2/build
[  0%] Built target gen-pkgconfig
[  0%] Built target opencv_videoio_plugins
[  0%] Built target ittnotify
[  0%] Built target quirc
[  0%] Built target gen_opencv_python_source
[  0%] Built target numeric
[  1%] Built target ippiw
[  2%] Built target libopenjp2
[  2%] Built target ade
[  3%] Built target opencv_cudev
[  3%] Building CXX object modules/sfm/src/libmv/libmv/multiview/CMakeFiles/multiview.dir/fundamental.cc.o
[  3%] Building CXX object modules/sfm/src/libmv/libmv/multiview/CMakeFiles/multiview.dir/homography.cc.o
[  8%] Built target libwebp
[ 11%] Built target libprotobuf
[ 15%] Built target opencv_core
[ 15%] Built target opencv_hdf
[ 15%] Built target opencv_version
[ 15%] Built target opencv_flann
[ 15%] Built target opencv_surface_matching
[ 16%] Built target opencv_ml
[ 18%] Built target opencv_cudaarithm
[ 22%] Built target opencv_imgproc
[ 22%] Built target opencv_plot
[ 22%] Built target opencv_phase_unwrapping
[ 22%] Built target opencv_freetype
[ 22%] Built target opencv_quality
[ 22%] Built target opencv_intensity_transform
[ 22%] Built target opencv_fuzzy
[ 22%] Built target opencv_img_hash
[ 22%] Built target opencv_cudawarping
[ 22%] Built target opencv_alphamat
[ 23%] Built target opencv_hfs
[ 24%] Built target opencv_reg
[ 26%] Built target opencv_cudafilters
[ 27%] Built target opencv_imgcodecs
[ 29%] Built target opencv_features2d
[ 29%] Built target opencv_line_descriptor
[ 29%] Built target opencv_cudafeatures2d
[ 29%] Built target opencv_saliency
[ 29%] Built target opencv_videoio
[ 30%] Built target opencv_cudaimgproc
[ 30%] Built target opencv_highgui
[ 31%] Built target opencv_annotation
[ 31%] Built target opencv_visualisation
[ 32%] Built target opencv_photo
[ 33%] Built target opencv_ts
[ 34%] Built target opencv_bioinspired
[ 35%] Built target opencv_xphoto
[ 35%] Built target opencv_test_phase_unwrapping
[ 35%] Built target opencv_test_intensity_transform
[ 36%] Built target opencv_test_cudafilters
[ 36%] Built target opencv_test_hdf
[ 36%] Built target opencv_test_flann
[ 37%] Built target opencv_test_reg
[ 37%] Built target opencv_perf_reg
[ 37%] Built target opencv_perf_cudaarithm
[ 39%] Built target opencv_calib3d
[ 39%] Built target opencv_test_quality
[ 39%] Built target opencv_perf_cudafilters
[ 39%] Built target opencv_perf_cudawarping
[ 39%] Built target opencv_test_cudaarithm
[ 39%] Built target opencv_perf_imgcodecs
[ 39%] Built target opencv_test_cudawarping
[ 40%] Built target opencv_test_fuzzy
[ 40%] Built target opencv_perf_features2d
[ 41%] Built target opencv_test_ml
[ 41%] Built target opencv_test_img_hash
[ 42%] Built target opencv_perf_cudaimgproc
[ 42%] Built target opencv_test_line_descriptor
[ 42%] Built target opencv_test_cudaimgproc
[ 42%] Built target opencv_perf_line_descriptor
[ 43%] Built target opencv_test_imgcodecs
[ 43%] Built target opencv_test_saliency
[ 43%] Built target opencv_perf_photo
[ 48%] Built target opencv_dnn
[ 48%] Built target opencv_perf_videoio
[ 49%] Built target opencv_test_cudev
[ 49%] Built target opencv_test_cudafeatures2d
[ 49%] Built target opencv_perf_xphoto
[ 49%] Built target opencv_perf_cudafeatures2d
[ 49%] Built target opencv_test_highgui
[ 49%] Built target opencv_rapid
[ 49%] Built target opencv_test_photo
[ 50%] Built target opencv_test_features2d
[ 50%] Built target opencv_perf_calib3d
[ 50%] Built target opencv_test_xphoto
[ 50%] Built target opencv_structured_light
[ 50%] Built target opencv_test_videoio
[ 50%] Built target opencv_test_bioinspired
[ 50%] Built target opencv_cudastereo
[ 50%] Built target opencv_perf_bioinspired
[ 50%] Built target opencv_dnn_objdetect
[ 50%] Built target opencv_model_diagnostics
[ 50%] Built target opencv_aruco
[ 52%] Built target opencv_perf_core
[ 52%] Built target opencv_ccalib
[ 52%] Built target opencv_shape
[ 52%] Built target opencv_objdetect
[ 52%] Built target opencv_dnn_superres
[ 54%] Built target opencv_perf_imgproc
[ 54%] Built target opencv_perf_cudastereo
[ 54%] Built target opencv_test_rapid
[ 54%] Built target opencv_test_cudastereo
[ 55%] Built target opencv_text
[ 55%] Built target opencv_test_dnn_superres
[ 56%] Built target opencv_perf_dnn
[ 57%] Built target opencv_test_structured_light
[ 57%] Built target opencv_test_aruco
[ 57%] Built target opencv_perf_dnn_superres
[ 57%] Built target opencv_interactive-calibration
[ 57%] Built target opencv_test_shape
[ 57%] Built target opencv_test_objdetect
[ 57%] Built target opencv_perf_objdetect
[ 57%] Built target opencv_xobjdetect
[ 58%] Built target opencv_mcc
[ 58%] Built target opencv_test_text
[ 59%] Built target opencv_dpm
[ 60%] Built target opencv_test_dnn
[ 60%] Built target opencv_waldboost_detector
[ 60%] Built target opencv_test_mcc
[ 62%] Built target opencv_test_calib3d
[ 64%] Built target opencv_video
[ 64%] Built target opencv_rgbd
[ 64%] Built target opencv_face
[ 64%] Built target opencv_bgsegm
[ 66%] Built target opencv_wechat_qrcode
[ 66%] Built target opencv_cudabgsegm
[ 67%] Built target opencv_perf_rgbd
[ 68%] Built target opencv_datasets
[ 70%] Built target opencv_test_core
[ 70%] Built target opencv_test_bgsegm
[ 70%] Built target opencv_test_wechat_qrcode
[ 71%] Built target opencv_test_rgbd
[ 71%] Built target opencv_test_face
[ 73%] Built target opencv_xfeatures2d
[ 73%] Built target opencv_test_video
[ 74%] Built target opencv_perf_video
[ 74%] Built target opencv_perf_cudabgsegm
[ 74%] Built target opencv_test_cudabgsegm
[ 75%] Built target opencv_cudalegacy
[ 77%] Built target opencv_test_imgproc
[ 77%] Built target opencv_cudaobjdetect
[ 77%] Built target opencv_perf_cudalegacy
[ 77%] Built target opencv_test_cudaobjdetect
[ 77%] Built target opencv_perf_cudaobjdetect
[ 77%] Built target opencv_perf_xfeatures2d
[ 78%] Built target opencv_test_xfeatures2d
[ 79%] Built target opencv_stitching
[ 80%] Built target opencv_test_cudalegacy
[ 81%] Built target opencv_tracking
[ 81%] Built target opencv_perf_tracking
[ 81%] Built target opencv_stereo
[ 81%] Built target opencv_perf_stitching
[ 81%] Built target opencv_test_tracking
[ 81%] Built target opencv_test_stitching
[ 81%] Built target opencv_perf_stereo
[ 81%] Built target opencv_test_stereo
[ 82%] Built target opencv_ximgproc
[ 85%] Built target opencv_gapi
[ 87%] Built target opencv_perf_ximgproc
[ 87%] Built target opencv_optflow
[ 87%] Built target opencv_perf_optflow
[ 88%] Built target opencv_test_optflow
[ 89%] Built target opencv_cudaoptflow
[ 90%] Built target opencv_test_ximgproc
[ 91%] Built target opencv_perf_gapi
[ 91%] Built target opencv_test_cudaoptflow
[ 91%] Built target opencv_perf_cudaoptflow
[ 91%] Linking CXX shared library ../../lib/libopencv_superres.so
[ 91%] Linking CXX shared library ../../lib/libopencv_videostab.so
[ 94%] Built target opencv_test_gapi
[ 95%] Built target opencv_superres
[ 96%] Built target opencv_videostab
[ 96%] Building CXX object modules/superres/CMakeFiles/opencv_test_superres.dir/test/test_main.cpp.o
[ 96%] Building CXX object modules/superres/CMakeFiles/opencv_test_superres.dir/test/test_superres.cpp.o
[ 96%] Building CXX object modules/superres/CMakeFiles/opencv_perf_superres.dir/perf/perf_main.cpp.o
[ 96%] Building CXX object modules/superres/CMakeFiles/opencv_perf_superres.dir/perf/perf_superres.cpp.o
[ 96%] Building CXX object modules/videostab/CMakeFiles/opencv_test_videostab.dir/test/test_main.cpp.o
[ 96%] Building CXX object modules/videostab/CMakeFiles/opencv_test_videostab.dir/test/test_motion_estimation.cpp.o
[ 96%] Building CXX object modules/videostab/CMakeFiles/opencv_test_videostab.dir/test/test_stabilizer.cpp.o
[ 96%] Linking CXX executable ../../bin/opencv_test_superres
[ 96%] Built target opencv_test_superres
[ 96%] Linking CXX executable ../../bin/opencv_test_videostab
[ 96%] Built target opencv_test_videostab
[ 96%] Linking CXX executable ../../bin/opencv_perf_superres
[ 96%] Built target opencv_perf_superres
[ 96%] Linking CXX static library ../../../../../../lib/libmultiview.a
[ 96%] Built target multiview
[ 96%] Built target correspondence
[ 96%] Building CXX object modules/sfm/src/libmv/libmv/simple_pipeline/CMakeFiles/simple_pipeline.dir/bundle.cc.o
[ 96%] Building CXX object modules/sfm/src/libmv/libmv/simple_pipeline/CMakeFiles/simple_pipeline.dir/intersect.cc.o
[ 96%] Building CXX object modules/sfm/src/libmv/libmv/simple_pipeline/CMakeFiles/simple_pipeline.dir/keyframe_selection.cc.o
[ 97%] Linking CXX static library ../../../../../../lib/libsimple_pipeline.a
[ 97%] Built target simple_pipeline
make[2]: *** No rule to make target 'cublas', needed by 'lib/libopencv_sfm.so.4.5.2'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:9007: modules/sfm/CMakeFiles/opencv_sfm.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

Thanks for the help in advance

Steps to reproduce

None

Issue submission checklist

cudawarped commented 1 year ago

I suspect this maybe the same issue related to the way Ceras solver defines the CUDA targets, see https://github.com/opencv/opencv/issues/23422

Can you try building against these PR's to see if this solves your issue https://github.com/opencv/opencv/pull/23021, https://github.com/opencv/opencv_contrib/pull/3400

Alex-43760 commented 1 year ago

I followed the instructions within #23422 using -D BUILD_opencv_sfm=OFF The result is as follows (AIenv) ai@ai:~/nvidia/opencv-4.5.2/build$ make -j20 [ 0%] Built target gen-pkgconfig [ 0%] Built target opencv_videoio_plugins [ 0%] Built target ittnotify [ 1%] Built target quirc [ 3%] Built target ippiw [ 4%] Built target libopenjp2 [ 4%] Built target gen_opencv_python_source [ 4%] Built target ade [ 4%] Built target opencv_cudev [ 9%] Built target libwebp [ 12%] Built target libprotobuf [ 17%] Built target opencv_core [ 17%] Built target opencv_hdf [ 17%] Built target opencv_version [ 17%] Built target opencv_flann [ 17%] Built target opencv_surface_matching [ 18%] Built target opencv_ml [ 22%] Built target opencv_imgproc [ 23%] Built target opencv_plot [ 23%] Built target opencv_intensity_transform [ 23%] Built target opencv_phase_unwrapping [ 23%] Built target opencv_quality [ 23%] Built target opencv_freetype [ 24%] Built target opencv_cudaarithm [ 24%] Built target opencv_reg [ 24%] Built target opencv_fuzzy [ 24%] Built target opencv_alphamat [ 24%] Built target opencv_img_hash [ 25%] Built target opencv_hfs [ 25%] Built target opencv_cudawarping [ 26%] Built target opencv_imgcodecs [ 28%] Built target opencv_features2d [ 29%] Built target opencv_videoio [ 30%] Built target opencv_line_descriptor [ 31%] Built target opencv_saliency [ 31%] Built target opencv_highgui [ 31%] Built target opencv_annotation [ 31%] Built target opencv_visualisation [ 32%] Built target opencv_cudafilters [ 33%] Built target opencv_bioinspired [ 34%] Built target opencv_ts [ 36%] Built target opencv_calib3d [ 36%] Built target opencv_test_flann [ 36%] Built target opencv_test_hdf [ 36%] Built target opencv_test_intensity_transform [ 36%] Built target opencv_perf_cudaarithm [ 36%] Built target opencv_test_phase_unwrapping [ 36%] Built target opencv_test_reg [ 36%] Built target opencv_perf_reg [ 36%] Built target opencv_test_cudafilters [ 36%] Built target opencv_test_cudaarithm [ 37%] Built target opencv_perf_cudafilters [ 37%] Built target opencv_test_quality [ 38%] Built target opencv_test_ml [ 38%] Built target opencv_cudafeatures2d [ 38%] Built target opencv_perf_cudawarping [ 39%] Built target opencv_test_cudawarping [ 39%] Built target opencv_perf_imgcodecs [ 39%] Built target opencv_perf_features2d [ 39%] Built target opencv_test_fuzzy [ 39%] Built target opencv_perf_line_descriptor [ 39%] Built target opencv_test_line_descriptor [ 39%] Built target opencv_test_img_hash [ 39%] Built target opencv_test_saliency [ 39%] Built target opencv_test_imgcodecs [ 40%] Built target opencv_perf_core [ 40%] Built target opencv_perf_videoio [ 41%] Built target opencv_test_features2d [ 41%] Built target opencv_test_cudafeatures2d [ 41%] Built target opencv_perf_cudafeatures2d [ 42%] Built target opencv_test_highgui [ 42%] Built target opencv_rapid [ 43%] Built target opencv_perf_calib3d [ 45%] Built target opencv_perf_imgproc [ 45%] Built target opencv_test_videoio [ 45%] Built target opencv_structured_light [ 45%] Built target opencv_objdetect [ 45%] Built target opencv_aruco [ 45%] Built target opencv_shape [ 46%] Built target opencv_test_bioinspired [ 46%] Built target opencv_test_rapid [ 46%] Built target opencv_perf_bioinspired [ 51%] Built target opencv_dnn [ 51%] Built target opencv_ccalib [ 52%] Built target opencv_cudastereo [ 52%] Built target opencv_test_structured_light [ 52%] Built target opencv_test_objdetect [ 52%] Built target opencv_xobjdetect [ 52%] Built target opencv_perf_objdetect [ 54%] Built target opencv_dpm [ 54%] Built target opencv_test_calib3d [ 54%] Built target opencv_test_aruco [ 54%] Built target opencv_interactive-calibration [ 54%] Built target opencv_dnn_superres [ 54%] Built target opencv_test_shape [ 54%] Built target opencv_perf_dnn [ 54%] Built target opencv_text [ 56%] Built target opencv_cudaimgproc [ 57%] Built target opencv_rgbd [ 57%] Built target opencv_test_dnn [ 57%] Built target opencv_dnn_objdetect [ 57%] Built target opencv_model_diagnostics [ 57%] Built target opencv_waldboost_detector [ 59%] Built target opencv_test_core [ 59%] Built target opencv_mcc [ 61%] Built target opencv_test_cudev [ 61%] Built target opencv_perf_cudastereo [ 61%] Built target opencv_test_cudastereo [ 61%] Built target opencv_test_dnn_superres [ 61%] Built target opencv_perf_dnn_superres [ 61%] Built target opencv_test_text [ 64%] Built target opencv_test_imgproc [ 64%] Built target opencv_test_mcc [ 64%] Built target opencv_perf_rgbd [ 64%] Built target opencv_test_cudaimgproc [ 64%] Built target opencv_perf_cudaimgproc [ 65%] Built target opencv_test_rgbd [ 68%] Built target opencv_wechat_qrcode [ 71%] Built target opencv_video [ 71%] Built target opencv_datasets [ 71%] Built target opencv_photo [ 72%] Built target opencv_test_wechat_qrcode [ 72%] Built target opencv_bgsegm [ 73%] Built target opencv_xfeatures2d [ 74%] Built target opencv_cudabgsegm [ 75%] Built target opencv_perf_photo [ 76%] Built target opencv_test_video [ 77%] Built target opencv_test_photo [ 77%] Built target opencv_xphoto [ 77%] Built target opencv_perf_video [ 77%] Built target opencv_test_bgsegm [ 77%] Built target opencv_perf_cudabgsegm [ 78%] Built target opencv_test_cudabgsegm [ 78%] Built target opencv_test_xfeatures2d [ 79%] Built target opencv_perf_xfeatures2d [ 80%] Built target opencv_tracking [ 80%] Built target opencv_face [ 80%] Built target opencv_perf_xphoto [ 81%] Built target opencv_test_xphoto [ 81%] Built target opencv_perf_tracking [ 82%] Built target opencv_stereo [ 82%] Built target opencv_test_tracking [ 83%] Built target opencv_test_face [ 84%] Built target opencv_cudalegacy [ 86%] Built target opencv_ximgproc [ 86%] Built target opencv_test_stereo [ 86%] Built target opencv_perf_stereo [ 86%] Built target opencv_perf_cudalegacy [ 86%] Built target opencv_cudaobjdetect [ 89%] Built target opencv_gapi [ 90%] Built target opencv_test_cudalegacy [ 91%] Built target opencv_perf_ximgproc [ 92%] Built target opencv_optflow [ 92%] Built target opencv_test_cudaobjdetect [ 92%] Built target opencv_perf_cudaobjdetect [ 92%] Built target opencv_stitching [ 93%] Built target opencv_test_ximgproc [ 93%] Built target opencv_test_optflow [ 93%] Built target opencv_perf_optflow [ 94%] Built target opencv_perf_gapi [ 94%] Built target opencv_perf_stitching [ 94%] Built target opencv_cudaoptflow [ 95%] Built target opencv_test_stitching [ 95%] Built target opencv_test_cudaoptflow [ 95%] Built target opencv_perf_cudaoptflow [ 96%] Built target opencv_superres [ 96%] Built target opencv_test_superres [ 97%] Built target opencv_perf_superres [ 97%] Built target opencv_videostab [ 97%] Built target opencv_test_videostab [100%] Built target opencv_test_gapi [100%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir//src2/cv2.cpp.o In file included from /home/ai/nvidia/opencv-4.5.2/modules/python/src2/cv2.cpp:41: /home/ai/nvidia/opencv-4.5.2/build/modules/python_bindings_generator/pyopencv_generated_include.h:198:10: fatal error: opencv2/sfm/conditioning.hpp: No such file or directory 198 | #include "opencv2/sfm/conditioning.hpp" | ^~~~~~~~~~ compilation terminated. make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/build.make:76: modules/python2/CMakeFiles/opencv_python2.dir//src2/cv2.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:9847: modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2 make: [Makefile:166: all] Error 2

cudawarped commented 1 year ago

Did you clean your build directory and re-generate the build files first?

Alex-43760 commented 1 year ago

Thank you, It succeeded I cleaned my files and re-build and it worked

Alex-43760 commented 1 year ago

When I tested installing cuda with OpenCV 4.5.2 The result was (AIenv) ai@ai:~/nvidia/opencv-4.5.2/build$ python3 Python 3.8.10 (default, Mar 13 2023, 10:26:41) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import cv2 count = cv2.cuda.getCudaEnabledDeviceCount() Traceback (most recent call last): File "", line 1, in cv2.error: OpenCV(4.5.2) /home/ai/nvidia/opencv-4.5.2/modules/core/src/cuda_info.cpp:62: error: (-217:Gpu API call) unknown error in function 'getCudaEnabledDeviceCount' What's the reason ??

cudawarped commented 1 year ago

Which GPU do you have and what is your output from print(cv.getBuildInformation())?

Alex-43760 commented 1 year ago

my gpu is GeForce RTX 3070 Ti This line came out print(cv.getBuildInformation()) is

print(cv2.getBuildInformation())

General configuration for OpenCV 4.5.2 ===================================== Version control: unknown

Extra modules: Location (extra): /home/ai/nvidia/opencv_contrib-4.5.2/modules Version control (extra): unknown

Platform: Timestamp: 2023-05-23T11:36:56Z Host: Linux 5.15.0-72-generic x86_64 CMake: 3.26.0 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 (17 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 (31 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX512_SKX (7 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++ standard: 11 C++ Compiler: /usr/bin/c++ (ver 9.4.0) 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 -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -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): -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 -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/cc C flags (Release): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -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=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -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,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed
Linker flags (Debug): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed
ccache: NO Precompiled headers: NO Extra dependencies: m pthread cudart_static dl rt nppc nppial nppicc nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda-11.2/lib64 -L/usr/lib/x86_64-linux-gnu 3rdparty dependencies:

OpenCV modules: To be built: alphamat 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 intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python2 python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto Disabled: cudacodec sfm world Disabled by dependency: - Unavailable: cnn_3dobj cvv java julia matlab ovis viz 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: NO

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: build (ver encoder: 0x020f) 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 2.4.0) OpenEXR: /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so (ver 2_3) 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: 2020.0.0 Gold [2020.0.0] at: /home/ai/nvidia/opencv-4.5.2/build/3rdparty/ippicv/ippicv_lnx/icv Intel IPP IW: sources (2020.0.0) at: /home/ai/nvidia/opencv-4.5.2/build/3rdparty/ippicv/ippicv_lnx/iw VA: YES Lapack: YES (/usr/lib/x86_64-linux-gnu/liblapack.so /usr/lib/x86_64-linux-gnu/libcblas.so /usr/lib/x86_64-linux-gnu/libatlas.so) Eigen: YES (ver 3.3.7) Custom HAL: NO Protobuf: build (3.5.1)

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

cuDNN: YES (ver 8.1.0)

OpenCL: YES (INTELVA) Include path: /home/ai/nvidia/opencv-4.5.2/3rdparty/include/opencl/1.2 Link libraries: Dynamic load

Python 2: Interpreter: /usr/bin/python2.7 (ver 2.7.18) Libraries: /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.18) numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.16.5) install path: lib/python2.7/dist-packages/cv2/python-2.7

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

Python (for build): /usr/bin/python2.7

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

Install to: /usr/local

cudawarped commented 1 year ago

Not sure why cv2.cuda.getCudaEnabledDeviceCount() is throwing that error.

I would confirm that the C++ CUDA tests work, e.g.

OPENCV_BUILD_DIR/bin/opencv_test_cudaarithm --gtest_filter=CUDA_Arithm/GEMM.Accuracy/0

If so you could confirm that both opencv_test_cudaarithm and /home/ai/.virtualenvs/AIenv/lib/python3.8/site-packages/cv2/python-3.8/cv2.abi3.so are linked to the same CUDA libs incase you have more than one CUDA install, e.g. compare the output of

ldd OPENCV_BUILD_DIR/bin/opencv_test_cudaarithm | grep cuda and

ldd /home/ai/.virtualenvs/AIenv/lib/python3.8/site-packages/cv2/python-3.8/cv2.abi3.so | grep cuda

If the above doesn't help it might be worth moving this to the OpenCV forum to see if anyone can offer any help.

Alex-43760 commented 1 year ago

I am grateful to you for your help It worked (AIenv) ai@ai:~$ python3 Python 3.8.10 (default, Mar 13 2023, 10:26:41) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import cv2 count = cv2.cuda.getCudaEnabledDeviceCount() print (count) 1