Repository: opencv
Issue: windows7 install opencv with cuda error
Labels: question (invalid tracker),category: build/install,category: gpu/cuda (contrib),platform: win32

<!--
If you have a question rather than reporting a bug please go to https://forum.opencv.org where you get much faster responses.
If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).

This is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library.
-->

##### System information (version)

- OpenCV = :4.7.0:
- OpencvContrib=4.7.0;
- Operating System / Platform = :Windows7 SP! 64 Bit:
- Compiler = :Visual Studio 2019:
- CUDA =10.2;
- CuDNN =7.6.5;
- Cmake = 3.18.3

##### Detailed description

<!-- your description -->
Using cmake-gui compile opencv4.7.0 with cuda, but failed.

##### Steps to reproduce
cmake settings:
WITH_CUDA  OPENCV_DNN_CUDA is check
CUDA_ARCH_BIN 7.5

cmake message:

Selecting Windows SDK version 10.0.19041.0 to target Windows 6.1.7601.
ocv_init_download: OpenCV source tree is not fetched as git repository. 3rdparty resources will be downloaded from github.com by default.
Detected processor: AMD64
Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "2.7")
Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "3.2")
libjpeg-turbo: VERSION = 2.1.3, BUILD = opencv-4.7.0-libjpeg-turbo
libjpeg-turbo(SIMD): SIMD extensions disabled: could not find NASM compiler.  Performance will suffer.
Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources
OpenJPEG: VERSION = 2.4.0, BUILD = opencv-4.7.0-openjp2-2.4.0
OpenJPEG libraries will be built from sources: libopenjp2 (version "2.4.0")
found Intel IPP (ICV version): 2020.0.0 [2020.0.0 Gold]
at: C:/Users/Administrator/Desktop/algorithm/opencv/opencv-4.7.0-source/opencv-470-build-cuda/3rdparty/ippicv/ippicv_win/icv
found Intel IPP Integration Wrappers sources: 2020.0.0
at: C:/Users/Administrator/Desktop/algorithm/opencv/opencv-4.7.0-source/opencv-470-build-cuda/3rdparty/ippicv/ippicv_win/iw
CUDA detected: 10.2
CUDA: Using CUDA_ARCH_BIN=7.5
CUDA NVCC target flags: -gencode;arch=compute_75,code=sm_75;-D_FORCE_INLINES
CUDA: MSVS generator is detected. Disabling CMake re-run checks (CMAKE_SUPPRESS_REGENERATION=ON). You need to run CMake manually if updates are required.
Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
Could NOT find BLAS (missing: BLAS_LIBRARIES) 
LAPACK requires BLAS
A library with LAPACK API not found. Please specify library location.
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
Module opencv_alphamat disabled because the following dependencies are not found: Eigen
freetype2:   NO
harfbuzz:    NO
Julia not found. Not compiling Julia Bindings. 
Module opencv_ovis disabled because OGRE3D was not found
No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
Tesseract:   NO
Processing WORLD modules...
    module opencv_cudev...
    module opencv_core...
Allocator metrics storage type: 'long long'
    module opencv_cudaarithm...
    module opencv_flann...
    module opencv_imgproc...
    module opencv_intensity_transform...
    module opencv_ml...
    module opencv_phase_unwrapping...
    module opencv_plot...
    module opencv_quality...
    module opencv_reg...
    module opencv_surface_matching...
    module opencv_cudafilters...
    module opencv_cudaimgproc...
    module opencv_cudawarping...
    module opencv_dnn...
Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': C:/Users/Administrator/Desktop/algorithm/opencv/opencv-4.7.0-source/opencv-4.7.0/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
    module opencv_dnn_superres...
    module opencv_features2d...
    module opencv_fuzzy...
    module opencv_hfs...
    module opencv_imgcodecs...
imgcodecs: OpenEXR codec is disabled in runtime. Details: https://github.com/opencv/opencv/issues/21326
    module opencv_line_descriptor...
    module opencv_photo...
    module opencv_saliency...
    module opencv_text...
    module opencv_videoio...
    module opencv_xphoto...
    module opencv_barcode...
    module opencv_calib3d...
    module opencv_cudacodec...
    module opencv_cudafeatures2d...
    module opencv_cudastereo...
    module opencv_datasets...
    module opencv_highgui...
highgui: using builtin backend: WIN32UI
    module opencv_mcc...
    module opencv_objdetect...
    module opencv_rapid...
    module opencv_rgbd...
rgbd: Eigen support is disabled. Eigen is Required for Posegraph optimization
    module opencv_shape...
    module opencv_structured_light...
    module opencv_video...
    module opencv_wechat_qrcode...
    module opencv_xfeatures2d...
    module opencv_ximgproc...
    module opencv_xobjdetect...
    module opencv_aruco...
    module opencv_bgsegm...
    module opencv_bioinspired...
    module opencv_ccalib...
    module opencv_cudabgsegm...
    module opencv_cudalegacy...
    module opencv_cudaobjdetect...
    module opencv_dnn_objdetect...
    module opencv_dpm...
    module opencv_face...
    module opencv_gapi...
    module opencv_optflow...
    module opencv_stitching...
    module opencv_tracking...
    module opencv_cudaoptflow...
Building with NVIDIA Optical Flow API 2.0
    module opencv_stereo...
    module opencv_superres...
    module opencv_videostab...
Processing WORLD modules... DONE
Excluding from source files list: modules/imgproc/src/imgwarp.lasx.cpp
Excluding from source files list: modules/imgproc/src/resize.lasx.cpp
Excluding from source files list: <BUILD>/modules/world/layers/layers_common.rvv.cpp
Excluding from source files list: <BUILD>/modules/world/layers/layers_common.lasx.cpp
Excluding from source files list: <BUILD>/modules/world/int8layers/layers_common.lasx.cpp

