Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compiling and linking LAPACK 95 (Windows)

Status
Not open for further replies.

NickFort

Technical User
Jun 10, 2010
113
Hi all,

I'm back with another question. I think the title of this thread does need a bit of explanation.

I've downloaded LAPACK (which contains the BLAS source) and LAPACK95 from netlib.org.

As I understand it, LAPACK95 depends on LAPACK, which in turn depends on BLAS.

I want to compile all of this myself; there are Makefiles for all three (none of which works with Windows out of the box, and there is a modification to the Makefile at and a few others) BUT, despite this convenience, I'd still like to compile them myself, as an exercise.

What I've done so far is:

BLAS
Code:
$ gfortran *.f -c -O3
$ gfortran -shared *.o -o libblas.dll

LAPACK
Code:
$ gfortran *.f -c -O3
$ gfortran -shared *.o -o liblapack.dll -L. libblas.dll

With LAPACK, there are a few files in the INSTALL folder that are dependencies of the source files in the SRC folder, which I just copy over to the SRC folder.

The above does compile.

I haven't compiled LAPACK95 yet, and I can't test this yet because I need to wait, but does it sound about right? Do I need the -mrtd option? I've read the GCC manual, but I can't for the life of me figure out what it actually does; all I know is that it's something to do with calling conventions. Does it just set calling convention to stdcall?

I expect that the BLAS portion above is probably OK, but can I just link BLAS to LAPACK with the -L.?

Thanks,
NF

--------------------------------------
Background: Chemical engineer, familiar mostly with MATLAB, but now branching out into real programming.
 
Apologies... "and I can't test this yet because I need to wait" doesn't make sense.

It should read: "and I can't test this yet because I need to wait to compile LAPACK95, and then figure out how to use it".

--------------------------------------
Background: Chemical engineer, familiar mostly with MATLAB, but now branching out into real programming.
 
Actually, no, it doesn't compile. It did yesterday, after having run the Windows-compatible makefile from and using the .o files to make the DLLs seemed to compile fine.

However, starting it afresh gives:

