0

I am using Qt Creator for development. I want to use Armadillo linear algebra library. Therefore I used following code in my pro file:

INCLUDEPATH += C:\armadillo-7.950.1\include

LIBS += \
    -LC:\armadillo-7.950.1\examples\lib_win64 \
    -llapack_win64_MT \
    -lblas_win64_MT

It was all good and the project compiled and linked properly. Next task was to replace LAPACK and BLAS with OpenBLAS. So the pro file was changed as following:

INCLUDEPATH += C:\armadillo-7.950.1\include \
           C:\OpenBLAS-v0.2.19-Win64-int32\include

LIBS += \
    -LC:\OpenBLAS-v0.2.19-Win64-int32\lib \
    -llibopenblas

Now I receive the error: LNK1104: cannot open file 'libopenblas.lib'. I have downloaded windows binary of OpenBLAS. The installed folder structure is as given in the image: installed OpenBLAS folder

Please let me know what is going wrong?

Thanks.

Santosh Kumar
  • 143
  • 12
  • Hi and welcome to Stack Overflow, please take a time to go through the [welcome tour](https://stackoverflow.com/tour) to know your way around here (and also to earn your first badge), read how to create a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) and also check [How to Ask Good Questions](https://stackoverflow.com/help/how-to-ask) so you increase your chances to get feedback and useful answers. – DarkCygnus Jul 07 '17 at 16:12

2 Answers2

1

There are two reasons for this problem:

  1. Weird naming of .lib file as libopenblas.dll.a even though package is called windows binary.
  2. Incomplete binary package---- It doesn't contain all required dlls

Solution:

  1. Choose a binary----win 64 or win32 and download it.

  2. rename libopenblas.dll.a as libopenblas.lib as Yuriy has suggested

  3. download from https://sourceforge.net/projects/openblas/files/v0.2.14/ required missing DLLs are bundled again under weirdly named zip files "mingw64_dll" or "mingw32_dll" depending upon the binary type which you have downloaded in step 1. These zip file contain "libgcc_s_seh-1.dll", "libgfortran-3.dll" and "libquadmath-0.dll"

  4. Add include and lib as I have done to your project and build with correct target depending upon your downloaded binary i.e win64 or X86

  5. Copy libopenblas.dll from bin folder of OpenBLAS binary and "libgcc_s_seh-1.dll", "libgfortran-3.dll", "libquadmath-0.dll" from "mingw64_dll" or "mingw32_dll" depending upon the binary type to build debug or release directory where the exe reside.

    1. Run your program and you are good to go.

    2. If you want to escape copying again and again set a required system environment variable for the path containing these DLLs

Santosh Kumar
  • 143
  • 12
0

I'm not familiar with OpenBLAS, but your configuration looks correct. On Windows, or at least with MSVC, you need a .lib file to link to, in addition to the DLL file for runtime. Instead it looks like OpenBLAS installs a mysterious .dll.a file. Sounds like it should be the same thing: https://github.com/xianyi/OpenBLAS/wiki/How-to-use-OpenBLAS-in-Microsoft-Visual-Studio Possibly renaming it would do the trick, but you might need to rebuild from source to get the file.

Yuriy
  • 61
  • 4
  • libopenblas.dll.a in in my OpelBLAS installation folder. Even though I am running my project with Qt Creator, I switched to visual studio to just check it. libopenblas.dll.a is not being recognized as library file. If I rename it as libopenblas.lib, It is not being read properly. I encounter a crash. – Santosh Kumar Jul 07 '17 at 17:43