icl-utk-edu / lapackpp

LAPACK++ is a C++ wrapper around CPU and GPU LAPACK and LAPACK-like linear algebra libraries, developed as part of the SLATE project.
https://icl.utk.edu/slate/
BSD 3-Clause "New" or "Revised" License
46 stars 14 forks source link

LAPACK library not found. #56

Open yurivict opened 9 months ago

yurivict commented 9 months ago

Configure fails:

-- Looking for LAPACK libraries and options
   In BLAS library                                  no (didn't link: routine not found)
   -llapack                                         no (didn't link: routine not found)
   LAPACK library not found.
CMake Error at CMakeLists.txt:720 (message):
  LAPACK++ requires a LAPACK library and none was found.  Ensure that it is
  accessible in environment variables $CPATH, $LIBRARY_PATH, and
  $LD_LIBRARY_PATH.

In cmake/LAPACKFinder.cmake the compilation of lapack_pstrf.cc fails with this output:

Change Dir: /usr/ports/math/lapackpp/work/.build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/local/bin/cmake -E env VERBOSE=1 /usr/local/bin/gmake -f Makefile cmTC_09eb8/fast && gmake[1]: Entering directory '/usr/ports/math/lapackpp/work/.build/CMakeFiles/CMakeTmp'
/usr/local/bin/gmake  -f CMakeFiles/cmTC_09eb8.dir/build.make CMakeFiles/cmTC_09eb8.dir/build
gmake[2]: Entering directory '/usr/ports/math/lapackpp/work/.build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_09eb8.dir/lapack_pstrf.cc.o
/usr/local/libexec/ccache/c++ -DBLAS_HAVE_CBLAS -DBLAS_HAVE_OPENBLAS  -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include  -fopenmp=libomp -MD -MT CMakeFiles/cmTC_09eb8.dir/lapack_pstrf.cc.o -MF CMakeFiles/cmTC_09eb8.dir/lapack_pstrf.cc.o.d -o CMakeFiles/cmTC_09eb8.dir/lapack_pstrf.cc.o -c /usr/ports/math/lapackpp/work/lapackpp-2023.11.05/config/lapack_pstrf.cc
In file included from /usr/ports/math/lapackpp/work/lapackpp-2023.11.05/config/lapack_pstrf.cc:9:
/usr/ports/math/lapackpp/work/lapackpp-2023.11.05/config/config.h:19:6: error: "must define one of FORTRAN_ADD_, FORTRAN_LOWER, FORTRAN_UPPER"
    #error "must define one of FORTRAN_ADD_, FORTRAN_LOWER, FORTRAN_UPPER"
     ^
/usr/ports/math/lapackpp/work/lapackpp-2023.11.05/config/lapack_pstrf.cc:16:6: error: unknown type name 'dpstrf'
void LAPACK_dpstrf_base(
     ^
/usr/ports/math/lapackpp/work/lapackpp-2023.11.05/config/lapack_pstrf.cc:11:42: note: expanded from macro 'LAPACK_dpstrf_base'
#define LAPACK_dpstrf_base FORTRAN_NAME( dpstrf, DPSTRF )
                                         ^
/usr/ports/math/lapackpp/work/lapackpp-2023.11.05/config/lapack_pstrf.cc:16:6: error: unknown type name 'DPSTRF'
/usr/ports/math/lapackpp/work/lapackpp-2023.11.05/config/lapack_pstrf.cc:11:50: note: expanded from macro 'LAPACK_dpstrf_base'
#define LAPACK_dpstrf_base FORTRAN_NAME( dpstrf, DPSTRF )
                                                 ^
/usr/ports/math/lapackpp/work/lapackpp-2023.11.05/config/lapack_pstrf.cc:16:6: error: function cannot return function type 'void (const char *, const lapack_int *, double *, const lapack_int *, lapack_int *, lapack_int *, const double *, double *, lapack_int *)' (aka 'void (const char *, const int *, double *, const int *, int *, int *, const double *, double *, int *)')
/usr/ports/math/lapackpp/work/lapackpp-2023.11.05/config/lapack_pstrf.cc:11:40: note: expanded from macro 'LAPACK_dpstrf_base'
#define LAPACK_dpstrf_base FORTRAN_NAME( dpstrf, DPSTRF )
                                       ^
/usr/ports/math/lapackpp/work/lapackpp-2023.11.05/config/lapack_pstrf.cc:58:5: error: use of undeclared identifier 'dpstrf'
    LAPACK_dpstrf( "lower", n, A, n, ipiv, &rank, &tol, work, &info );
    ^
/usr/ports/math/lapackpp/work/lapackpp-2023.11.05/config/lapack_pstrf.cc:31:34: note: expanded from macro 'LAPACK_dpstrf'
    #define LAPACK_dpstrf( ... ) LAPACK_dpstrf_base( __VA_ARGS__ )
                                 ^
/usr/ports/math/lapackpp/work/lapackpp-2023.11.05/config/lapack_pstrf.cc:11:42: note: expanded from macro 'LAPACK_dpstrf_base'
#define LAPACK_dpstrf_base FORTRAN_NAME( dpstrf, DPSTRF )
                                         ^
/usr/ports/math/lapackpp/work/lapackpp-2023.11.05/config/lapack_pstrf.cc:58:5: error: use of undeclared identifier 'DPSTRF'
/usr/ports/math/lapackpp/work/lapackpp-2023.11.05/config/lapack_pstrf.cc:31:34: note: expanded from macro 'LAPACK_dpstrf'
    #define LAPACK_dpstrf( ... ) LAPACK_dpstrf_base( __VA_ARGS__ )
                                 ^
/usr/ports/math/lapackpp/work/lapackpp-2023.11.05/config/lapack_pstrf.cc:11:50: note: expanded from macro 'LAPACK_dpstrf_base'
#define LAPACK_dpstrf_base FORTRAN_NAME( dpstrf, DPSTRF )
                                                 ^
6 errors generated.

Version: 2023.11.05 lapack-3.11.0 clang-16 FreeBSD 13.2

mgates3 commented 9 months ago

What BLAS and LAPACK libraries are you using? Is LAPACK part of your BLAS library (as in Intel MKL, Cray LibSci, usually OpenBLAS; not IBM ESSL), or are there separate libraries (e.g., libblas.so and liblapack.so)? Is liblapack.so or liblapack.a in your compiler's LIBRARY_PATH?

Please include the complete input and output of CMake, including any environment variables you may have set ($CXX, $LIBRARY_PATH, etc.).

You can also try the Makefile-based configure. Even if it fails with the same issue, it generates a config/log.txt file for diagnosis.

    lapackpp> make config

You can also try

    lapackpp> mkdir build && cd build
    lapackpp/build> cmake -DCMAKE_MESSAGE_LOG_LEVEL=TRACE ..

but the output is quite verbose and difficult to understand.

Mark

yurivict commented 9 months ago

Here is a complete log.

lapack-3.11.0 is from https://github.com/Reference-LAPACK/lapack/archive/refs/tags/

openblas-0.3.20 is used.

MKL is a linux-only package and isn't available on *BSD.

yurivict commented 7 months ago

@mgates3

Hi Mark,

The build is still failing.

First, LAPACK_LIBRARIES aren't passed to cmake/LAPACKFinder.cmake Second, when LAPACK_LIBRARIES is passed as blaspp, lapack_pstrf.cc fails to compile because it needs -DFORTRAN_ADD_ which isn't provided.

Do you know how to resolve these issues?

Thank you, Yuri