0

I am trying to compile this software in the MSYS2 environment on Windows. This is the line looking for the packages:

FIND_PACKAGE(BLAS REQUIRED)
FIND_PACKAGE(LAPACK REQUIRED)
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})

I have installed the BLAS/LAPACK dependencies using

pacman -S make msys/cmake msys/gcc-fortran mingw64/mingw-w64-x86_64-openblas64

but I get the error messages:

CMake Error at /usr/share/cmake-3.22.1/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find BLAS (missing: BLAS_LIBRARIES)
Call Stack (most recent call first):
  /usr/share/cmake-3.22.1/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.22.1/Modules/FindBLAS.cmake:1337 (find_package_handle_standard_args)
  CMakeLists.txt:403 (FIND_PACKAGE)

You may find the modified CMakeLists.txt file here (I have commented out all the MPI, MMG, MKL, and APPLE-related entries), and the complete output can be seen here.

I can probably specify the locations explicitly as described here and here

SET(BLAS_LIBRARIES /c/tools/msys64/mingw64/lib/libopenblas_64.a)
SET(LAPACK_LIBRARIES /c/tools/msys64/mingw64/lib/libopenblas_64.a)

but I want CMake to find these dependencies automatically. I would appreciate it if you could help me know what is the canonical way to get BLAS/LAPACK libraries installed under MSYS2 and get CMAKE to find them automatically with the FIND_PACKAGE() functions or otherwise.

Foad S. Farimani
  • 12,396
  • 15
  • 78
  • 193
  • 1
    It seems you're inconsistently using two different [MSYS2 environments](https://www.msys2.org/docs/environments/): MSYS and MINGW64. The latter should be preferred. Uninstall `cmake` and `gcc-fortran` and replace them with the packages prefixed by `mingw-w64-x86_64-`. Restart your MSYS2 terminal using `mingw64.exe` to get that compiler in PATH; if done correctly, the terminal prompt should say `MINGW64` in magenta letters. – HolyBlackCat Apr 01 '22 at 07:35
  • @HolyBlackCat you are actually right. I did notice that I was using the wrong `mingw64.exe` environment initially. Will edit the post and add the new information. But I have to use the `msys2.exe` environment and packages because of the issues explained [here](https://stackoverflow.com/a/60798994/4999991). – Foad S. Farimani Apr 01 '22 at 07:46
  • 1
    Can you elaborate why that behavior is a problem? – HolyBlackCat Apr 01 '22 at 07:51
  • @HolyBlackCat It is a cross-platform software. I need to specify some instructions explicitly for the MSYS2 environment. If you check the other post, you can see the train of issues I have had with the `mingw64.exe` environment (e.g., [here](https://stackoverflow.com/q/60747538/4999991)). – Foad S. Farimani Apr 01 '22 at 09:13
  • 1
    Decent software should support all (or most) of those environments. If a library I was going to use worked only on MSYS and not MINGW64, I'd just take a different library. – HolyBlackCat Apr 01 '22 at 09:35
  • 1
    The detection method I use is `uname -o` == `Msys`. Works in all of those environments, I believe. – HolyBlackCat Apr 01 '22 at 09:35

0 Answers0