Build fails during compilation of cudaimgproc

Hello,
I am trying to compile opencv-4.10.0 from source but I am running into a sudden failure during compilation. Below is at the point where make suddenly fails:

[ 66%] Built target opencv_text
[ 67%] Building CXX object modules/objdetect/CMakeFiles/opencv_objdetect.dir/src/graphical_code_detector.cpp.o
[ 67%] Building CXX object modules/objdetect/CMakeFiles/opencv_objdetect.dir/src/hog.cpp.o
[ 67%] Building CXX object modules/objdetect/CMakeFiles/opencv_objdetect.dir/src/main.cpp.o
[ 67%] Building CXX object modules/objdetect/CMakeFiles/opencv_objdetect.dir/src/qrcode.cpp.o
[ 67%] Building CXX object modules/objdetect/CMakeFiles/opencv_objdetect.dir/src/qrcode_encoder.cpp.o
[ 67%] Building CXX object modules/objdetect/CMakeFiles/opencv_objdetect.dir/opencl_kernels_objdetect.cpp.o
[ 67%] Linking CXX shared library ../../lib/libopencv_video.so
[ 67%] Built target opencv_video
[ 67%] Linking CXX shared library ../../lib/libopencv_objdetect.so
[ 67%] Built target opencv_objdetect
make: *** [Makefile:166: all] Error 2

Here’s my cmake settings for compilation. I am trying to compile headless OpenCV with cuda support (3060) and with the python bindings:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/home/me/software \
-D CMAKE_PREFIX_PATH=/usr/lib  \
-D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules  \
-D WITH_CUDA=ON  \
-D CUDA_ARCH_BIN=8.6  \
-D ARCH=sm_86  \
-D gencode=arch=compute_86,code=sm_86  \
-D ENABLE_FAST_MATH=ON  \
-D CUDA_FAST_MATH=ON  \
-D WITH_CUBLAS=ON  \
-D WITH_CUFFT=ON  \
-D WITH_NVCUVID=ON  \
-D WITH_OPENMP=ON  \
-D BUILD_EXAMPLES=OFF  \
-D BUILD_DOCS=OFF  \
-D BUILD_PERF_TESTS=OFF  \
-D BUILD_TESTS=OFF  \
-D WITH_TBB=OFF  \
-D WITH_IPP=OFF  \
-D WITH_NVCUVID=ON  \
-D WITH_CSTRIPES=ON  \
-D WITH_OPENCL=ON  \
-D WITH_FFMPEG=ON  \
-D CMAKE_CXX_FLAGS="-Ofast"  \
-D WITH_GTK=OFF \
-D OPENCV_DNN_CUDA=ON \
-D BUILD_JAVA=OFF \
-D BUILD_opencv_python2=OFF \
-D CPU_BASELINE=DETECT \
-D WITH_CUDNN=ON \
-D CUDA_FAST_MATH=on \
-D CMAKE_CUDA_COMPILER=$(which nvcc) \
../opencv-4.10.0

Does anyone know what the failure is related to? I do not see any errors, warnings, or log files related to this. I’m using GCC 10.5.0 and nvcc cuda_12.6.r12.6/compiler.35059454_0

that is not when the error happened. it happened earlier.

1 Like

If your using CUDA 12.6 you need to use the latest commits from the 4.x branches of both the opencv and opencv_contrib repositories.

I see, I did not scroll back far enough. This is still on the release on opencv.org (I’ll try the suggestion for cuda 12.6 as well):

[ 71%] Built target opencv_ximgproc
[ 71%] Building CXX object modules/xobjdetect/CMakeFiles/opencv_xobjdetect.dir/src/waldboost.cpp.o
/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp: In static member function ‘static void {anonymous}::NppHistogramEvenC1<SDEPTH, func, get_buf_size>::hist(const cv::cuda::GpuMat&, cv::OutputArray, int, int, int, cv::cuda::Stream&)’:
/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:338:49: error: could not convert ‘h’ from ‘cv::cuda::NppStreamHandler’ to ‘NppStreamContext’
  338 |             get_buf_size(sz, levels, &buf_size, h);
      |                                                 ^
      |                                                 |
      |                                                 cv::cuda::NppStreamHandler
/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp: In static member function ‘static void {anonymous}::NppHistogramEvenC4<SDEPTH, func, get_buf_size>::hist(const cv::cuda::GpuMat&, cv::cuda::GpuMat*, int*, int*, int*, cv::cuda::Stream&)’:
/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:383:49: error: could not convert ‘h’ from ‘cv::cuda::NppStreamHandler’ to ‘NppStreamContext’
  383 |             get_buf_size(sz, levels, &buf_size, h);
      |                                                 ^
      |                                                 |
      |                                                 cv::cuda::NppStreamHandler
/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp: In static member function ‘static void {anonymous}::NppHistogramRangeC1<SDEPTH, func, get_buf_size>::hist(const cv::cuda::GpuMat&, cv::OutputArray, const cv::cuda::GpuMat&, cv::cuda::Stream&)’:
/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:483:54: error: could not convert ‘h’ from ‘cv::cuda::NppStreamHandler’ to ‘NppStreamContext’
  483 |             get_buf_size(sz, levels.cols, &buf_size, h);
      |                                                      ^
      |                                                      |
      |                                                      cv::cuda::NppStreamHandler
/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp: In static member function ‘static void {anonymous}::NppHistogramRangeC4<SDEPTH, func, get_buf_size>::hist(const cv::cuda::GpuMat&, cv::cuda::GpuMat*, const cv::cuda::GpuMat*, cv::cuda::Stream&)’:
/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:534:50: error: could not convert ‘h’ from ‘cv::cuda::NppStreamHandler’ to ‘NppStreamContext’
  534 |             get_buf_size(sz, nLevels, &buf_size, h);
      |                                                  ^
      |                                                  |
      |                                                  cv::cuda::NppStreamHandler
/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp: In function ‘void cv::cuda::histEven(cv::InputArray, cv::OutputArray, int, int, int, cv::cuda::Stream&)’:
/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:602:101: error: could not convert template argument ‘nppiHistogramEvenGetBufferSize_8u_C1R’ from ‘NppStatus(NppiSize, int, size_t*)’ {aka ‘NppStatus(NppiSize, int, long unsigned int*)’} to ‘NppStatus (*)(NppiSize, int, size_t*, NppStreamContext)’ {aka ‘NppStatus (*)(NppiSize, int, long unsigned int*, NppStreamContext)’}
  602 |    NppHistogramEvenC1<CV_8U , nppiHistogramEven_8u_C1R , nppiHistogramEvenGetBufferSize_8u_C1R >::hist,
      |                                                                                                ^

/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:604:101: error: could not convert template argument ‘nppiHistogramEvenGetBufferSize_16u_C1R’ from ‘NppStatus(NppiSize, int, size_t*)’ {aka ‘NppStatus(NppiSize, int, long unsigned int*)’} to ‘NppStatus (*)(NppiSize, int, size_t*, NppStreamContext)’ {aka ‘NppStatus (*)(NppiSize, int, long unsigned int*, NppStreamContext)’}
  604 |    NppHistogramEvenC1<CV_16U, nppiHistogramEven_16u_C1R, nppiHistogramEvenGetBufferSize_16u_C1R>::hist,
      |                                                                                                ^

/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:605:101: error: could not convert template argument ‘nppiHistogramEvenGetBufferSize_16s_C1R’ from ‘NppStatus(NppiSize, int, size_t*)’ {aka ‘NppStatus(NppiSize, int, long unsigned int*)’} to ‘NppStatus (*)(NppiSize, int, size_t*, NppStreamContext)’ {aka ‘NppStatus (*)(NppiSize, int, long unsigned int*, NppStreamContext)’}
  605 |     NppHistogramEvenC1<CV_16S, nppiHistogramEven_16s_C1R, nppiHistogramEvenGetBufferSize_16s_C1R>::hist
      |                                                                                                 ^

/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp: In function ‘void cv::cuda::histEven(cv::InputArray, cv::cuda::GpuMat*, int*, int*, int*, cv::cuda::Stream&)’:
/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:633:101: error: could not convert template argument ‘nppiHistogramEvenGetBufferSize_8u_C4R’ from ‘NppStatus(NppiSize, int*, size_t*)’ {aka ‘NppStatus(NppiSize, int*, long unsigned int*)’} to ‘NppStatus (*)(NppiSize, int*, size_t*, NppStreamContext)’ {aka ‘NppStatus (*)(NppiSize, int*, long unsigned int*, NppStreamContext)’}
  633 |    NppHistogramEvenC4<CV_8U , nppiHistogramEven_8u_C4R , nppiHistogramEvenGetBufferSize_8u_C4R >::hist,
      |                                                                                                ^

/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:635:101: error: could not convert template argument ‘nppiHistogramEvenGetBufferSize_16u_C4R’ from ‘NppStatus(NppiSize, int*, size_t*)’ {aka ‘NppStatus(NppiSize, int*, long unsigned int*)’} to ‘NppStatus (*)(NppiSize, int*, size_t*, NppStreamContext)’ {aka ‘NppStatus (*)(NppiSize, int*, long unsigned int*, NppStreamContext)’}
  635 |    NppHistogramEvenC4<CV_16U, nppiHistogramEven_16u_C4R, nppiHistogramEvenGetBufferSize_16u_C4R>::hist,
      |                                                                                                ^

/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:636:101: error: could not convert template argument ‘nppiHistogramEvenGetBufferSize_16s_C4R’ from ‘NppStatus(NppiSize, int*, size_t*)’ {aka ‘NppStatus(NppiSize, int*, long unsigned int*)’} to ‘NppStatus (*)(NppiSize, int*, size_t*, NppStreamContext)’ {aka ‘NppStatus (*)(NppiSize, int*, long unsigned int*, NppStreamContext)’}
  636 |     NppHistogramEvenC4<CV_16S, nppiHistogramEven_16s_C4R, nppiHistogramEvenGetBufferSize_16s_C4R>::hist
      |                                                                                                 ^

/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp: In function ‘void cv::cuda::histRange(cv::InputArray, cv::OutputArray, cv::InputArray, cv::cuda::Stream&)’:
/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:660:104: error: could not convert template argument ‘nppiHistogramRangeGetBufferSize_8u_C1R’ from ‘NppStatus(NppiSize, int, size_t*)’ {aka ‘NppStatus(NppiSize, int, long unsigned int*)’} to ‘NppStatus (*)(NppiSize, int, size_t*, NppStreamContext)’ {aka ‘NppStatus (*)(NppiSize, int, long unsigned int*, NppStreamContext)’}
  660 | NppHistogramRangeC1<CV_8U , nppiHistogramRange_8u_C1R , nppiHistogramRangeGetBufferSize_8u_C1R >::hist,
      |                                                                                                ^

/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:662:104: error: could not convert template argument ‘nppiHistogramRangeGetBufferSize_16u_C1R’ from ‘NppStatus(NppiSize, int, size_t*)’ {aka ‘NppStatus(NppiSize, int, long unsigned int*)’} to ‘NppStatus (*)(NppiSize, int, size_t*, NppStreamContext)’ {aka ‘NppStatus (*)(NppiSize, int, long unsigned int*, NppStreamContext)’}
  662 | NppHistogramRangeC1<CV_16U, nppiHistogramRange_16u_C1R, nppiHistogramRangeGetBufferSize_16u_C1R>::hist,
      |                                                                                                ^

/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:663:104: error: could not convert template argument ‘nppiHistogramRangeGetBufferSize_16s_C1R’ from ‘NppStatus(NppiSize, int, size_t*)’ {aka ‘NppStatus(NppiSize, int, long unsigned int*)’} to ‘NppStatus (*)(NppiSize, int, size_t*, NppStreamContext)’ {aka ‘NppStatus (*)(NppiSize, int, long unsigned int*, NppStreamContext)’}
  663 | NppHistogramRangeC1<CV_16S, nppiHistogramRange_16s_C1R, nppiHistogramRangeGetBufferSize_16s_C1R>::hist,
      |                                                                                                ^

