Page 1 of 1

[SOLVED]Problems of CLAPACK-3.2.1 installation on Ubuntu9.04

PostPosted: Thu Sep 30, 2010 7:22 am
by dehiker
I'm trying to install CLAPACK-3.2.1 on ubuntu9.04, which is running on VirtualBox3.2.8. And the host‘s OS is win7. The installation process is carried out under the instruction of README.install.

While I successfully finish the first three steps( tar, make f2clib, make blaslib, to be specific, no error reported ), problems begin to occur in the 4th one:
cd CLAPACK/BLAS/TESTING; make -f Makeblat2
cd CLAPACK/BLAS
xblat2s < sblat2.in
xblat2d < dblat2.in
xblat2c < cblat2.in
xblat2z < zblat2.in
cd CLAPACK/BLAS/TESTING; make -f Makeblat3
cd CLAPACK/BLAS
xblat3s < sblat3.in
xblat3d < dblat3.in
xblat3c < cblat3.in
xblat3z < zblat3.in
It's expected to get some output files *.SUMM, but I don't see any.

However, I proceed the 5th step: cd CLAPACK/SRC; make; Sadly, I got error report as follows:
ar: ../INSTALL/slamch.o: No such file or directory
make: *** [../lapack_LINUX.a] Error 1

But I have slamch.c under /INSTALL/. I'm bewildered why there's no slamch.o file generated.

Any hints about the problems? Also, it's said that I should copy the generated *.a files to /usr/local/lib/. Is that all before I can use CLAPACK? ( Sorry to bother you with such a question, I'm not familiar with Linux yet :-(. )

Re: Problems of CLAPACK-3.2.1 installation on Ubuntu9.04

PostPosted: Wed Oct 06, 2010 3:24 am
by admin
Just type make in the CLAPACK directory
That should solve your compilation problem.
Julie

Re: Problems of CLAPACK-3.2.1 installation on Ubuntu9.04

PostPosted: Sun Oct 10, 2010 5:03 am
by dehiker
Thank you for your helpful reply!

But I got an error report while I run the example program given on the FAQ 1.9 : http://www.netlib.org/clapack/faq.html#1.5
test.c: In function ‘main’:
test.c:52: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘integer’
/tmp/ccgaWXqm.o: In function `main':
test.c:(.text+0x160): undefined reference to `dgesvd_'
collect2: ld returned 1 exit status


To be specific, after renaming make.inc.example make.inc, and I make directly.
After successful compilation, I got
blas_LINUX.a, lapack_LINUX.a, tmglib_LINUX.a and F2CLIBS/libf2c.a.

Then I copy the four *.a files to /usr/local/lib ( I prefix 'lib' to *.a filenames also ).
Also I copy
INCLUDE/clapack.h, INCLUDE/f2c.h, INCLUDE/blaswrap.h
to
/usr/local/include
Lastly, I type the command
/sbin/ldconfig

Then I run the program:
sudo gcc -o test test.c
here, I got error report as mentioned above.
Is there anything wrong? Or how to include the CLAPACK correctly?

By the way, I make again when I have some *.a files in the CLAPACK directory, and I get the following error reports:
Time for 1,000,000 SAXPY ops = .00 seconds
*** Error: Time for operations was zero
Including SECOND, time = .00 seconds
Average time for SECOND = .00 milliseconds
Time for 1,000,000 DAXPY ops = .00 seconds
*** Error: Time for operations was zero
Including DSECND, time = .00 seconds
Average time for DSECND = .00 milliseconds
Does any body have any hints?

Thank you in advance!
by dehiker

Re: Problems of CLAPACK-3.2.1 installation on Ubuntu9.04

PostPosted: Wed Oct 13, 2010 8:55 am
by dehiker
I find that I don't have any basic knowledge about how to use static libraries before. Sorry :-(
After reading how to use static libraries as mentioned in "LInux Programming Bible", I restarted as follows:

make in CLAPACK directory, and then
cp lapack_LINUX.a liblapack_LINUX.a
cp blas_LINUX.a libblas_LINUX.a
ranlib libblas_LINUX.a
ranlib liblapack_LINUX.a


cd F2CLIBS/
cp libf2c.a liblibf2c.a
ranlib liblibf2c.a


cp liblibf2c.a ../

Finally, I copy the example program listed on http://www.netlib.org/clapack/faq.html#1.5 to CLAPACK/test.c, then compile and link with the command :
gcc -Wall -o test test.c -L. -I./INCLUDE/ -lblas_LINUX -llapack_LINUX -llibf2c -lm
Here I get many errors, some of which as follows:
./liblapack_LINUX.a(dgesvd.o): In function `dgesvd_':
dgesvd.c:(.text+0x3cf8): undefined reference to `f2c_dgemm'
dgesvd.c:(.text+0x40f7): undefined reference to `f2c_dgemm'
dgesvd.c:(.text+0x5327): undefined reference to `f2c_dgemm'
dgesvd.c:(.text+0x57d0): undefined reference to `f2c_dgemm'
dgesvd.c:(.text+0x6ab2): undefined reference to `f2c_dgemm'
./liblapack_LINUX.a(dgesvd.o):dgesvd.c:(.text+0x6df9): more undefined references to `f2c_dgemm' follow
./liblapack_LINUX.a(dbdsqr.o): In function `dbdsqr_':
dbdsqr.c:(.text+0x66c): undefined reference to `f2c_dscal'
dbdsqr.c:(.text+0x762): undefined reference to `f2c_dswap'
dbdsqr.c:(.text+0x7b6): undefined reference to `f2c_dswap'
dbdsqr.c:(.text+0x800): undefined reference to `f2c_dswap'
dbdsqr.c:(.text+0xdab): undefined reference to `f2c_drot'
dbdsqr.c:(.text+0xe13): undefined reference to `f2c_drot'
dbdsqr.c:(.text+0xe75): undefined reference to `f2c_drot'
./liblapack_LINUX.a(dlasq1.o): In function `dlasq1_':
dlasq1.c:(.text+0x1ec): undefined reference to `f2c_dcopy'
dlasq1.c:(.text+0x220): undefined reference to `f2c_dcopy'
./liblapack_LINUX.a(dgebrd.o): In function `dgebrd_':
dgebrd.c:(.text+0x403): undefined reference to `f2c_dgemm'


It seems that libf2c is not linked successfully. But I think I do have linked the lib, as "-llibf2c" in the gcc command.
What's wrong with what I did? Any ideas?

Thanks a lot!

dehiker

Re: Problems of CLAPACK-3.2.1 installation on Ubuntu9.04

PostPosted: Fri Oct 15, 2010 12:25 pm
by cottrell
dehiker wrote:It seems that libf2c is not linked successfully. But I think I do have linked the lib, as "-llibf2c" in the gcc command.


That should be -lf2c -- you omit the initial "lib" from the name
of libraries to link.

Re: Problems of CLAPACK-3.2.1 installation on Ubuntu9.04

PostPosted: Sat Oct 16, 2010 8:06 am
by dehiker
Thank you, cottrell!

But the problem is still not solved. In fact, I've renamed libf2c.a as liblibf2c.a ( maybe it's not a good habit? ). I think maybe I've something wrong during the compilation process?
make in CLAPACK directory, and then
cp lapack_LINUX.a liblapack_LINUX.a
cp blas_LINUX.a libblas_LINUX.a
ranlib libblas_LINUX.a
ranlib liblapack_LINUX.a

cd F2CLIBS/
cp libf2c.a liblibf2c.a
ranlib liblibf2c.a

cp liblibf2c.a ../


Best regards!
dehiker

Re: Problems of CLAPACK-3.2.1 installation on Ubuntu9.04

PostPosted: Wed Oct 20, 2010 9:31 am
by cottrell
dehiker wrote:Thank you, cottrell!

But the problem is still not solved. In fact, I've renamed libf2c.a as liblibf2c.a ( maybe it's not a good habit? ).


No, definitely not ;-). Just use the correct linker syntax.

Note also that you have the order of liblapack and libblas wrong in
your linker invocation. It should be

Code: Select all
-llapack -lblas -lf2c


lapack needs symbols from blas (but not vice versa), therefore blas should
appear after lapack so that the linker knows which symbols are required.

Re: Problems of CLAPACK-3.2.1 installation on Ubuntu9.04

PostPosted: Thu Oct 21, 2010 2:50 am
by dehiker
Thank you so much, cottrell! Problems solved!

I find the order of the libraries in my linker invocation is of the issue. And executable file generated successfully while I use the following command:
Code: Select all
gcc -Wall -o test2 test.c -I./INCLUDE -L. -llapack_LINUX -lblas_LINUX -llibf2c -lm


Thank you all for your great help! Best regards!

dehiker

Re: [SOLVED]Problems of CLAPACK-3.2.1 installation on Ubuntu

PostPosted: Thu Mar 31, 2011 10:06 pm
by qiaoshiya
@dehiker:

Thank you for documenting your efforts so well here. Reading this thread completely solved my problem. Cheers!

Re: [SOLVED]Problems of CLAPACK-3.2.1 installation on Ubuntu

PostPosted: Mon Apr 04, 2011 9:56 am
by vailderiss
I had same problem thanks.

Re: [SOLVED]Problems of CLAPACK-3.2.1 installation on Ubuntu

PostPosted: Tue May 15, 2012 10:48 pm
by fmafunenga
Man! What a crazy confusion is to compile clapack...

I had the same problems of dehiker, qiaoshiya and vailderiss. And in the end there was also a twist with the includes:
This:
Code: Select all
#include "clapack.h"
#include "f2c.h"

is a great trap (for a noob like me) and its wrong. I had to "cat ./INCLUDE/f2c.h" to see that clapack.h needs declarations from f2c.h.

Word of advise:
NEVER CHANGE THE ORDER OF THE #INCLUDES lol

The correct version is this:
Code: Select all
#include "f2c.h"
#include "clapack.h"