New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenBLAS support broken due to extern C linkage #10668
Comments
LAPACK/BLAS is "C" library and it should have "C" LAPACK's symbols (exception here is "Apple"-way with their framework).
Try to run "nm -g" on your library build and check for names of exported LAPACK symbols. Some LAPACK libraries/packages doesn't have Nested Example
|
Ah, I'm aware of the LAPACK/BLAS origins and the correct usage of extern "C" :) - sorry if my post was irritating...but thanks for the SA link, the std reference for nested linkage is nice 👍 I don't know what apple is doing in their framework, I was just guessing from #10230 comments and the differences in the CMake detection script. Ok, I tracked down the error a bit more...fortunately, there was an error output in the It seems, the error comes from the usage of GCC complex number library:
I've set
So, forcing try_compile to use C++98 for the test compilation fixes the configure bug. But that's a bit of an ugly hack. So, sorry. I'm still not getting it - why are you putting a library which already has C-linkage for it's symbols into another nested C-linkage layer? And thereby putting the std library headers into extern linkage blocks, from which they're intentionally excluded! See OpenMathLib/OpenBLAS#490 I could provide a patch for the OpenCVFindLAPACK.cmake if you want... Thank you! |
Because there are packages with straightforward LAPACK/CBLAS headers without any Perhaps we could add "include <complex.h>" before include BTW, GCC 7 is fine (in Fedora + OpenBLAS): headers list looks the same (use -H compiler option to see them), but there is no error message. https://godbolt.org/ works fine with GCC 6.1+ / Clang:
|
Oh, my, fault. Sorry - I didn't really thought about other LAPACK/BLAS impl. besides OpenBLAS (and this strange Apple stuff) :/ my fault, sorry again.
That's strange...what version of OpenBLAS is Fedora shipped with? I'd assumed a bit more up to date than Ubuntu LTS? Anyway, your workaround suggestion looks fine for me...I'll test it and provide the patch when it's working. |
@nightsparc Could you take a look on #10677 ? |
System information (version)
Detailed description
Hi!
we build OpenCV with OpenBLAS 0.2.20 (also our own build) ...ah, up to patch #9955, LAPACK detection had been working properly.
Starting with the changes in patch #9955 in the 3.3.1 release (and 3.4.0 too, to which we're trying to upgrade to atm), the LAPACK cmake detection script outputs
I was able to track it down to the extern "C" encapsulation of the OpenBLAS headers in the lapack proxy which seems similar to issue #10230. Now, if we're removing the
extern "C"
statement, everything works fine again.I'm just wondering if it this is due to some trouble with our own build version of OpenBLAS as #9955 was related to the OpenBLAS support in OpenCV, too. @alalek Why did you put the OpenBLAS headers in extern C linkage?
Workaround
Atm, I'd removed the extern C linkage from the detection script to build OpenCV with OpenBLAS...
Thanks in advance and regards
The text was updated successfully, but these errors were encountered: