Page 1 of 1

lapacke linux installation

PostPosted: Thu Feb 03, 2011 7:29 pm
by shifles
I'm having some trouble getting my lapacke installation working on Ubuntu. I'm fairly new to c and Lapack, so feel free to talk to me like a 4 year old. If there's an installation guide for lapacke, I haven't seen it. I am trying to get ... _row.c.htm to compile. I went through and changed the MKL_INT to int and specified <lapacke.h> where they have "mkl_lapacke.h".

I have installed the liblapack-dev and libblas-dev packages via apt-get and downloaded lapacke.tgz from intel. I'm not entirely sure how to edit the file for my system. I used the make.gnu file as a template and currently have:
Code: Select all
CC = gcc

I have also tried LINKER = gfortran as per the info within

Also in this file I have (a possibly offensive):

Code: Select all
LAPACKE = lapacke.a
LIBS = /usr/lib/liblapack-3.a /usr/lib/libblas-3.a -lm

These files do exist in my system, as do /usr/lib/liblapack.a and /usr/lib/libblas.a, which I have also tried.

Upon make lapacke, everything compiles (without error, though it is with gcc -c and it is the linking which eventually gives me trouble).

I then try to compile the test program mentioned above with the naive:
Code: Select all
gcc -o lapacketest -I/home/user/Downloads/lapacke/include/  lapacketest.c

to which I get
Code: Select all
lapacketest.c:(.text+0x88): undefined reference to `LAPACKE_dsyev'
collect2: ld returned 1 exit status

so I use the only slightly less naive
Code: Select all
gcc -o lapacketest -I/home/user/Downloads/lapacke/include/  -I/home/user/Downloads/lapacke/ /home/user/Downloads/lapacke/lapacke.a /home/user/Downloads/lapacke/src/lapacke_dsyev.o lapacketest.c

to which I get a new, slightly more frustrating error:
/home/user/Downloads/lapacke/src/lapacke_dsyev.o: In function `LAPACKE_dsyev':
lapacke_dsyev.c:(.text+0x43): undefined reference to `LAPACKE_xerbla'
lapacke_dsyev.c:(.text+0x75): undefined reference to `LAPACKE_dsy_nancheck'
lapacke_dsyev.c:(.text+0xc8): undefined reference to `LAPACKE_dsyev_work'
lapacke_dsyev.c:(.text+0x153): undefined reference to `LAPACKE_dsyev_work'
lapacke_dsyev.c:(.text+0x180): undefined reference to `LAPACKE_xerbla'
collect2: ld returned 1 exit status

I can continue this for a while, adding each missing .o, that the new error gives me--but it doesn't seem to get any closer to a resolution and it seems as though there's gotta be a better way. I assume that this has something to do with calling the linking in, but I'm not sure if that's true or how to fix it, and none of the things I've tried so far have resolved the problem. I've also tried including -llapack-3 and -lblas-3 or -llapack and -lblas but they didn't change the problem, and as the problem seems to be with a LAPACKE call, it seems as though we're still at the lapacke level and not quite to the lapack level.

If anyone has any advice, or an installation procedure/usable, I would greatly appreciate it!

Re: lapacke linux installation

PostPosted: Fri Feb 04, 2011 8:41 am
by admin
First, lapacke is a common project between the LAPACK and the MKL team.
Not sure where you downloaded lapacke, but lapacke is available at ... for_lapack

It seems that you compiled and generated correctly the lapacke library.

The linking sequence should be:
Code: Select all
gcc -o lapacketest -I/home/user/Downloads/lapacke/include/  lapacketest.c /home/user/Downloads/lapacke/lapacke.a /usr/lib/liblapack.a /usr/lib/libblas.a -lm

You still need the LAPACK and BLAS library on top of the LAPACKE library.
Let me know if this works.
LAPACKE is a brand new project and we are working on writing a User documentation.
In the mean time, feel free to ask questions on the forum.