Opencv Build failed


I tried to build the (opencv _4.6.0 + contrib_4.6.0) with Cuda support (cuda compatibility 3.5) and Cuda SDK Toolkit 10.0. It failed to build.

Here are the steps I have performed,
Used CMAKE GUI + VS 2015.

cmake output

General configuration for OpenCV 4.6.0 =====================================
  Version control:               unknown

  Extra modules:
    Location (extra):            E:/opencv/opencv_contrib-4.6.0/modules
    Version control (extra):     unknown

    Timestamp:                   2022-10-13T11:32:29Z
    Host:                        Windows 10.0.19043 AMD64
    CMake:                       3.24.0-rc5
    CMake generator:             Visual Studio 14 2015
    CMake build tool:            C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
    MSVC:                        1900
    Configuration:               Release

  CPU/HW features:
    Baseline:                    SSE SSE2 SSE3
      requested:                 SSE3
    Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX
      requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
      SSE4_1 (18 files):         + SSSE3 SSE4_1
      SSE4_2 (2 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
      FP16 (1 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
      AVX (5 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX

    Built as dynamic libs?:      YES
    C++ standard:                11
    C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe  (ver 19.0.23026.0)
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:fast     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP  /MD /O2 /Ob2 /DNDEBUG 
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:fast     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP  /MDd /Zi /Ob0 /Od /RTC1 
    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
    C flags (Release):           /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:fast     /MP   /MD /O2 /Ob2 /DNDEBUG 
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:fast     /MP /MDd /Zi /Ob0 /Od /RTC1 
    Linker flags (Release):      /machine:x64  /INCREMENTAL:NO 
    Linker flags (Debug):        /machine:x64  /debug /INCREMENTAL 
    ccache:                      NO
    Precompiled headers:         NO
    Extra dependencies:          cudart_static.lib nppc.lib nppial.lib nppicc.lib nppicom.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cudnn.lib cufft.lib -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/lib/x64
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 aruco barcode bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab wechat_qrcode world xfeatures2d ximgproc xobjdetect xphoto
    Disabled:                    -
    Disabled by dependency:      -
    Unavailable:                 alphamat cvv freetype hdf java julia matlab ovis python2 python3 sfm viz
    Applications:                tests perf_tests apps
    Documentation:               NO
    Non-free algorithms:         NO

  Windows RT support:            NO

    Win32 UI:                    YES
    VTK support:                 NO

  Media I/O: 
    ZLib:                        build (ver 1.2.12)
    JPEG:                        build-libjpeg-turbo (ver 2.1.2-62)
    WEBP:                        build (ver encoder: 0x020f)
    PNG:                         build (ver 1.6.37)
    TIFF:                        build (ver 42 - 4.2.0)
    JPEG 2000:                   build (ver 2.4.0)
    OpenEXR:                     build (ver 2.3.0)
    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES
    PFM:                         YES

  Video I/O:
    DC1394:                      NO
    FFMPEG:                      YES (prebuilt binaries)
      avcodec:                   YES (58.134.100)
      avformat:                  YES (58.76.100)
      avutil:                    YES (56.70.100)
      swscale:                   YES (5.9.100)
      avresample:                YES (4.0.0)
    GStreamer:                   NO
    DirectShow:                  YES
    Media Foundation:            YES
      DXVA:                      NO

  Parallel framework:            Concurrency

  Trace:                         YES (with Intel ITT)

  Other third-party libraries:
    Intel IPP:                   2020.0.0 Gold [2020.0.0]
           at:                   E:/opencv/opencv-4.6.0/build/3rdparty/ippicv/ippicv_win/icv
    Intel IPP IW:                sources (2020.0.0)
              at:                E:/opencv/opencv-4.6.0/build/3rdparty/ippicv/ippicv_win/iw
    Lapack:                      NO
    Eigen:                       NO
    Custom HAL:                  NO
    Protobuf:                    build (3.19.1)

  NVIDIA CUDA:                   YES (ver 10.0, CUFFT CUBLAS FAST_MATH)
    NVIDIA GPU arch:             35
    NVIDIA PTX archs:

  cuDNN:                         YES (ver 7.6.5)

  OpenCL:                        YES (NVD3D11)
    Include path:                E:/opencv/opencv-4.6.0/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python (for build):            C:/Development/Python/Python Umgebung für Eta-Test/allinone/WinPython-64bit-

    ant:                         NO
    JNI:                         NO
    Java wrappers:               NO
    Java tests:                  NO

  Install to:                    E:/opencv/opencv-4.6.0/build/install

On opening the file OpenCV.sln with VS 2015, I perfomed Build to ALL_BUILD under CMakeTargets.

Before this, I have succesfully build the opencv for GPU with cuda compatibility of 8.5 on VS 2019. But with C.C 3.5 i faced issue using V.S 2019 that it should be compiled with VS (13 - 17). So i have installed 2015 and it still threw a lot of errors.

Also I am not able to attach the build logs as it is much bigger then the allowed size here.
snapshot of build error.

120>  test_bgfg_mog2.cpp
120>  test_dis.cpp
120>  test_optflow_farneback.cpp
120>  test_OF_accuracy.cpp
120>  test_OF_reproducibility.cpp
120>  test_accum.cpp
120>  test_camshift.cpp
120>  test_ecc.cpp
120>  test_estimaterigid.cpp
120>  test_kalman.cpp
120>  test_main.cpp
120>  test_trackers.cpp
121>  test_audio.cpp
121>  test_camera.cpp
121>  test_container_avi.cpp
121>  test_dynamic.cpp
121>  test_ffmpeg.cpp
121>  test_gstreamer.cpp
121>  test_main.cpp
121>  test_mfx.cpp
121>  test_microphone.cpp
121>  test_plugins.cpp
121>  test_video_io.cpp
111>  test_colored_kinfu.cpp
111>  test_dynafu.cpp
111>  test_kinfu.cpp
111>  test_main.cpp
111>  test_normal.cpp
111>  test_odometry.cpp
111>  test_pose_graph.cpp
111>  test_registration.cpp
111>  test_utils.cpp
117>LINK : fatal error LNK1181: cannot open input file '..\..\lib\Release\opencv_world460.lib'
100>  test_color.cpp
120>  test_optflowpyrlk.cpp
113>LINK : fatal error LNK1181: cannot open input file '..\..\lib\Release\opencv_world460.lib'
78>  test_intrin128.sse3.cpp
111>  test_tsdf.cpp
121>LINK : fatal error LNK1181: cannot open input file '..\..\lib\Release\opencv_world460.lib'
120>  test_optflowpyrlk.cpp
111>LINK : fatal error LNK1181: cannot open input file '..\..\lib\Release\opencv_world460.lib'
120>LINK : fatal error LNK1181: cannot open input file '..\..\lib\Release\opencv_world460.lib'
100>  test_houghlines.cpp
100>  test_canny.cpp
100>  test_color.cpp
78>LINK : fatal error LNK1181: cannot open input file '..\..\lib\Release\opencv_world460.lib'
100>  test_houghlines.cpp
100>LINK : fatal error LNK1181: cannot open input file '..\..\lib\Release\opencv_world460.lib'

What issuesare you seeing? I’ve used VS2022 with CUDA 11.7 for compute 3.5 without any issues.

Look at the CUDA page on wikipedia,

  • CUDA SDK 10.0 – 10.2 support for compute capability 3.0 – 7.5 (Kepler, Maxwell, Pascal, Volta, Turing). Last version with support for compute capability 3.0 and 3.2 (Kepler in part). 10.2 is the last official release for macOS, as support will not be available for macOS in newer releases.

CUDA - Wikipedia).

  • CUDA SDK 11.8 support for compute capability 3.5 – 9.0 (Kepler (in part), Maxwell, Pascal, Volta, Turing, Ampere, Ada Lovelace, Hopper).[40]

** Kepler (in part) made me choose 10.0
So i assume this information on wikipedia is incorerct. I would definately give it a try with your proposal.
Thanks for the information.

Do you want compute capability 3.5?

Wikipedia is correct.

yes i want 3.5 (GeForce GTX 710).

I can still use VS 2019 and Cuda toolkit 11.7 correct?

Yea according to the Nvidia docs, VS 2019 is supported.

So, I run the build and i got this warning.

25>CUSTOMBUILD : nvcc warning : The ‘compute_35’, ‘compute_37’, ‘sm_35’, and ‘sm_37’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).

This should be ok its a warning so you are aware that CUDA SDK support for your GPU is coming to an end. They are deprecated not removed.

1 Like

Perfect it has worked.
Again thank you for the quick replies.

Short summary of what I have performed.

OpenCV4.6.0 and Opencv_contrib4.6.0
Windows 10
MS VS 2019
GPU Geforce 710 (cuda architecture 3.5)
Cuda Toolkit (11.7)

CMAKE Flags →
with_cuda: True
opencv_dnn_cuda: True
enable_fast_math: True
build_opencv_world: true
opencv_extra_module_pah : give the path to opencv_contribxxx/modules
cuda_fast_math: True
cuda_arch_bin :3.5
cmake_configuration_type Release