Test cases failed while Building OpenCV 4.10.0

System Information

Opencv version: 4.10.0
Operating system : Ubuntu 24.04
Compiler version: GCC 13.2.0

Detailed description

I have been building opencv from source with following parameter

  cmake ../opencv  -DBUILD_DOCS=OFF -DBUILD_EXAMPLE=OFF -DBUILD_TESTS=ON -DBUILD_PERF_TESTS=OFF 
-DBUILD_SHARED_LIBS=ON -DBUILD_WITH_DEBUG_INFO=ON -DCMAKE_BUILD_TYPE=release -DBUILD_JAVA=OFF -
DBUILD_opencv_python2=OFF -DBUILD_opencv_python3=ON -DBUILD_opencv_dnn=ON -DBUILD_opencv_dnn_modern=OFF 
-DBUILD_opencv_cnn_3dobj=ON -DBUILD_PROTOBUF=OFF
-DPROTOBUF_UPDATE_FILES=ON -DCMAKE_INSTALL_PREFIX=/path -DOPENCV_EXTRA_MODULES_PATH=/mnt/opencv_contrib/modules 
-DOPENCV_LICENSES_INSTALL_PATH=/path/share/doc/opencv -DOPENCV_GENERATE_PKGCONFIG=YES -DOPENCV_PYTHON3_VERSION=3.12 
-DPYTHON3_PACKAGES_PATH=/path/lib/python3.12/dist-packages -DENABLE_CCACHE=OFF -DENABLE_FAST_MATH=ON 
-DWITH_VTK=ON -DBUILD_opencv_hdf=OFF -DWITH_OPENGL=ON -DWITH_GPHOTO2=OFF -DWITH_FREETYPE=ON -DFREETYPE_INCLUDE_DIRS=/usr/include/freetype2 -DTINYDNN_USE_OMP=ON
-DINSTALL_C_EXAMPLES=OFF -DINSTALL_PYTHON_EXAMPLES=OFF -DOPENCV_DNN_CUDA=ON -DWITH_CUDA=ON -DWITH_CUBLAS=ON -DWITH_CUFFT=ON 
-DCUDA_NVCC_FLAGS=--expt-relaxed-constexpr -DCUDA_FAST_MATH=ON -DCUDA_ARCH_BIN=5.3,6.0,6.1,7.0,7.5,8.6,8.9 
-DENABLE_PRECOMPILED_HEADERS=ON -DWITH_NVCUVID=ON -DWITH_OPENMP=ON -DOpenGL_GL_PREFERENCE=GLVND 
-DPYTHON_DEFAULT_EXECUTABLE=/PATH/python3.12 -DPYTHON3_EXECUTABLE=/PATH/python3.12 
-DPYTHON3_INCLUDE_DIR=/miniconda/include -DPYTHON3_LIBRARY=/PATH/libpython3.12.so 
-DPYTHON3_NUMPY_INCLUDE_DIRS=/PATH/python3.12/site-packages/numpy/_core/include -DWITH_OPENVINO=ON 
-DWITH_TBB=ON -DMKL_WITH_OPENMP=ON -DMKL_WITH_TBB=ON
/mnt/opencv_extra /mnt

There are several tests which are failed :

[  FAILED  ] Core_SVD.orthogonality
[  FAILED  ] OCL_Arithm/InRange.Mat/33, where GetParam() = (CV_16U, Channels(1), false, true)
[  FAILED  ] OCL_Arithm/InRange.Mat/35, where GetParam() = (CV_16U, Channels(1), true, true)
[  FAILED  ] OCL_Arithm/InRange.Mat/37, where GetParam() = (CV_16U, Channels(2), false, true)
[  FAILED  ] OCL_Arithm/InRange.Mat/39, where GetParam() = (CV_16U, Channels(2), true, true)
[  FAILED  ] OCL_Arithm/InRange.Mat/49, where GetParam() = (CV_16S, Channels(1), false, true)
[  FAILED  ] OCL_Arithm/InRange.Mat/51, where GetParam() = (CV_16S, Channels(1), true, true)
[  FAILED  ] OCL_Arithm/InRange.Mat/57, where GetParam() = (CV_16S, Channels(3), false, true)
[  FAILED  ] OCL_Arithm/InRange.Mat/59, where GetParam() = (CV_16S, Channels(3), true, true)
[  FAILED  ] OCL_Arithm/InRange.Mat/65, where GetParam() = (CV_32S, Channels(1), false, true)
[  FAILED  ] OCL_Arithm/InRange.Mat/96, where GetParam() = (CV_64F, Channels(1), false, false)
[  FAILED  ] OCL_Arithm/InRange.Mat/98, where GetParam() = (CV_64F, Channels(1), true, false)
[  FAILED  ] OCL_Arithm/InRange.Mat/105, where GetParam() = (CV_64F, Channels(3), false, true)
[  FAILED  ] OCL_Arithm/InRange.Mat/107, where GetParam() = (CV_64F, Channels(3), true, true)
[  FAILED  ] Core_InRangeS/ElemWiseTest.accuracy/0, where GetParam() = 16-byte object <20-75 24-18 D2-55 00-00 60-52 59-18 D2-55 00-00>
[  FAILED  ] Core_InRange/ElemWiseTest.accuracy/0, where GetParam() = 16-byte object <C0-4A 53-18 D2-55 00-00 A0-55 59-18 D2-55 00-00>
[  FAILED  ] Core/CountNonZeroND.ndim/0, where GetParam() = (2, 0)
[  FAILED  ] Core/CountNonZeroND.ndim/1, where GetParam() = (2, 1)
[  FAILED  ] Core/CountNonZeroND.ndim/2, where GetParam() = (2, 5)
[  FAILED  ] Core/CountNonZeroND.ndim/3, where GetParam() = (3, 0)
[  FAILED  ] Core/CountNonZeroND.ndim/4, where GetParam() = (3, 1)
[  FAILED  ] Core/CountNonZeroND.ndim/5, where GetParam() = (3, 5)
[  FAILED  ] Core/CountNonZeroND.ndim/6, where GetParam() = (4, 0)
[  FAILED  ] Core/CountNonZeroND.ndim/7, where GetParam() = (4, 1)
[  FAILED  ] Core/CountNonZeroND.ndim/8, where GetParam() = (4, 5)
[  FAILED  ] Core/CountNonZeroND.ndim/9, where GetParam() = (5, 0)
[  FAILED  ] Core/CountNonZeroND.ndim/10, where GetParam() = (5, 1)
[  FAILED  ] Core/CountNonZeroND.ndim/11, where GetParam() = (5, 5)
[  FAILED  ] Core/CountNonZeroND.ndim/12, where GetParam() = (6, 0)
[  FAILED  ] Core/CountNonZeroND.ndim/13, where GetParam() = (6, 1)
[  FAILED  ] Core/CountNonZeroND.ndim/14, where GetParam() = (6, 5)
[  FAILED  ] Core/CountNonZeroND.ndim/18, where GetParam() = (8, 0)
[  FAILED  ] Core/CountNonZeroND.ndim/19, where GetParam() = (8, 1)
[  FAILED  ] Core/CountNonZeroND.ndim/20, where GetParam() = (8, 5)
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/0, where GetParam() = (5, 1x1)
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/1, where GetParam() = (5, 320x240)
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/2, where GetParam() = (5, 127x113)
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/3, where GetParam() = (5, 1x113)
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/4, where GetParam() = (6, 1x1)
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/5, where GetParam() = (6, 320x240)

But while I tried building using -DCMAKE_BUILD_TYPE=Debug, Only 6 tests were failed :

[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/0, where GetParam() = (5, 1x1)
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/1, where GetParam() = (5, 320x240)
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/2, where GetParam() = (5, 127x113)
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/3, where GetParam() = (5, 1x113)
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/4, where GetParam() = (6, 1x1)
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/5, where GetParam() = (6, 320x240)

Expected Behavior
The build should complete successfully with no test failed, producing OpenCV binaries with the specified configurations.

Could someone help identify the cause of this issue and suggest a solution? Any guidance or help would be greatly appreciated.

Steps to reproduce

git clone GitHub - opencv/opencv: Open Source Computer Vision Library
git checkout [version/tag/branch]

Install dependencies

Run below command :

cmake …/opencv -DBUILD_DOCS=OFF -DBUILD_EXAMPLE=OFF -DBUILD_TESTS=ON -DBUILD_PERF_TESTS=OFF -DBUILD_SHARED_LIBS=ON -DBUILD_WITH_DEBUG_INFO=ON -DCMAKE_BUILD_TYPE=release -DBUILD_JAVA=OFF -DBUILD_opencv_python2=OFF -DBUILD_opencv_python3=ON -DBUILD_opencv_dnn=ON -DBUILD_opencv_dnn_modern=OFF -DBUILD_opencv_cnn_3dobj=ON -DBUILD_PROTOBUF=OFF -DPROTOBUF_UPDATE_FILES=ON -DCMAKE_INSTALL_PREFIX=/path -DOPENCV_EXTRA_MODULES_PATH=/mnt/opencv_contrib/modules -DOPENCV_LICENSES_INSTALL_PATH=/path/share/doc/opencv -DOPENCV_GENERATE_PKGCONFIG=YES -DOPENCV_PYTHON3_VERSION=3.12 -DPYTHON3_PACKAGES_PATH=/path/lib/python3.12/dist-packages -DENABLE_CCACHE=OFF -DENABLE_FAST_MATH=ON -DWITH_VTK=ON -DBUILD_opencv_hdf=OFF -DWITH_OPENGL=ON -DWITH_GPHOTO2=OFF -DWITH_FREETYPE=ON -DFREETYPE_INCLUDE_DIRS=/usr/include/freetype2 -DTINYDNN_USE_OMP=ON -DINSTALL_C_EXAMPLES=OFF -DINSTALL_PYTHON_EXAMPLES=OFF -DOPENCV_DNN_CUDA=ON -DWITH_CUDA=ON -DWITH_CUBLAS=ON -DWITH_CUFFT=ON -DCUDA_NVCC_FLAGS=–expt-relaxed-constexpr -DCUDA_FAST_MATH=ON -DCUDA_ARCH_BIN=5.3,6.0,6.1,7.0,7.5,8.6,8.9 -DENABLE_PRECOMPILED_HEADERS=ON -DWITH_NVCUVID=ON -DWITH_OPENMP=ON -DOpenGL_GL_PREFERENCE=GLVND -DPYTHON_DEFAULT_EXECUTABLE=/PATH/python3.12 -DPYTHON3_EXECUTABLE=/PATH/python3.12 -DPYTHON3_INCLUDE_DIR=/miniconda/include -DPYTHON3_LIBRARY=/PATH/libpython3.12.so -DPYTHON3_NUMPY_INCLUDE_DIRS=/PATH/python3.12/site-packages/numpy/_core/include -DWITH_OPENVINO=ON -DWITH_TBB=ON -DMKL_WITH_OPENMP=ON -DMKL_WITH_TBB=ON
/mnt/opencv_extra /mnt

make -j$(no of cores)