Not finding BLAS libraries

Hello,
This might be a basic issue but cmake is not able to find BLAS for some reason. The system is running CentOS8 and spitting out the error:


– Trying to figure out …
– Compiler: GNU
– libstdc++/C++ compiler version compatibility check pass
– C++ 14 standard library supported
– Looking for sgemm_
– Looking for sgemm_ - not found
– Looking for pthread.h
– Looking for pthread.h - found
– Performing Test CMAKE_HAVE_LIBC_PTHREAD
– Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
– Found Threads: TRUE
CMake Error at /usr/local/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
Could NOT find BLAS (missing: BLAS_LIBRARIES)
Call Stack (most recent call first):
/usr/local/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
/usr/local/share/cmake-3.18/Modules/FindBLAS.cmake:947 (find_package_handle_standard_args)
/usr/local/share/cmake-3.18/Modules/FindLAPACK.cmake:208 (find_package)
CMakeLists.txt:445 (find_package)

I have tried installing BLAS with yum and from source but it’s the same problem. Is it necessary some extra flag like -DCBLAS_LIBRARIES=/root/lapack/LIB or similar? Thanks.

The error file reads:

Determining if the function sgemm_ exists failed with the following output:
Change Dir: /root/coral2/qmcpack-3.9.2/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_2bede/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_2bede.dir/build.make CMakeFiles/cmTC_2bede.dir/build
gmake[1]: Entering directory '/root/coral2/qmcpack-3.9.2/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_2bede.dir/CheckFunctionExists.c.o
/opt/openmpi5/bin/mpicc   -std=c99 -fopenmp -finline-limit=1000 -fstrict-aliasing -funroll-all-loops -Wno-deprecated -Werror=vla -mcpu=native -DCHECK_FUNCTION_EXISTS=sgemm_ -o CMakeFiles/cmTC_2bede.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-3.18/Modules/CheckFunctionExists.c
Linking C executable cmTC_2bede
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_2bede.dir/link.txt --verbose=1
/opt/openmpi5/bin/mpicc  -std=c99 -fopenmp -finline-limit=1000 -fstrict-aliasing -funroll-all-loops -Wno-deprecated -Werror=vla -mcpu=native -DCHECK_FUNCTION_EXISTS=sgemm_ CMakeFiles/cmTC_2bede.dir/CheckFunctionExists.c.o -o cmTC_2bede 
CMakeFiles/cmTC_2bede.dir/CheckFunctionExists.c.o: In function `main':
CheckFunctionExists.c:(.text+0x10): undefined reference to `sgemm_'
collect2: error: ld returned 1 exit status
gmake[1]: *** [CMakeFiles/cmTC_2bede.dir/build.make:106: cmTC_2bede] Error 1
gmake[1]: Leaving directory '/root/coral2/qmcpack-3.9.2/build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:140: cmTC_2bede/fast] Error 2

CBLAS_LIBRARIES should probably be a library, not a directory. Note that sgemm is the symbol used in FindBLAS to detect a BLAS library. I suspect nothing is being found, but I suspect you likely need the associated -dev or -devel package installed.