contrib module CUDEV uses c++ exceptions but not enabled on Windows #19728
Labels
category: build/install
category: gpu/cuda (contrib)
OpenCV 4.0+: moved to opencv_contrib
platform: win32
OpenCV compile that includes contrib module CUDEV, the cmake infrastructure disables C++ exceptions but this module's code needs exceptions. Because of this, the code will behave unpredictably if an exception occurs.
System information (version)
Repro
Result
This warning is issued during compile:
Expected
Clean compile, no warnings, and predictable code execution.
Likely cause
compile_commands.json
created by cmake on Windows shows exceptions are not enabled forcudev/test/test_main.cpp
There are only two
cpp
files in the CUDEV module. The compile command forcudev/src/stub.cpp
correctly includes/EHa
. A suspicious difference in the two compile commands for each. Notice the two spaces betweenAVX
and/wd4127
. This suggests that somewhere is placement for the missing/EHa
and cmake chose to not place it yet the surrounding spaces remain.I suspect the missing flag is due to the following
opencv/cmake/OpenCVDetectCUDA.cmake
Lines 346 to 358 in b19f860
If the test code needs exceptions (as this warning declares), then the
/EHa
needs to be used on the compile command. In contrast, if the test code removes its use of exceptions, then exception support is not needed. It is possible to ignore warning 4530, but the test code would still be unpredictable and it might provide invalid test results.Issue submission checklist
forum.opencv.org, Stack Overflow, etc and have not found solution
The text was updated successfully, but these errors were encountered: