Menu

#260 BLAS and LAPACK libraries not detected by the CMake

release_4.3.x
open
nobody
None
1
2020-12-21
2020-12-07
Heera S
No

Hi,
I'm trying to develop and build a software application using itpp with BLAS and LAPACK libraries.
But the CMake is not detecting those libraries when I specified the library location using LD_LIBRARY_PATH.

Environment details:
OS: Ubuntu 18.04
Cmake version: 3.16.3

Majorly, I want to cross compile the itpp for arm g++ and i specified the tool chain and file system details correctly in the toolchain_file.cmake. I have the libraries as static under the lib directory of arm's root file system. Exported all the environment variables CC,CXX to point to the arm tool chain and the LD_LLIBRARY_PATH to point to the lib directory of arm's root file system than the default system location /usr/local/lib.
cmake command i used is,
cmake .. -DITPP_SHARED_LIB=off -DBLA_STATIC=on -DCMAKE_TOOLCHAIN_FILE=<xxxx>/toolchain_file.cmake -DBLA_VENDOR=Generic</xxxx>

I hope every item needed by the cmake is set correctly but its not detecting the libraries.
Note: The FFT libraries are detected but not the blas and lapack.

Also i tried t overwrite the -DBLAS_LIBRARIES and -DLAPACK_LIBRARIES explicitly. In that case, the detection warning disappeared and the itpp static library is created. But when i compile a itpp based application using this static library, more compilation errors occurred (Ex: "Undefined reference to <func>"). Attached the file for reference. I think linking is not done properly when overwrite the BLAS_LIBRARIES explicitly.</func>

Please help me to detect the libraries and correct me if overwriting the BLAS_LIBRARIES is a wrong way.

1 Attachments

Discussion

  • Bogdan Cristea

    Bogdan Cristea - 2020-12-07

    Hi
    You are using the correct variabled for specifying the libraries, LAPACK_LIBRARIRES and BLAS_LIBRARIES.
    Try the following:
    - when you cross-compile use
    make VERBOSE=1
    and check if the library is compiled using the correct BLAS/LAPACK libraries
    - make sure that when you compile using the static IT++ library you also add the shared libraries (if any) needed by IT++

    regards
    Bogdan

     
  • Heera S

    Heera S - 2020-12-08

    Hi Bogdan,
    Thank you for your response. I already verified that the CMake is referring the specified static libraries correctly and i don't have any other shared libraries to link.

    Regards,
    Heera

     
  • Bogdan Cristea

    Bogdan Cristea - 2020-12-08

    Hi Heera
    Your message above says that there are compile time errors about missing dependences. So what are these errors specifically ?
    Bogdan

     
  • Heera S

    Heera S - 2020-12-10

    Hi Bogdan,
    i will try to recompile the blas library which im trying to link with for the arm and test it again to check there are no dependencies in the library. Meanwhile when i run cmake, im getting some library(cheev_) not found error, once the BLAS API detected . Is this gives any clue?

    -- A library with BLAS API found.
    -- A library with BLAS API found.
    -- Looking for cheev_
    -- Looking for cheev_ - not found

    Regards,
    Heera

     
  • Bogdan Cristea

    Bogdan Cristea - 2020-12-10

    Hi
    That message is a warning, BLAS library might not expose that specific function, this however does not impact the library functionality, probably only the processing time.
    Bogdan

     
  • Heera S

    Heera S - 2020-12-16

    Hi Bogdan,
    I think there are no issues or dependencies in the external blas library which im trying to link with. The below simple example provides me the same result as i see while cross compiling with external library.

    I downloaded netlib's blas and built libblas.a using native gcc make. Similarly, built libcblas.a using gcc make and linked it with libblas.a .Further i built libitpp_static.a using
    "cmake .. -DITPP_SHARED_LIB=off -DBLA_STATIC=on -DBLAS_LIBRARIES=<xxx>/CBLAS/lib/libcblas.a"
    make
    make install</xxx>

    Then i just wrote a simple hello world program using itpp and compile it using 
    "g++ -static testITPP.cpp -litpp_static -L/usr/local/lib/itpp -I/usr/local/include/itpp"
    There again i see many "undefined reference to <xxx>" errors (attached the log).
    What is missing in the above sequence?
    
    Regards
    Heera
    
     
  • Heera S

    Heera S - 2020-12-20

    Hi Bogdan,
    I'm awaiting for your response. Please try to recreate the same and share the inputs.

    Regards,
    Heera

     
  • Bogdan Cristea

    Bogdan Cristea - 2020-12-21

    Hi
    Can you compile and link separately using BLAS, LAPACK and FFT libraries you found ? Also, as a first step, try to compile the library as static, but link with the shared versions of the external libs.
    Bogdan

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.