Page MenuHomePhabricator

Fix nightly CI builds on Windows (OpenCV)
Closed, ResolvedPublic

Description

OpenCV is submitted as unsuccessful build on Windows (Nightly) to CDash because of "1 compiler error", except that there is no compiler error and in fact it built and even installed successfully.

It turned out that during configuration of OpenCV, even though we explicitly switch off anything Python in OpenCV, OpenCV still executes the finding routines for Python. This would be fine usually but it triggers a return code 1 in an external script, which is picked up by the Dashboard script later (and only in this mode) and interpreted as compiler error. This is why I wasn't able to reproduce the error manually on the CI client, since it didn't matter and wasn't picked up by CMake/CTest in any other circumstances.

The error just recently popped up because it is a deprecation warning that appeared only after upgrading the CI clients to newer Python/Numpy versions:

<string>:1: DeprecationWarning: 
  
    `numpy.distutils` is deprecated since NumPy 1.23.0, as a result
    of the deprecation of `distutils` itself. It will be removed for
    Python >= 3.12. For older Python versions it will remain present.
    It is recommended to use `setuptools < 60.0` for those Python versions.
    For more details, see:
      https://numpy.org/devdocs/reference/distutils_status_migration.html

Luckily, inspecting OpenCV/cmake/OpenCVDetectPython.cmake revealed that there is an undocumented/hidden possibility of an early-out: https://github.com/opencv/opencv/blob/4.6.0/cmake/OpenCVDetectPython.cmake#L267-L269

Fix: define OPENCV_PYTHON_SKIP_DETECTION for our OpenCV builds.