General configuration for OpenCV 4.7.0 =====================================
  Version control:               unknown

  Extra modules:
    Location (extra):            C:/Users/Administrator/Desktop/algorithm/opencv/opencv-4.7.0-source/opencv_contrib-4.7.0/modules
    Version control (extra):     unknown

  Platform:
    Timestamp:                   2023-11-07T06:08:41Z
    Host:                        Windows 6.1.7601 AMD64
    CMake:                       3.18.3
    CMake generator:             Visual Studio 16 2019
    CMake build tool:            C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe
    MSVC:                        1929
    Configuration:               Debug Release

  CPU/HW features:
    Baseline:                    SSE SSE2 SSE3
      requested:                 SSE3
    Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
      requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
      SSE4_1 (16 files):         + SSSE3 SSE4_1
      SSE4_2 (1 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
      FP16 (0 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
      AVX (4 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
      AVX2 (32 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
      AVX512_SKX (5 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX

  C/C++:
    Built as dynamic libs?:      YES
    C++ standard:                11
    C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe  (ver 19.29.30152.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:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /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:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP  /MDd /Zi /Ob0 /Od /RTC1 
    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/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:precise     /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:precise     /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.2/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:                    java_bindings_generator python_bindings_generator python_tests
    Disabled by dependency:      -
    Unavailable:                 alphamat cvv freetype hdf java julia matlab ovis python2 python3 sfm viz
    Applications:                apps
    Documentation:               NO
    Non-free algorithms:         NO

  Windows RT support:            NO

  GUI: 
    Win32 UI:                    YES
    VTK support:                 NO

  Media I/O: 
    ZLib:                        build (ver 1.2.13)
    JPEG:                        build-libjpeg-turbo (ver 2.1.3-62)
      SIMD Support Request:      YES
      SIMD Support:              NO
    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:                      YES

  Parallel framework:            Concurrency

  Trace:                         YES (with Intel ITT)

  Other third-party libraries:
    Intel IPP:                   2020.0.0 Gold [2020.0.0]
           at:                   C:/Users/Administrator/Desktop/algorithm/opencv/opencv-4.7.0-source/opencv-470-build-cuda/3rdparty/ippicv/ippicv_win/icv
    Intel IPP IW:                sources (2020.0.0)
              at:                C:/Users/Administrator/Desktop/algorithm/opencv/opencv-4.7.0-source/opencv-470-build-cuda/3rdparty/ippicv/ippicv_win/iw
    Lapack:                      NO
    Eigen:                       NO
    Custom HAL:                  NO
    Protobuf:                    build (3.19.1)

  NVIDIA CUDA:                   YES (ver 10.2, CUFFT CUBLAS)
    NVIDIA GPU arch:             75
    NVIDIA PTX archs:

  cuDNN:                         YES (ver 7.6.5)

  OpenCL:                        YES (NVD3D11)
    Include path:                C:/Users/Administrator/Desktop/algorithm/opencv/opencv-4.7.0-source/opencv-4.7.0/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python (for build):            NO

  Install to:                    C:/Users/Administrator/Desktop/algorithm/opencv/opencv-4.7.0-source/opencv-470-build-cuda/install
-----------------------------------------------------------------

Configuring done
Generating done


vs2019 build message:

严重性	代码	说明	项目	文件	行	禁止显示状态
错误		Error processing file: C:/Users/Administrator/Desktop/algorithm/opencv/opencv-4.7.0-source/opencv-470-build-cuda/modules/world/CMakeFiles/cuda_compile_1.dir/__/__/__/opencv_contrib-4.7.0/modules/cudastereo/src/cuda/cuda_compile_1_generated_disparity_bilateral_filter.cu.obj.Release.cmake	opencv_world	C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv-470-build-cuda\modules\world\CUSTOMBUILD	1	

严重性	代码	说明	项目	文件	行	禁止显示状态
错误	MSB8066	“C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudastereo\src\cuda\disparity_bilateral_filter.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudastereo\src\cuda\stereobm.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudastereo\src\cuda\stereobp.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudastereo\src\cuda\stereocsbp.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudastereo\src\cuda\stereosgm.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudastereo\src\cuda\util.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv-470-build-cuda\CMakeFiles\27d4b8b55c0550585bc5bd91a11a2602\opencl_kernels_objdetect.cpp.rule;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv-470-build-cuda\CMakeFiles\27d4b8b55c0550585bc5bd91a11a2602\opencl_kernels_rgbd.cpp.rule;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv-470-build-cuda\CMakeFiles\27d4b8b55c0550585bc5bd91a11a2602\opencl_kernels_video.cpp.rule;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv-470-build-cuda\CMakeFiles\27d4b8b55c0550585bc5bd91a11a2602\opencl_kernels_xfeatures2d.cpp.rule;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\xfeatures2d\src\cuda\surf.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv-470-build-cuda\CMakeFiles\27d4b8b55c0550585bc5bd91a11a2602\opencl_kernels_ximgproc.cpp.rule;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv-470-build-cuda\CMakeFiles\27d4b8b55c0550585bc5bd91a11a2602\opencl_kernels_bioinspired.cpp.rule;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudabgsegm\src\cuda\mog.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudabgsegm\src\cuda\mog2.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudalegacy\src\cuda\NCV.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudalegacy\src\cuda\NCVBroxOpticalFlow.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudalegacy\src\cuda\NCVHaarObjectDetection.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudalegacy\src\cuda\NCVPyramid.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudalegacy\src\cuda\NPP_staging.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudalegacy\src\cuda\bm.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudalegacy\src\cuda\bm_fast.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudalegacy\src\cuda\calib3d.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudalegacy\src\cuda\ccomponetns.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudalegacy\src\cuda\fgd.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudalegacy\src\cuda\gmg.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudalegacy\src\cuda\needle_map.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudaobjdetect\src\cuda\hog.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudaobjdetect\src\cuda\lbp.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv-470-build-cuda\CMakeFiles\27d4b8b55c0550585bc5bd91a11a2602\opencl_kernels_optflow.cpp.rule;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv-470-build-cuda\CMakeFiles\27d4b8b55c0550585bc5bd91a11a2602\opencl_kernels_stitching.cpp.rule;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv-4.7.0\modules\stitching\src\cuda\build_warp_maps.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv-4.7.0\modules\stitching\src\cuda\multiband_blend.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv-470-build-cuda\CMakeFiles\27d4b8b55c0550585bc5bd91a11a2602\opencl_kernels_tracking.cpp.rule;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudaoptflow\src\cuda\farneback.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudaoptflow\src\cuda\nvidiaOpticalFlow.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudaoptflow\src\cuda\pyrlk.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\cudaoptflow\src\cuda\tvl1flow.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv-470-build-cuda\CMakeFiles\27d4b8b55c0550585bc5bd91a11a2602\opencl_kernels_superres.cpp.rule;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\superres\src\cuda\btv_l1_gpu.cu;C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv_contrib-4.7.0\modules\videostab\src\cuda\global_motion.cu”的自定义生成已退出，代码为 1。	opencv_world	C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets	241	

严重性	代码	说明	项目	文件	行	禁止显示状态
错误	LNK1181	无法打开输入文件“..\..\lib\Release\opencv_world470.lib”	opencv_visualisation	C:\Users\Administrator\Desktop\algorithm\opencv\opencv-4.7.0-source\opencv-470-build-cuda\apps\visualisation\LINK	1