Skip to content

OpenCV with CUDA cannot be compiled any more with Cuda 10.2 SDK (CMake) #23010

@chacha21

Description

@chacha21

System Information

Windows 7 64 b
Cuda 10.2 (latest version supported by Windows 7)
Visual Studio 2019 (latest)
OpenCV 4.x branch
CMake-gui (3.25.1)

Detailed description

Some time ago, OpenCVDetectCUDA.cmake must have been modified since it now contains

if(WIN32)
     set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcudafe --display_error_number --diag-suppress 1394,1388)

However, the diag-suppress option seems to have been introduced in Cuda 11.2
https://www.readkong.com/page/nvidia-cuda-toolkit-release-notes-for-cuda-11-2-nvidia-2844708
https://docs.nvidia.com/cuda/archive/11.2.0/cuda-compiler-driver-nvcc/index.html#generic-tool-options-diag-suppress

This results in *.cu files of OpenCV stopping compilation with an nvcc "unknown option" error

Steps to reproduce

  • use Cuda 10.2 SDK
  • generate the OpenCV 4.x branch Visual studio 2019 project files with CMake (with CUDA enabled)
  • try to compile, it will stop at the first *.cu file

To fix the problem :

  • edit OpenCVDetectCUDA.cmake and remove --diag-suppress 1394,1388
  • regenerate Visual Studio project files with CMake

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions