3

For building opencv 3.1 I'm using cmake with Visual Studio 2013. I downloaded the dependencies as shown here: http://docs.opencv.org/3.1.0/d3/d52/tutorial_windows_install.html
While configuring cmake, the first thing it shows is:

FP16: Compiler support is available
A library with BLAS API not found. Please specify library location.
LAPACK requires BLAS
A library with LAPACK API not found. Please specify library location.

The problem is, that I don't know how to specify the location. For the "Eigen" library I set the library path myself (EIGEN_INCLUDE_PATH, which is pre defined) and cmake says:

Other third-party libraries:
    Use IPP:                     NO
    Use IPP Async:               NO
    Use Lapack:                  NO
    Use Eigen:                   YES (ver 3.2.10)
    Use Cuda:                    NO
    Use OpenCL:                  YES
    Use OpenVX:                  NO
    Use custom HAL:              NO

but there is no pre defined variable for LAPACK. I also tried to put the *.lib and header files in a subdirectory, which I downloaded from http://icl.cs.utk.edu/lapack-for-windows/, in the hope if cmake somehow finding the library.

I have to build opencv 3.1 myself, because in the distributed version, the extra modules are disabled. It builds without LAPACK, but my guess is, that I will loose a lot of performance.

Thank you very much for your help!

qwert wayne
  • 176
  • 1
  • 2
  • 7
  • Use CMAKE_PREFIX_PATH, as described in http://stackoverflow.com/a/39126731/2799037 or https://cmake.org/cmake/help/v3.7/variable/CMAKE_PREFIX_PATH.html – usr1234567 Oct 19 '16 at 15:37
  • This solved it for me. It's for Linux, but same concept worked on Wndows: https://github.com/opencv/opencv/issues/12957 . 1) I installed OpenBLAS from here:https://www.openblas.net/ . 2) I edited the OpenCVFindOpenBLAS.cmake file inside the {opencv_source _dir}}/cmake folder, by adding the lib and include directories of OpenBLAS in the respective places . After that CMake was able to find OpenBLAS and the Lapack library coming with it. – George Adamon Nov 11 '22 at 11:23

2 Answers2

2

For me, I used OpenBlas library:

Use CMake Gui to config opencv

  • Select Advanced
  • In the OpenBLAS group, config the include folder and library file for OpenBLAS
  • In the WITH group, select WITH_LAPACK
  • Now click the Configure button, CMake will automatically config Lapack info.
  • After all is ok, you can click on Generate button on CMake Gui to generate visual studio project files and start to build.
General Failure
  • 2,421
  • 4
  • 23
  • 49
Viet
  • 21
  • 2
0

I would add a comment but I do not have enough rep for it. In my case to build OpenCV 3.2 in Visual Studio 2013 with OpenBlas and LAPACK, in addition to Viets' answer, I had to change two lines in lapacke.h to use the standard library based on here

So, for OpenBLAS version 0.2.19-Win64-int32 in lapacke.h I changed

@line 74 float _Complex to std::complex<float> and

@line 90 double _Complex to std::complex<double>

without the need to build the OpenBLAS library again.

Hope it helps.

Community
  • 1
  • 1
GeorgeK
  • 33
  • 1
  • 10