Closed ocaisa closed 2 years ago
This is a good suggestion and I will implement it as soon as I have a chance. Alternatively, if you are willing to make this change in a PR, I will be happy to merge it.
I was able to do this for the dynamic library and the dynamic executable, but not for the static executable. I tried adding the following to staticExecutable/CMakeLists.txt
:
set(BLA_STATIC ON)
find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)
But when running cmake
I get the following error messages:
-- Looking for sgemm_
-- Looking for sgemm_ - found
-- Found BLAS: /usr/lib/x86_64-linux-gnu/libblas.a
-- Looking for cheev_
-- Looking for cheev_ - not found
-- Looking for cheev_
-- Looking for cheev_ - not found
CMake Error at /usr/share/cmake-3.16/Modules/FindLAPACK.cmake:423 (message):
A required library with LAPACK API not found. Please specify library
location.
Call Stack (most recent call first):
staticExecutable/CMakeLists.txt:74 (find_package)
-- Configuring incomplete, errors occurred!
All of this is on Ubuntu 20.04, the currently supported platform for Shasta Linux builds. Blas and Lapack are both installed and the existing cmake
files, which don't use find_package
, work without problems.
Any suggestions from @ocaisa or others would be welcome. And a tested PR would be very welcome!
I found on the Internet several mentions of this problem with static linking. I will close this for now given that there is no known solution (not known to me, at least). If @ocaisa or others find a way to do it, please post that information here and reopen the issue and I will make the change.
Sorry for being non-responsive on this, I'm transitioning job at the moment. I wouldn't be much help anyway, I have a lot of experience installing software but not a lot of specific CMake experience.
Thank you - this is a good suggestion anyway. Perhaps I can revive it at some point in the future if/when this Cmake problem gets fixed.
In https://github.com/chanzuckerberg/shasta/commit/b42f82d2369caad4a2dab1856783a2da39a197dc , BLAS and Lapack libraries are being linked in, but there are actually quite a few implementations that can provide these (for example, OpenBLAS can provide both
blas
andlapack
in the single libraryopenblas
). TheFindBLAS
Cmake module handles all these, it would be good to leverage this rather than link to explicit libraries (that cannot be overridden).