Issue 1:
System information (version)

OpenCV => 4.5.2 (issue on 4.5.. and 4.5.4)

Operating System / Platform => Gentoo Linux 64 bit

Compiler => gcc

Detailed description

Compilation fails agaisn tlapack-3.10.0 with

/build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:166:23: error: too few arguments to function ‘void sposv_(const char*, const int*, const int*, float*, const int*, float*, const int*, int*, size_t)’
166 | sposv_(L, &m, &n, (float*)a, &lda, (float*)b, &m, &lapackStatus);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/lapack.h:11,
from /usr/include/lapacke.h:36,
from ./opencv_lapack.h:12,
from /build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:51:
/usr/include/lapack.h:13003:6: note: declared here
13003 | void LAPACK_sposv_base(
| ^~~~~~~~~~~~~~~~~
/build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:168:23: error: too few arguments to function ‘void dposv_(const char*, const int*, const int*, double*, const int*, double*, const int*, int*, size_t)’
168 | dposv_(L, &m, &n, (double*)a, &lda, (double*)b, &m, &lapackStatus);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/lapack.h:11,
from /usr/include/lapacke.h:36,
from ./opencv_lapack.h:12,
from /build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:51:
/usr/include/lapack.h:12986:6: note: declared here
12986 | void LAPACK_dposv_base(
| ^~~~~~~~~~~~~~~~~
/build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:177:23: error: too few arguments to function ‘void sposv_(const char*, const int*, const int*, float*, const int*, float*, const int*, int*, size_t)’
177 | sposv_(L, &m, &n, (float*)a, &lda, (float*)tmpB, &m, &lapackStatus);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/lapack.h:11,
from /usr/include/lapacke.h:36,
from ./opencv_lapack.h:12,
from /build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:51:
/usr/include/lapack.h:13003:6: note: declared here
13003 | void LAPACK_sposv_base(
| ^~~~~~~~~~~~~~~~~
/build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:179:23: error: too few arguments to function ‘void dposv_(const char*, const int*, const int*, double*, const int*, double*, const int*, int*, size_t)’
179 | dposv_(L, &m, &n, (double*)a, &lda, (double*)tmpB, &m, &lapackStatus);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/lapack.h:11,
from /usr/include/lapacke.h:36,
from ./opencv_lapack.h:12,
from /build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:51:
/usr/include/lapack.h:12986:6: note: declared here
12986 | void LAPACK_dposv_base(
| ^~~~~~~~~~~~~~~~~
/build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:188:20: error: too few arguments to function ‘void spotrf_(const char*, const int*, float*, const int*, int*, size_t)’
188 | spotrf_(L, &m, (float*)a, &lda, &lapackStatus);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/lapack.h:11,
from /usr/include/lapacke.h:36,
from ./opencv_lapack.h:12,
from /build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:51:
/usr/include/lapack.h:13394:6: note: declared here
13394 | void LAPACK_spotrf_base(
| ^~~~~~~~~~~~~~~~~~
/build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:190:20: error: too few arguments to function ‘void dpotrf_(const char*, const int*, double*, const int*, int*, size_t)’
190 | dpotrf_(L, &m, (double*)a, &lda, &lapackStatus);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/lapack.h:11,
from /usr/include/lapacke.h:36,
from ./opencv_lapack.h:12,
from /build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:51:
/usr/include/lapack.h:13378:6: note: declared here
13378 | void LAPACK_dpotrf_base(
| ^~~~~~~~~~~~~~~~~~
/build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp: In function ‘int lapack_SVD(fptype*, size_t, fptype*, fptype*, size_t, fptype*, size_t, int, int, int, int*)’:
/build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:230:16: error: too few arguments to function ‘void sgesdd_(const char*, const int*, const int*, float*, const int*, float*, float*, const int*, float*, const int*, float*, const int*, int*, int*, size_t)’
230 | sgesdd_(mode, &m, &n, (float*)a, &lda, (float*)w, (float*)u, &ldu, (float*)vt, &ldv, (float*)&work1, &lwork, iworkBuf, info);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/lapack.h:11,
from /usr/include/lapacke.h:36,
from ./opencv_lapack.h:12,
from /build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:51:
/usr/include/lapack.h:3264:6: note: declared here
3264 | void LAPACK_sgesdd_base(
| ^~~~~~~~~~~~~~~~~~
/build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:238:16: error: too few arguments to function ‘void sgesdd_(const char*, const int*, const int*, float*, const int*, float*, float*, const int*, float*, const int*, float*, const int*, int*, int*, size_t)’
238 | sgesdd_(mode, &m, &n, (float*)a, &lda, (float*)w, (float*)u, &ldu, (float*)vt, &ldv, (float*)buffer, &lwork, iworkBuf, info);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/lapack.h:11,
from /usr/include/lapacke.h:36,
from ./opencv_lapack.h:12,
from /build/opencv-cuda/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:51:
/usr/include/lapack.h:3264:6: note: declared here
3264 | void LAPACK_sgesdd_base(

see also : gentoo bug and similar issue againts lapack-3.9.1

Steps to reproduce

Try to compile againt lapack-3.10.0

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 solution

I updated to latest OpenCV version and the issue is still there

There is reproducer code and related data files: videos, images, onnx, etc

Issue 2:
System information (version)

OpenCV => 4.5.2

Operating System / Platform => Linux

Compiler => GCC 10.2.0

Detailed description

opencv fails to build with lapack 3.9.1 with the following error:

/build/opencv/src/opencv-4.5.2/modules/core/src/hal_internal.cpp: In function ‘int lapack_QR(fptype*, size_t, int, int, int, fptype*, size_t, fptype*, int*)’:
/build/opencv/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:293:111: error: too few arguments to function ‘void dgels_(const char*, const int*, const int*, const int*, double*, const int*, double*, const int*, double*, const int*, int*, size_t)’
293 | dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)b, &m, (double*)&work1, &lwork, info);
| ^
In file included from /usr/include/lapack.h:11,
from /usr/include/lapacke.h:36,
from /build/opencv/src/build/opencv_lapack.h:12,
from /build/opencv/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:51:
/usr/include/lapack.h:1525:6: note: declared here
1525 | void LAPACK_dgels_base(
| ^~~~~~~~~~~~~~~~~
/build/opencv/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:302:111: error: too few arguments to function ‘void dgels_(const char*, const int*, const int*, const int*, double*, const int*, double*, const int*, double*, const int*, int*, size_t)’
302 | dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)b, &m, (double*)buffer, &lwork, info);
| ^
In file included from /usr/include/lapack.h:11,
from /usr/include/lapacke.h:36,
from /build/opencv/src/build/opencv_lapack.h:12,
from /build/opencv/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:51:
/usr/include/lapack.h:1525:6: note: declared here
1525 | void LAPACK_dgels_base(
| ^~~~~~~~~~~~~~~~~
/build/opencv/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:314:114: error: too few arguments to function ‘void dgels_(const char*, const int*, const int*, const int*, double*, const int*, double*, const int*, double*, const int*, int*, size_t)’
314 | dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)tmpB, &m, (double*)&work1, &lwork, info);
| ^
In file included from /usr/include/lapack.h:11,
from /usr/include/lapacke.h:36,
from /build/opencv/src/build/opencv_lapack.h:12,
from /build/opencv/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:51:
/usr/include/lapack.h:1525:6: note: declared here
1525 | void LAPACK_dgels_base(
| ^~~~~~~~~~~~~~~~~
/build/opencv/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:323:114: error: too few arguments to function ‘void dgels_(const char*, const int*, const int*, const int*, double*, const int*, double*, const int*, double*, const int*, int*, size_t)’
323 | dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)tmpB, &m, (double*)buffer, &lwork, info);
| ^
In file included from /usr/include/lapack.h:11,
from /usr/include/lapacke.h:36,
from /build/opencv/src/build/opencv_lapack.h:12,
from /build/opencv/src/opencv-4.5.2/modules/core/src/hal_internal.cpp:51:
/usr/include/lapack.h:1525:6: note: declared here
1525 | void LAPACK_dgels_base(
| ^~~~~~~~~~~~~~~~~
[ 9%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/split.dispatch.cpp.o
[ 9%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/stat.dispatch.cpp.o
[ 9%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/stat_c.cpp.o
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/build.make:509: modules/core/CMakeFiles/opencv_core.dir/src/hal_internal.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....

Steps to reproduce

Build opencv with lapack 3.9.1

Possibly related: Reference-LAPACK/lapack@2d9fbde