/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:665:104: error: could not convert template argument ‘nppiHistogramRangeGetBufferSize_32f_C1R’ from ‘NppStatus(NppiSize, int, size_t*)’ {aka ‘NppStatus(NppiSize, int, long unsigned int*)’} to ‘NppStatus (*)(NppiSize, int, size_t*, NppStreamContext)’ {aka ‘NppStatus (*)(NppiSize, int, long unsigned int*, NppStreamContext)’}
  665 |  NppHistogramRangeC1<CV_32F, nppiHistogramRange_32f_C1R, nppiHistogramRangeGetBufferSize_32f_C1R>::hist
      |                                                                                                 ^

/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp: In function ‘void cv::cuda::histRange(cv::InputArray, cv::cuda::GpuMat*, const cv::cuda::GpuMat*, cv::cuda::Stream&)’:
/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:690:104: error: could not convert template argument ‘nppiHistogramRangeGetBufferSize_8u_C4R’ from ‘NppStatus(NppiSize, int*, size_t*)’ {aka ‘NppStatus(NppiSize, int*, long unsigned int*)’} to ‘NppStatus (*)(NppiSize, int*, size_t*, NppStreamContext)’ {aka ‘NppStatus (*)(NppiSize, int*, long unsigned int*, NppStreamContext)’}
  690 | NppHistogramRangeC4<CV_8U , nppiHistogramRange_8u_C4R , nppiHistogramRangeGetBufferSize_8u_C4R >::hist,
      |                                                                                                ^

/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:692:104: error: could not convert template argument ‘nppiHistogramRangeGetBufferSize_16u_C4R’ from ‘NppStatus(NppiSize, int*, size_t*)’ {aka ‘NppStatus(NppiSize, int*, long unsigned int*)’} to ‘NppStatus (*)(NppiSize, int*, size_t*, NppStreamContext)’ {aka ‘NppStatus (*)(NppiSize, int*, long unsigned int*, NppStreamContext)’}
  692 | NppHistogramRangeC4<CV_16U, nppiHistogramRange_16u_C4R, nppiHistogramRangeGetBufferSize_16u_C4R>::hist,
      |                                                                                                ^

/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:693:104: error: could not convert template argument ‘nppiHistogramRangeGetBufferSize_16s_C4R’ from ‘NppStatus(NppiSize, int*, size_t*)’ {aka ‘NppStatus(NppiSize, int*, long unsigned int*)’} to ‘NppStatus (*)(NppiSize, int*, size_t*, NppStreamContext)’ {aka ‘NppStatus (*)(NppiSize, int*, long unsigned int*, NppStreamContext)’}
  693 | NppHistogramRangeC4<CV_16S, nppiHistogramRange_16s_C4R, nppiHistogramRangeGetBufferSize_16s_C4R>::hist,
      |                                                                                                ^

/home/me/Downloads/opencv_contrib/modules/cudaimgproc/src/histogram.cpp:695:104: error: could not convert template argument ‘nppiHistogramRangeGetBufferSize_32f_C4R’ from ‘NppStatus(NppiSize, int*, size_t*)’ {aka ‘NppStatus(NppiSize, int*, long unsigned int*)’} to ‘NppStatus (*)(NppiSize, int*, size_t*, NppStreamContext)’ {aka ‘NppStatus (*)(NppiSize, int*, long unsigned int*, NppStreamContext)’}
  695 |  NppHistogramRangeC4<CV_32F, nppiHistogramRange_32f_C4R, nppiHistogramRangeGetBufferSize_32f_C4R>::hist
      |                                                                                                 ^

