0

Trying to use Lapack in ubuntu 16.04. I have downloaded the lapack 3.6.1, make it and cp liblapack.a and librefblas.a to both /usr/local/lib/ and /usr/lib/

However, when I try to compile my *.f, it looks the lib can not be found. Here is the makefile and error.

Makefile:

`# COMPHY directory path:
COMPHY  =   $(HOME)/Documents/E-books/Computational_Physics/code
LDFLAGS =   -O
FCOPTS  =   -O -c 
FC  =   gfortran
LIBS    =   $(COMPHY)/4570_lib/lib/geneig.a -llapack

%.o:%.f
    $(FC) $(FCOPTS) $<

deepwell: deepwell.o globvarc
    $(FC) $(LDFLAGS) -o deepwell deepwell.o $(LIBS)

deepeven: deepeven.o globvarc
    $(FC) $(LDFLAGS) -o deepeven deepeven.o $(LIBS)

deepodd: deepodd.o globvarc
    $(FC) $(LDFLAGS) -o deepodd deepodd.o $(LIBS) 

clean:
    rm -f *.o deepwell deepodd deepeven`

The error is:

gfortran -O -o deepwell deepwell.o /home/daniel/Documents/E-books

/Computational_Physics/code/4570_lib/lib/geneig.a -llapack
/usr/bin/ld: /home/daniel/Documents/E-books/Computational_Physics/code/4570_lib/lib/geneig.a(geneig.o): undefined reference to symbol 'dgemm_'
//usr/lib/libblas.so.3: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
makefile:12: recipe for target 'deepwell' failed
make: *** [deepwell] Error 1

-llapckseems doesn't work at all.

New to ubuntu, hopefully could get a solution or explanation. Thank you all.

  • Its kind of a duplicated question. look [here](http://stackoverflow.com/questions/20669410/gfortran-lapack-undefined-reference-error). also the problem is that you need to identify the lib location for gfortran like: `-L/directory/of/the/library` or if its a makefile like your's you need to include `/usr/lib/librefblas.a` in lib and `/usr/lib/liblapack.a` if you copied it manually in that directory. – Eisa Oct 02 '16 at 23:40
  • @Eisa, Thank you for your solution. Meanwhile, I also noticed that `/usr/bin/ld: /home/daniel/Documents/E-books/Computational_Physics/code/4570_lib/lib/geneig.a(geneig.o): undefined reference to symbol 'dgemm_'` is because the routine dgemm belongs to BLAS, if link the libblas to object file, it would work. Thank you again for your time. – Huada Lian Oct 04 '16 at 05:41

0 Answers0