opencv编译错误,libopencv_dnn.so.4.4.0,未定义对“ cudnnTransformTensorEx”的引用

问题描述

  1. OpenCV => 4.4.0
  2. 操作系统=> ubuntu 18.04 x86_64
  3. Compiler => cmake 3.10.2
  4. CUDA => 11.0
  5. CUDNN => 8.0.2
  6. GPU => rtx 2080Ti

我试图在conda虚拟环境下编译它。

详细的错误描述命令“ make -j10”失败,并显示以下内容。我不知道为什么libopencv_dnn.so.4.4.0具有未定义的引用。我在github opencv问题页面上看到关于cudnn 8.0的一些固定问题。 opencv dnn现在支持cudnn 8.0吗? 报告:

scanning dependencies of target opencv_test_dnn
[ 56%] Built target opencv_test_cudawarping
[ 56%] Building CXX object modules/dnn/CMakeFiles/opencv_test_dnn.dir/test/test_caffe_importer.cpp.o
Scanning dependencies of target opencv_dnn_superres
[ 56%] Building CXX object modules/dnn_superres/CMakeFiles/opencv_dnn_superres.dir/src/dnn_superres.cpp.o
[ 56%] Linking CXX executable ../../bin/opencv_perf_dnn
../../lib/libopencv_dnn.so.4.4.0:undefined reference to ‘cudnnTransformTensorEx’
../../lib/libopencv_dnn.so.4.4.0:undefined reference to‘cudnnCreateTensorTransformDescriptor’
../../lib/libopencv_dnn.so.4.4.0:undefined reference to‘cudnnDestroyTensorTransformDescriptor’
../../lib/libopencv_dnn.so.4.4.0:undefined reference to‘cudnnSetTensorTransformDescriptor’
collect2: error: ld returned 1 exit status
modules/dnn/CMakeFiles/opencv_perf_dnn.dir/build.make:260: recipe for target 'bin/opencv_perf_dnn' Failed
make[2]: *** [bin/opencv_perf_dnn] Error 1
CMakeFiles/Makefile2:4840: recipe for target 'modules/dnn/CMakeFiles/opencv_perf_dnn.dir/all' Failed
make[1]: *** [modules/dnn/CMakeFiles/opencv_perf_dnn.dir/all] Error 2
make[1]: *** waiting for unfinished job ....

CMake配置为:

-- 
-- General configuration for OpenCV 4.4.0 =====================================
--   Version control:               unkNown
-- 
--   Extra modules:
--     Location (extra):            /home/liuxinyan/opencv_contrib/modules
--     Version control (extra):     unkNown
-- 
--   Platform:
--     Timestamp:                   2020-08-31T07:25:13Z
--     Host:                        Linux 4.15.0-112-generic x86_64
--     CMake:                       3.10.2
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
-- 
-- 
--   OpenCV modules:
--     To be built:                 alphamat aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec 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 ml objdetect optflow phase_unwrapping photo plot python2 python3 quality rapid reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
--     disabled:                    world
--     disabled by dependency:      -
--     Unavailable:                 cnn_3dobj cvv java js julia matlab ovis viz
--     Applications:                tests perf_tests apps
--     Documentation:               NO
--     Non-free algorithms:         YES
-- 
--   GUI: 
--     GTK+:                        YES (ver 3.22.30)
--       GThread :                  YES (ver 2.56.4)
--       GtkGlExt:                  NO
--     VTK support:                 NO
-- 
--   Media I/O: 
--     ZLib:                        /home/liuxinyan/anaconda3/lib/libz.so (ver 1.2.11)
--     JPEG:                        /home/liuxinyan/anaconda3/lib/libjpeg.so (ver 80)
--     WEBP:                        /usr/lib/x86_64-linux-gnu/libwebp.so (ver encoder: 0x020e)
--     PNG:                         /home/liuxinyan/anaconda3/lib/libpng.so (ver 1.6.34)
--     TIFF:                        /home/liuxinyan/anaconda3/lib/libtiff.so (ver 42 / 4.0.9)
--     JPEG 2000:                   OpenJPEG (ver 2.3.0)
--     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 (57.107.100)
--       avformat:                  YES (57.83.100)
--       avutil:                    YES (55.78.100)
--       swscale:                   YES (4.8.100)
--       avresample:                NO
--     GStreamer:                   NO
--     v4l/v4l2:                    YES (linux/videodev2.h)
-- 
--   Parallel framework:            TBB (ver 2017.0 interface 9107)
-- 
--   Trace:                         YES (with Intel ITT)
-- 
--   Other third-party libraries:
--     Intel IPP:                   2020.0.0 Gold [2020.0.0]
--            at:                   /home/liuxinyan/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
--     Intel IPP IW:                sources (2020.0.0)
--               at:                /home/liuxinyan/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
--     Lapack:                      NO
--     Eigen:                       YES (ver 3.3.4)
--     Custom HAL:                  NO
--     Protobuf:                    build (3.5.1)
-- 
--   NVIDIA CUDA:                   YES (ver 11.0,CUFFT CUBLAS FAST_MATH)
--     NVIDIA GPU arch:             35 37 50 52 60 61 70 75 80
--     NVIDIA PTX archs:
-- 
--   cuDNN:                         YES (ver 8.0.2)
-- 
--   OpenCL:                        YES (no extra features)
--     Include path:                /home/liuxinyan/opencv/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
-- 
--   Python 2:
--     Interpreter:                 /usr/bin/python2.7 (ver 2.7.17)
--     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.17)
--     numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.13.3)
--     install path:                lib/python2.7/dist-packages/cv2/python-2.7
-- 
--   Python 3:
--     Interpreter:                 /home/liuxinyan/anaconda3/envs/cuda10_2_cudnn_7_6_5/bin/python (ver 3.7.7)
--     Libraries:                   /home/liuxinyan/anaconda3/envs/cuda10_2_cudnn_7_6_5/lib/libpython3.7m.so (ver 3.7.7)
--     numpy:                       /home/liuxinyan/anaconda3/envs/cuda10_2_cudnn_7_6_5/lib/python3.7/site-packages/numpy/core/include (ver 1.19.1)
--     install path:                /home/liuxinyan/anaconda3/envs/cuda10_2_cudnn_7_6_5/lib/python3.7/site-packages/cv2/python-3.7
-- 
--   Python (for build):            /usr/bin/python2.7
-- 
--   Java:                          
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
-- 
--   Install to:                    /home/liuxinyan/anaconda3/envs/cuda10_2_cudnn_7_6_5

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)