Code:
cla_gbrfsx_extended.o:cla_gbrfsx_extended.f:(.text+0x224): undefined reference to `blas_cgbmv2_x_'
cla_gbrfsx_extended.o:cla_gbrfsx_extended.f:(.text+0xa52): undefined reference to `blas_cgbmv_x_'
cla_gerfsx_extended.o:cla_gerfsx_extended.f:(.text+0x218): undefined reference to `blas_cgemv2_x_'
cla_gerfsx_extended.o:cla_gerfsx_extended.f:(.text+0xa09): undefined reference to `blas_cgemv_x_'
cla_herfsx_extended.o:cla_herfsx_extended.f:(.text+0x222): undefined reference to `blas_chemv2_x_'
cla_herfsx_extended.o:cla_herfsx_extended.f:(.text+0xa02): undefined reference to `blas_chemv_x_'
cla_porfsx_extended.o:cla_porfsx_extended.f:(.text+0x222): undefined reference to `blas_chemv2_x_'
cla_porfsx_extended.o:cla_porfsx_extended.f:(.text+0xa02): undefined reference to `blas_chemv_x_'
cla_syrfsx_extended.o:cla_syrfsx_extended.f:(.text+0x222): undefined reference to `blas_csymv2_x_'
cla_syrfsx_extended.o:cla_syrfsx_extended.f:(.text+0xa02): undefined reference to `blas_csymv_x_'
dla_gbrfsx_extended.o:dla_gbrfsx_extended.f:(.text+0x23c): undefined reference to `blas_dgbmv2_x_'
dla_gbrfsx_extended.o:dla_gbrfsx_extended.f:(.text+0xa56): undefined reference to `blas_dgbmv_x_'
dla_gerfsx_extended.o:dla_gerfsx_extended.f:(.text+0x228): undefined reference to `blas_dgemv2_x_'
dla_gerfsx_extended.o:dla_gerfsx_extended.f:(.text+0xa07): undefined reference to `blas_dgemv_x_'
dla_porfsx_extended.o:dla_porfsx_extended.f:(.text+0x234): undefined reference to `blas_dsymv2_x_'
dla_porfsx_extended.o:dla_porfsx_extended.f:(.text+0x9ee): undefined reference to `blas_dsymv_x_'
dla_syrfsx_extended.o:dla_syrfsx_extended.f:(.text+0x234): undefined reference to `blas_dsymv2_x_'
dla_syrfsx_extended.o:dla_syrfsx_extended.f:(.text+0x9ee): undefined reference to `blas_dsymv_x_'
sla_gbrfsx_extended.o:sla_gbrfsx_extended.f:(.text+0x224): undefined reference to `blas_sgbmv2_x_'
sla_gbrfsx_extended.o:sla_gbrfsx_extended.f:(.text+0xae7): undefined reference to `blas_sgbmv_x_'
sla_gerfsx_extended.o:sla_gerfsx_extended.f:(.text+0x216): undefined reference to `blas_sgemv2_x_'
sla_gerfsx_extended.o:sla_gerfsx_extended.f:(.text+0xaa9): undefined reference to `blas_sgemv_x_'
sla_porfsx_extended.o:sla_porfsx_extended.f:(.text+0x222): undefined reference to `blas_ssymv2_x_'
sla_porfsx_extended.o:sla_porfsx_extended.f:(.text+0xa95): undefined reference to `blas_ssymv_x_'
sla_syrfsx_extended.o:sla_syrfsx_extended.f:(.text+0x222): undefined reference to `blas_ssymv2_x_'
sla_syrfsx_extended.o:sla_syrfsx_extended.f:(.text+0xa95): undefined reference to `blas_ssymv_x_'
zla_gbrfsx_extended.o:zla_gbrfsx_extended.f:(.text+0x237): undefined reference to `blas_zgbmv2_x_'
zla_gbrfsx_extended.o:zla_gbrfsx_extended.f:(.text+0xaa5): undefined reference to `blas_zgbmv_x_'
zla_gerfsx_extended.o:zla_gerfsx_extended.f:(.text+0x229): undefined reference to `blas_zgemv2_x_'
zla_gerfsx_extended.o:zla_gerfsx_extended.f:(.text+0xa57): undefined reference to `blas_zgemv_x_'
zla_herfsx_extended.o:zla_herfsx_extended.f:(.text+0x235): undefined reference to `blas_zhemv2_x_'
zla_herfsx_extended.o:zla_herfsx_extended.f:(.text+0xa55): undefined reference to `blas_zhemv_x_'
zla_porfsx_extended.o:zla_porfsx_extended.f:(.text+0x235): undefined reference to `blas_zhemv2_x_'
zla_porfsx_extended.o:zla_porfsx_extended.f:(.text+0xa45): undefined reference to `blas_zhemv_x_'
zla_syrfsx_extended.o:zla_syrfsx_extended.f:(.text+0x235): undefined reference to `blas_zsymv2_x_'
zla_syrfsx_extended.o:zla_syrfsx_extended.f:(.text+0xa55): undefined reference to `blas_zsymv_x_'
collect2: ld returned 1 exit status

upon running

Code:
$ gfortran *.f -c -O3
$ gfortran -shared *.o -o liblapack.dll -L. libblas.dll

--------------------------------------
Background: Chemical engineer, familiar mostly with MATLAB, but now branching out into real programming.
 
Never mind, got it! (The above routines are for "extended precision", and aren't on by default in the makefile, so I just deleted their object files).

Ignore posts 2 and 3, but the first is still valid.

(Apologies for the monologuing -- I know it's a bit silly on a forum!)

--------------------------------------
Background: Chemical engineer, familiar mostly with MATLAB, but now branching out into real programming.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top