# Not finding BLAS libraries

**URL:** https://discourse.cmake.org/t/not-finding-blas-libraries/1862
**Category:** Usage
**Created:** [September 19, 2020, 6:52pm UTC](https://discourse.cmake.org/t/not-finding-blas-libraries/1862 "2020-09-19T18:52:34Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![afernandezody](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/e19b73/32.png) [@afernandezody](https://discourse.cmake.org/u/afernandezody)
#### Post date: [September 19, 2020, 6:52pm UTC](https://discourse.cmake.org/t/not-finding-blas-libraries/1862/1 "2020-09-19T18:52:34Z")

</div>

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
> 
> ```

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 22, 2020, 7:15pm UTC](https://discourse.cmake.org/t/not-finding-blas-libraries/1862/2 "2020-11-22T19:15:48Z")

</div>

`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.
