Ask Your Question

OpenCV 2.4.9 and Cuda 6.5 not making on Ubuntu 14.04 LTS

asked 2014-11-15 10:57:50 -0600


I am having a lot of trouble making OpenCV with Cuda, as when compiling the libraries, compiler errors are given.

I install Cuda and restart the machine as prompted. I then do cmake to make all the files, which says that it has found Cuda and that it is version 6.5. The command and output is bellow. The trouble starts when I actually run make. When I do, it normally gets so far through, then produces the same set of errors. This can also found bellow.

I can make and compile the libraries if I don't include the Cuda flags in the OpenCV command, and I know Cuda works as the sample programs run perfectly. When trying to find anything about this issue, all I have found is a bug report that got patched 4 months ago, so not sure what is happening. The bug report can be found here.

I have re-downloaded both Cuda and OpenCV.

Sorry about the length of the post, I'm getting really despite!

OpenCV cmake command:


OpenCV cmake return:

-- General configuration for OpenCV 2.4.9 =====================================

-- Version control: 8fe9dad-dirty

-- Platform: -- Host: Linux 3.13.0-34-generic x86_64 -- CMake: -- CMake generator: Unix Makefiles -- CMake build tool: /usr/bin/make

-- Configuration: RELEASE

-- C/C++: -- Built as dynamic libs?: YES -- C++ Compiler: /usr/bin/c++ (ver 4.8.2) -- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG -DNDEBUG -- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g -O0 -DDEBUG -D_DEBUG -- C Compiler: /usr/bin/cc -- C flags (Release): -fsigned-char -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 -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG -DNDEBUG -- C flags (Debug): -fsigned-char -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 -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g -O0 -DDEBUG -D_DEBUG -- Linker flags (Release):
-- Linker flags (Debug):

-- Precompiled headers: YES

-- OpenCV modules: -- To be built: core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib python stitching superres ts videostab -- Disabled: world -- Disabled by dependency: -

-- Unavailable: androidcamera dynamicuda java viz

-- GUI: -- QT 4.x: YES (ver 4.8.6 EDITION = OpenSource) -- QT OpenGL support: YES (/usr/lib/x86_64-linux-gnu/ -- OpenGL support: YES (/usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib ... (more)

edit retag flag offensive close merge delete


I wrote an answer but I didn't read all of the question but your answer is in your question. The bug page is showing what has to be different at the NVCPixelOperations.hpp <a href=>difference</a> page

OrkunK gravatar imageOrkunK ( 2014-12-04 07:28:30 -0600 )edit

Try specifying the compute capability of your card. If not than all cuda supported interfaces are built and probably your cards cannot handle one of those. This is done by adding -D CUDA_ARCH_BIN="3.0" in my case.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-12-04 07:34:01 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-12-04 07:21:39 -0600

OrkunK gravatar image

It's about static syntax at NVCPixelOperations.hpp

open it with `sudo gedit <opencv_sources>/modules/gpu/src/nvidia/core/NVCPixelOperations.hpp

and delete static's which line is starting template<> static inline ....... (from inline fuonction prototypes) but do not delete which has just starting static inline.

I didn't find the bug's page now. But I faced with this problem 1 or 2 months ago.


template<typename TBase> inline __host__ __device__ TBase _pixMaxVal();
template<> inline __host__ __device__ Ncv8u  _pixMaxVal<Ncv8u>()  {return UCHAR_MAX;}
template<> inline __host__ __device__ Ncv16u _pixMaxVal<Ncv16u>() {return USHRT_MAX;}
template<> inline __host__ __device__ Ncv32u _pixMaxVal<Ncv32u>() {return  UINT_MAX;}
template<> inline __host__ __device__ Ncv8s  _pixMaxVal<Ncv8s>()  {return  SCHAR_MAX;}
template<> inline __host__ __device__ Ncv16s _pixMaxVal<Ncv16s>() {return  SHRT_MAX;}
template<> inline __host__ __device__ Ncv32s _pixMaxVal<Ncv32s>() {return   INT_MAX;}
template<> inline __host__ __device__ Ncv32f _pixMaxVal<Ncv32f>() {return   FLT_MAX;}
template<> inline __host__ __device__ Ncv64f _pixMaxVal<Ncv64f>() {return   DBL_MAX;}

template<typename TBase> inline __host__ __device__ TBase _pixMinVal();
template<> inline __host__ __device__ Ncv8u  _pixMinVal<Ncv8u>()  {return 0;}
template<> inline __host__ __device__ Ncv16u _pixMinVal<Ncv16u>() {return 0;}
template<> inline __host__ __device__ Ncv32u _pixMinVal<Ncv32u>() {return 0;}
template<> inline __host__ __device__ Ncv8s  _pixMinVal<Ncv8s>()  {return SCHAR_MIN;}
template<> inline __host__ __device__ Ncv16s _pixMinVal<Ncv16s>() {return SHRT_MIN;}
template<> inline __host__ __device__ Ncv32s _pixMinVal<Ncv32s>() {return INT_MIN;}
template<> inline __host__ __device__ Ncv32f _pixMinVal<Ncv32f>() {return FLT_MIN;}
template<> inline __host__ __device__ Ncv64f _pixMinVal<Ncv64f>() {return DBL_MIN;}
... ...
... ...
... ...
template<typename Tout> inline Tout _pixMakeZero();
template<> inline __host__ __device__ uchar1 _pixMakeZero<uchar1>() {return make_uchar1(0);}
template<> inline __host__ __device__ uchar3 _pixMakeZero<uchar3>() {return make_uchar3(0,0,0);}
template<> inline __host__ __device__ uchar4 _pixMakeZero<uchar4>() {return make_uchar4(0,0,0,0);}
template<> inline __host__ __device__ ushort1 _pixMakeZero<ushort1>() {return make_ushort1(0);}
template<> inline __host__ __device__ ushort3 _pixMakeZero<ushort3>() {return make_ushort3(0,0,0);}
template<> inline __host__ __device__ ushort4 _pixMakeZero<ushort4>() {return make_ushort4(0,0,0,0);}
template<> inline __host__ __device__ uint1 _pixMakeZero<uint1>() {return make_uint1(0);}
template<> inline __host__ __device__ uint3 _pixMakeZero<uint3>() {return make_uint3(0,0,0);}
template<> inline __host__ __device__ uint4 _pixMakeZero<uint4>() {return make_uint4(0,0,0,0);}
template<> inline __host__ __device__ float1 _pixMakeZero<float1>() {return make_float1(0.f);}
template<> inline __host__ __device__ float3 _pixMakeZero<float3>() {return make_float3(0.f,0.f,0.f);}
template<> inline __host__ __device__ float4 _pixMakeZero<float4>() {return make_float4(0.f,0.f,0.f,0.f);}
template<> inline __host__ __device__ double1 _pixMakeZero<double1>() {return make_double1(0.);}
template<> inline __host__ __device__ double3 _pixMakeZero<double3>() {return make_double3(0.,0.,0.);}
template<> inline __host__ __device__ double4 _pixMakeZero<double4>() {return make_double4(0.,0.,0.,0.);}

find these lines and delete static word between template<> and inline it has to be as above and make opencv again.

edit flag offensive delete link more

Question Tools


Asked: 2014-11-15 10:57:50 -0600

Seen: 1,481 times

Last updated: Dec 04 '14