opencv: opencv3.10 does not support cuda8.0rc?

  • OpenCV version: 3.10

  • Host OS: Ubuntu 16.04 amd64

    In which part of the OpenCV library you got the issue?

    I have installed CUDA 8.0RC,Error when build opencv3.10,But opencv2.4.13 is normal. I have noticed that the release time of opencv3.10 is 2015-12-21,Cuda8.0rc release time is about 2016.05,opencv2.4.13 release time is 2016-05-19,I would like to confirm, opencv3.10 does not support cuda8.0rc?

    Compile error :

/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:120:54: error: ‘NppiGraphcutState’ has not been declared
     typedef NppStatus (*init_func_t)(NppiSize oSize, NppiGraphcutState** ppStat
                                                      ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:135:18: error: ‘NppiGraphcutState’ does not name a type
         operator NppiGraphcutState*()
                  ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:141:9: error: ‘NppiGraphcutState’ does not name a type
         NppiGraphcutState* pState;
         ^
In file included from /home/ecarx/opencv-3.1.0/build/modules/cudalegacy/precomp.hpp:75:0:
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp: In constructor ‘{anonymous}::NppiGraphcutStateHandler::NppiGraphcutStateHandler(NppiSize, Npp8u*, {anonymous}::init_func_t)’:
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:127:39: error: ‘pState’ was not declared in this scope
             nppSafeCall( func(sznpp, &pState, pDeviceMem) );
                                       ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp: In destructor ‘{anonymous}::NppiGraphcutStateHandler::~NppiGraphcutStateHandler()’:
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:132:43: error: ‘pState’ was not declared in this scope
             nppSafeCall( nppiGraphcutFree(pState) );
                                           ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:132:49: error: ‘nppiGraphcutFree’ was not declared in this scope
             nppSafeCall( nppiGraphcutFree(pState) );
                                                 ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp: In function ‘void cv::cuda::graphcut(cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::Stream&)’:
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:174:51: error: ‘nppiGraphcutGetSize’ was not declared in this scope
     nppSafeCall( nppiGraphcutGetSize(sznpp, &bufsz) );
                                                   ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:182:61: error: ‘nppiGraphcutInitAlloc’ was not declared in this scope
     NppiGraphcutStateHandler state(sznpp, buf.ptr<Npp8u>(), nppiGraphcutInitAll
                                                             ^
In file included from /home/ecarx/opencv-3.1.0/build/modules/cudalegacy/precomp.hpp:75:0:
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:191:146: error: ‘nppiGraphcut_32s8u’ was not declared in this scope
 nsp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) );
                                                                            ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:196:146: error: ‘nppiGraphcut_32f8u’ was not declared in this scope
 nsp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) );
                                                                            ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp: In function ‘void cv::cuda::graphcut(cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::Stream&)’:
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:246:52: error: ‘nppiGraphcut8GetSize’ was not declared in this scope
     nppSafeCall( nppiGraphcut8GetSize(sznpp, &bufsz) );
                                                    ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:254:61: error: ‘nppiGraphcut8InitAlloc’ was not declared in this scope
     NppiGraphcutStateHandler state(sznpp, buf.ptr<Npp8u>(), nppiGraphcut8InitAl
                                                             ^
In file included from /home/ecarx/opencv-3.1.0/build/modules/cudalegacy/precomp.hpp:75:0:
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:267:146: error: ‘nppiGraphcut8_32s8u’ was not declared in this scope
 nsp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) );
                                                                            ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:274:146: error: ‘nppiGraphcut8_32f8u’ was not declared in this scope
 nsp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) );
                                                                            ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/build.make:290: recipe for target 'modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o' failed
make[2]: *** [modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o] Error 1

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 10
  • Comments: 23 (2 by maintainers)

Most upvoted comments

For those people who find this page looking for a way to fix this in their build but can’t deal with the volatility of MASTER, here’s the code I used in my build script

cd /opt/opencv-build && \
    git clone https://github.com/Itseez/opencv.git && \
    cd /opt/opencv-build/opencv && \
    git checkout 3.1.0 && \
    git format-patch -1 10896129b39655e19e4e7c529153cb5c2191a1db && \
    git am < 0001-GraphCut-deprecated-in-CUDA-7.5-and-removed-in-8.0.patch

This script snippet will build a single patch file for that one change, then apply that patch using all git commands. It is opencv 3.1.0 + this bugfix and nothing else.

CUDA 8.0 support was fixed in master branch : https://github.com/Itseez/opencv/pull/6510

@mdaiter It doesn’t look like OpenCV does point releases from 3.1, so I don’t expect them to make a release entirely based on this patch. Instead, I forked and will keep this up as best I can. Instead of cloning from the base master, use this instead:

git clone https://github.com/daveselinger/opencv
git checkout 3.1.0-with-cuda8

Then continue on your way. Happy OpenCV’ing.

The simplest thing you can do to solve that CUDA 8.0 support problem:

  1. open “modules/cudalegacy/src/graphcuts.cpp”
  2. change #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) to #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION >= 8000) Worked for me. Hope it will save someone’s day…

@daveselinger could we cherry-pick this commit into the 3.1.0 branch or create a 3.1.1 branch? It seems like many users would benefit from having this automatically added to the 3.1.0 branch or checking out a 3.1.1 branch to avoid confusion + Googling for this solution.

To correct that, it is git checkout 3.1.0-with-cuda8 😄