elmerfem
elmerfem copied to clipboard
CMake can't find BLAS
This is a new error for me and I cannot solve it. I just want to use Netlib BLAS/LAPACK, which is built in ~/ELMER/lapack, but CMake cannot find it when I set BLAS_LIBRARIES and LAPACK_LIBRARIES explicitly.
Thanks.
version
$ git log -n1
commit 4b1478aa01e3a3c538ac360ef447cb12fc680a1c (HEAD -> devel, upstream/devel, upstream/HEAD)
Author: Mika Malinen <[email protected]>
Date: Wed Oct 9 17:07:30 2024 +0300
Clean by removing void commands
error
~/ELMER/elmerfem/build$ git clean -dfx ; \
BLAS_LIBRARIES="~/ELMER/lapack/librefblas.a" \
LAPACK_LIBRARIES="~/ELMER/lapack/liblapack.a" \
MPI_HOME=/opt/ompi/llvm \
FC=/opt/llvm/latest/bin/flang-new \
CC=/opt/llvm/latest/bin/clang \
CXX=/opt/llvm/latest/bin/clang++ \
CMAKE_INSTALL_PREFIX=$HOME/ELMER/install \
CFLAGS="-std=gnu89" \
cmake ..
Refusing to remove current working directory
Removing ./CMakeFiles
Removing ./Testing
Removing ./CMakeCache.txt
Removing ./DartConfiguration.tcl
-- The Fortran compiler identification is LLVMFlang 20.0.0
-- The C compiler identification is Clang 20.0.0
-- The CXX compiler identification is Clang 20.0.0
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /opt/llvm/latest/bin/flang-new - skipped
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/llvm/latest/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/llvm/latest/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found MPI_C: /opt/ompi/llvm/lib/libmpi.so (found version "3.1")
-- Found MPI_CXX: /opt/ompi/llvm/lib/libmpi.so (found version "3.1")
-- Found MPI_Fortran: /opt/ompi/llvm/lib/libmpi_usempif08.so (found version "3.1")
-- Found MPI: TRUE (found version "3.1")
-- Checking whether MPI_IN_PLACE is supported with /opt/ompi/llvm/bin/mpif90
-- Checking whether MPI_IN_PLACE is supported with /opt/ompi/llvm/bin/mpif90 -- yes
CMake Warning at cmake/Modules/FindMKL.cmake:88 (MESSAGE):
Finding MKL libraries not implemented for
LLVMFlang
Call Stack (most recent call first):
CMakeLists.txt:304 (FIND_PACKAGE)
-- ------------------------------------------------
-- Looking for Fortran sgemm
-- Looking for Fortran sgemm - not found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Error at /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find BLAS (missing: BLAS_LIBRARIES)
Call Stack (most recent call first):
/usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.28/Modules/FindBLAS.cmake:1383 (find_package_handle_standard_args)
CMakeLists.txt:505 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
Installing BLAS with Apt works around this, but I would really like to be able to point CMake at a specific BLAS library and have it use that.
I don't know if CMake's FindBLAS module will pick up BLAS_LIBRARIES or LAPACK_LIBRARIES from environment variables. If it does, it is undocumented afaict:
https://cmake.org/cmake/help/latest/module/FindBLAS.html
Does setting the corresponding CMake cache variables work? I.e., instead of BLAS_LIBRARIES="~/ELMER/lapack/librefblas.a" LAPACK_LIBRARIES="~/ELMER/lapack/liblapack.a" cmake, try cmake -DBLAS_LIBRARIES="~/ELMER/lapack/librefblas.a" -DLAPACK_LIBRARIES="~/ELMER/lapack/liblapack.a".
Does that make a difference?