Question

I am having a difficult time linking clapack to my cmake project on linux and would greatly appreciate any help.

I have successfully built and linked clapack to the same project on osx which makes this situation especially frustrating.

I first downloaded clapack-3.2.1-cmake and compiled the project. I then copied the .a and relevant .h files into a directory, named CLAPACK, under the root directory of my project. (libblas.a, libf2c.a, liblapack.a and libtmglib.a into CLAPACK/lib and blaswrap.h,clapack.h and f2c.h in CLAPACK)

I then altered the cmake file of my project to include

INCLUDE_DIRECTORIES(${VMT_PRJ_SOURCE_DIR}/CLAPACK)
LINK_DIRECTORIES(${VMT_PRJ_SOURCE_DIR}/CLAPACK/lib)
LINK_LIBRARIES( f2c blas lapack tmglib )

These steps allowed me to compile on my mac but upon transferring the project to a linux box and recompiling the clapack library I am getting linking errors which look like this

/home/siggik/Development/SFT-9012/CLAPACK/lib/liblapack.a(sgesvd.c.o): In function     `sgesvd_':
sgesvd.c:(.text+0x456): undefined reference to `s_cat'
sgesvd.c:(.text+0x1fa4): undefined reference to `s_cat'
/home/siggik/Development/SFT-9012/CLAPACK/lib/liblapack.a(sormbr.c.o): In function `sormbr_':
sormbr.c:(.text+0x39f): undefined reference to `s_cat'
sormbr.c:(.text+0x45c): undefined reference to `s_cat'
sormbr.c:(.text+0x527): undefined reference to `s_cat'

Any help would be great. Thanks,

Scott

Was it helpful?

Solution

Some linkers are sentisitive to the order in which libraries are passed when linking them statically.

Try to play with libs order or look at compile command line on OS X.

Also, look at files installed by clapack - maybe there is some CMake module like ClapackConfig.cmake or FindClapack.cmake. If it is, you can get the right libs order from there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top