cv::cudacodec::createVideoReader segfault
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 ...