Hi,
I'm trying to run an OpenCV sample code presented here: opencv-3.3.1/samples/gpu/video_reader.cpp
, but always get an segmentation fault signal within cv::cudacodec::createVideoReader(fname).
The stack trace is:
1 cv::cudacodec::detail::CuvidVideoSource::CuvidVideoSource(cv::String const&)
2 cv::cudacodec::createVideoReader(cv::String const&)
3 main
Further debugging told me that memory access violation occurs at this line of code in opencv-3.3.1/modules/cudacodec/src/cuvid_video_cource.cpp
:
CUresult cuRes = cuvidCreateVideoSource(&videoSource_, fname.c_str(), ¶ms);
And seems like it calls an invalid address. Disasm also shows memory access violation at callq
command.
Cuda video SDK samples shows that there's a robust dynamic linking presents. Do I need some extra dynamic linking while using OpenCV? Or maybe I do something wrong?
Running ./opencv_test_cudacodec
also ends up with segfault.
What is being linked when I compile the sample:
g++ -Wl,--trace,--rpath,/usr/local/lib,--rpath,/usr/local/cuda/lib64 -Wl,-rpath,/home/den/Qt/5.7/gcc_64/lib -o opencv_cuda_test main.o -lopencv_core -lopencv_cudacodec -lopencv_videoio -lopencv_highgui -lnvcuvid -L/usr/local/cuda/lib64 -L/home/den/Qt/5.7/gcc_64/lib -lQt5Core -lpthread
Specs:
- Ubuntu 16.04;
- GeForce GTX 960;
- Driver Version: 384.90;
- CUDA 9.0
- opencv-3.3.1 (tried both release version and latest 'master' branch)
- This is a configuration of OpenCV:
-- General configuration for OpenCV 3.3.1-dev ===================================== -- Version control: 3.3.1-144-gba940de -- -- Platform: -- Timestamp: 2017-11-13T17:54:56Z -- Host: Linux 4.4.0-98-generic x86_64 -- CMake: 3.5.1 -- 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 -- requested: SSE4_1 SSE4_2 AVX FP16 AVX2 -- SSE4_1 (3 files): + SSSE3 SSE4_1 -- SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 -- FP16 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX -- AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX -- AVX2 (9 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 -- -- C/C++: -- Built as dynamic libs?: YES -- C++ Compiler: /usr/bin/c++ (ver 5.4.0) -- C++ flags (Release): -fsigned-char -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 -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG -- C++ flags (Debug): -fsigned-char -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 -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG -- C Compiler: /usr/bin/cc -- C flags (Release): -fsigned-char -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-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG -- C flags (Debug): -fsigned-char -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-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG -- Linker flags (Release): -- Linker flags (Debug): -- ccache: NO -- Precompiled headers: YES -- Extra dependencies: dl m pthread rt /usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libtbb.so cudart nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cufft -L/usr/local/cuda/lib64 -- 3rdparty dependencies: -- -- OpenCV modules: -- To be built: cudev core cudaarithm flann imgproc ml objdetect video cudabgsegm cudafilters cudaimgproc cudawarping dnn imgcodecs photo shape videoio cudacodec highgui ts features2d calib3d cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo stitching superres videostab python2 -- Disabled: js world -- Disabled by dependency: - -- Unavailable: java python3 viz -- -- GUI: -- QT 5.x: YES (ver 5.5.1) -- QT OpenGL support: YES (Qt5::OpenGL 5.5.1) -- OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGL.so) -- VTK support: NO -- -- Media I/O: -- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8) -- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver ) -- WEBP: build (ver encoder: 0x020e) -- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.54) -- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 4.0.6) -- JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1) -- OpenEXR: build (ver 1.7.1) -- GDAL: NO -- GDCM: NO -- -- Video I/O: -- DC1394 1.x: NO -- DC1394 2.x: YES (ver 2.2.4) -- FFMPEG: YES -- avcodec: YES (ver 56.60.100) -- avformat: YES (ver 56.40.101) -- avutil: YES (ver 54.31.100) -- swscale: YES (ver 3.1.101) -- avresample: YES (ver 2.1.0) -- GStreamer: NO -- OpenNI: NO -- OpenNI PrimeSensor Modules: NO -- OpenNI2: NO -- PvAPI: NO -- GigEVisionSDK: NO -- Aravis SDK: NO -- UniCap: NO -- UniCap ucil: NO -- V4L/V4L2: NO/YES -- XIMEA: NO -- Xine: NO -- Intel Media SDK: NO -- gPhoto2: NO -- -- Parallel framework: TBB (ver 4.4 interface 9002) -- -- Trace: YES (with Intel ITT) -- -- Other third-party libraries: -- Use Intel IPP: 2017.0.3 [2017.0.3] -- at: /home/den/devel/opencv_git/build/3rdparty/ippicv/ippicv_lnx -- Use Intel IPP IW: sources (2017.0.3) -- at: /home/den/devel/opencv_git/build/3rdparty/ippicv/ippiw_lnx -- Use VA: NO -- Use Intel VA-API/OpenCL: NO -- Use Lapack: NO -- Use Eigen: NO -- Use Cuda: YES (ver 9.0) -- Use OpenCL: YES -- Use OpenVX: NO -- Use custom HAL: NO -- -- NVIDIA CUDA -- Use CUFFT: YES -- Use CUBLAS: YES -- USE NVCUVID: YES -- NVIDIA GPU arch: 30 35 37 50 52 60 61 70 -- NVIDIA PTX archs: -- Use fast math: NO -- -- OpenCL: <dynamic loading="" of="" opencl="" library=""> -- Include path: /home/den/devel/opencv_git/3rdparty/include/opencl/1.2 -- Use AMDFFT: NO -- Use AMDBLAS: NO -- -- Python 2: -- Interpreter: /usr/bin/python2.7 (ver 2.7.12) -- Libraries: /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.12) -- numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.11.0) -- packages path: lib/python2.7/dist-packages -- -- Python 3: -- Interpreter: /home/den/.pyenv/shims/python3 (ver 3.5.2) -- -- Python (for build): /usr/bin/python2.7 -- -- Java: -- ant: NO -- JNI: /usr/local/jdk1.8.0_131/include /usr/local/jdk1.8.0_131/include/linux /usr/local/jdk1.8.0_131/include -- Java wrappers: NO -- Java tests: NO -- -- Matlab: Matlab not found or implicitly disabled -- -- Documentation: -- Doxygen: NO -- -- Tests and samples: -- Tests: YES -- Performance tests: YES -- C/C++ Examples: YES -- -- Install path: /usr/local