make[2]: *** [modules/cudaimgproc/CMakeFiles/opencv_cudaimgproc.dir/build.make:9573: modules/cudaimgproc/CMakeFiles/opencv_cudaimgproc.dir/src/histogram.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:4999: modules/cudaimgproc/CMakeFiles/opencv_cudaimgproc.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Use the latest commits from both repos to include the NPP fixes.

and

@cudawarped thanks, got farther this time when using the latest commits from the 4.x branch. However, am running into another issue:

[ 76%] Linking CXX executable ../../../../bin/opencv_waldboost_detector
/usr/bin/ld: /usr/lib/libOpenEXR-3_3.so.32: undefined reference to `std::ios_base_library_init()@GLIBCXX_3.4.32'
/usr/bin/ld: /usr/lib/libOpenEXR-3_3.so.32: undefined reference to `std::__throw_bad_array_new_length()@GLIBCXX_3.4.29'
/usr/bin/ld: /usr/lib/libIlmThread-3_3.so.32: undefined reference to `__cxa_call_terminate@CXXABI_1.3.15'
/usr/bin/ld: ../../../../lib/libopencv_core.so.4.11.0: undefined reference to `std::condition_variable::wait(std::unique_lock<std::mutex>&)@GLIBCXX_3.4.30'
/usr/bin/ld: /usr/lib/libOpenEXR-3_3.so.32: undefined reference to `std::__glibcxx_assert_fail(char const*, int, char const*, char const*)@GLIBCXX_3.4.30'
collect2: error: ld returned 1 exit status
make[2]: *** [modules/xobjdetect/tools/waldboost_detector/CMakeFiles/opencv_waldboost_detector.dir/build.make:113: bin/opencv_waldboost_detector] Error 1
make[1]: *** [CMakeFiles/Makefile2:6221: modules/xobjdetect/tools/waldboost_detector/CMakeFiles/opencv_waldboost_detector.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

I’m wondering if there’s a problem with my compile toolchain? I’m on arch linux and I installed gcc-10 based off of github issue comments that gcc 14 doesn’t work. Before I ran cmake I export CC to be the path to gcc-10 and CXX to g+±10

It looks like it but I don’t know how to fix it, maybe @berak can advise?

helo, & a good year there !

most errors come from the EXR (floating point images) support for ìmread(). (arc might lack some dev libs here);
you probably can simply disable it from cmake:

-DWITH_OPENEXR=OFF -DBUILD_OPENEXR=OFF

without much loss :wink:

however, it looks like some installed 3rdparty libs (e.g. Ilm, exr, half) on arc were linked against the nglibc std c++ libs (bad fit, different compiler ?)
when in doubt, rebuild such using the same toolchain as with opencv

2 Likes

@berak thanks for the suggestion. After deleting cmakecache, re-running cmake with those suggestions, I’m still getting these linker errors when linking other modules. Here’s the newest one

[ 78%] Linking CXX shared library ../../lib/libopencv_tracking.so
[ 78%] Built target opencv_dpm
[ 80%] Built target opencv_cudalegacy
[ 80%] Processing OpenCL kernels (optflow)
[ 80%] Building CXX object modules/face/CMakeFiles/opencv_face.dir/src/face_alignment.cpp.o
/usr/bin/ld: ../../../../lib/libopencv_core.so.4.11.0: undefined reference to `std::condition_variable::wait(std::unique_lock<std::mutex>&)@GLIBCXX_3.4.30'
[ 80%] Built target opencv_interactive-calibration
collect2: error: ld returned 1 exit status
make[2]: *** [modules/xobjdetect/tools/waldboost_detector/CMakeFiles/opencv_waldboost_detector.dir/build.make:113: bin/opencv_waldboost_detector] Error 1
make[1]: *** [CMakeFiles/Makefile2:6221: modules/xobjdetect/tools/waldboost_detector/CMakeFiles/opencv_waldboost_detector.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

@berak as for ensuring everything is compiled with the same toolchain: I’ve seen it mentioned that opencv can download third-party libraries if it detects that they are missing–is there a setting for cmake to have it pull in all third-party deps and compile those as well? Or, what would be the bare minimum third-party libraries to build if I’m only trying to do a haarcascade (don’t even need to read from image, data coming through as numpy arrays)?

Also, wanting to make sure I’m on the right path here. I’m trying to following this guide on “geeksforgeeks” [1] for opencv cuda setup (except I’m just using it for haar cascades) and I noticed that if I just installed the arch prebuilt opencv-cuda that the Python library reported that there is a cuda device, but all of the cuda algorithms are not available in Python. For example, cv2.cuda_CascadeClassifier and cv2.cuda_GaussianBlur are not defined.

I haven’t seen anything about this online, so I’m assuming that this just means that the prebuilt opencv-cuda package from my package manager doesn’t have the cuda stuff in opencv_contrib–and that compiling it myself will cause those methods to be available in the Python bindings. Is this correct?

import cv2
>>> list(filter(lambda x: 'cuda' in x.lower(), dir(cv2)))
['_INPUT_ARRAY_CUDA_GPU_MAT', '_INPUT_ARRAY_CUDA_HOST_MEM', '_INPUT_ARRAY_STD_VECTOR_CUDA_GPU_MAT', '_InputArray_CUDA_GPU_MAT', '_InputArray_CUDA_HOST_MEM', '_InputArray_STD_VECTOR_CUDA_GPU_MAT', 'cuda', 'cuda_BufferPool', 'cuda_DeviceInfo', 'cuda_Event', 'cuda_GpuData', 'cuda_GpuMat', 'cuda_GpuMatND', 'cuda_GpuMat_Allocator', 'cuda_HostMem', 'cuda_SURF_CUDA', 'cuda_Stream', 'cuda_TargetArchs', 'gapi_onnx_ep_CUDA']
>>> from cv2 import cuda_CascadeClassifier
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    from cv2 import cuda_CascadeClassifier
ImportError: cannot import name 'cuda_CascadeClassifier' from 'cv2' (/usr/lib/python3.13/site-packages/cv2.cpython-313-x86_64-linux-gnu.so)

[1] hxxps://www.geeksforgeeks.org/getting-started-with-opencv-cuda-module/

You’d have to ask the maintainer of the package, but on the basis that it is not dependant on the NPP libraries which are required by most of the OpenCV CUDA modules in the contrib repository, see

https://archlinux.org/packages/extra/x86_64/opencv-cuda/

I would say that this build does not include the contrib repository.

Yep, that was it. gcc-10 --print-file-name=libstdc++.so differed from the regular libstdc++.so so the linker was trying to use the new libstdc++. Final version of the cmake compile command

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/home/me/software \
-D CMAKE_PREFIX_PATH=/usr/lib  \
-D OPENCV_EXTRA_MODULES_PATH=../../src/opencv_contrib/modules  \
-D WITH_CUDA=ON  \
-D CUDA_ARCH_BIN=8.6  \
-D ARCH=sm_86  \
-D gencode=arch=compute_86,code=sm_86  \
-D ENABLE_FAST_MATH=ON  \
-D CUDA_FAST_MATH=ON  \
-D WITH_CUBLAS=ON  \
-D WITH_CUFFT=ON  \
-D WITH_NVCUVID=OFF  \
-D WITH_OPENMP=ON  \
-D BUILD_EXAMPLES=OFF  \
-D BUILD_DOCS=OFF  \
-D BUILD_PERF_TESTS=OFF  \
-D BUILD_TESTS=OFF  \
-D WITH_TBB=OFF  \
-D WITH_IPP=OFF  \
-D WITH_NVCUVID=ON  \
-D WITH_CSTRIPES=ON  \
-D WITH_OPENCL=ON  \
-D WITH_FFMPEG=ON  \
-D CMAKE_CXX_FLAGS="-Ofast"  \
-D WITH_GTK=OFF \
-D OPENCV_DNN_CUDA=ON \
-D BUILD_JAVA=OFF \
-D BUILD_opencv_python2=OFF \
-D CPU_BASELINE=DETECT \
-D WITH_CUDNN=ON \
-D CUDA_FAST_MATH=on \
-D CMAKE_CUDA_COMPILER=$(which nvcc) \
-D WITH_NVCUVENC=OFF \
-D WITH_OPENEXR=OFF \
-D BUILD_OPENEXR=OFF \
-D CMAKE_C_COMPILER=$(which gcc-10) \
-D CMAKE_CXX_COMPILER=$(which g++-10) \
-D CMAKE_BUILD_RPATH=/usr/lib/gcc/x86_64-pc-linux-gnu/10.5.0 \
-D CMAKE_SHARED_LINKER_FLAGS="-L/usr/lib/gcc/x86_64-pc-linux-gnu/10.5.0 -Wl,-rpath,/usr/lib/gcc/x86_64-pc-linux-gnu/10.5.0" \
../../src/opencv

Confirmed that I can import cuda_CascadeClassifier. Thank you all for your assistance.

1 Like