The LAPACK forum has moved to https://github.com/Reference-LAPACK/lapack/discussions.

undefined reference to *

Open discussion regarding features, bugs, issues, vendors, etc.

undefined reference to *

Postby cs521 » Sat Oct 21, 2006 4:48 am

Hi :
I download the lapack from http://www.netlib.org/lapack/lapack.tgz and then I edit it accordingly (my system is redhat 9.0 )
>tar xvzf lapack.tgz
>cd LAPACK
> cp INSTALL/make.inc.LINUX make.inc
>make blas.lib
>make lapacklib
>cp blas_LINUX.a /usr/lib/libblas.a
>cp lapack_LINUX.a /usr/lib/liblapack.a

and then I edit my soft and here is the makefile

.SUFFIXES: .o .f .f90

SHELL = /bin/sh
###################### for intel ################################
#F90 = mpif90 -compiler intel
F90 = /usr/local/mpi/bin/mpif90
#LINKER = mpif90 -compiler intel
LINKER = /usr/local/mpi/bin/mpif90
FLAG = -O3 -xW -tpp7 -static -fixed -w
FLAGS = -O3 -xW -tpp7 -static -fixed -w
FLAGD = -O3 -xW -tpp7 -static -fixed -w
MLWF_FLAGD = -O3 -xW -tpp7 -static -free -w
DEBUG =
LIBS = -L/opt/intel_fc_80/lib -lsvml \
-L/usr/lib -lm -lc \
-L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2 -lg2c
LAPACK = -L/usr/lib -lblas -llapack
#LAPACK =
INCLUDE =
CPPDIR = /usr/bin
CPP = $(CPPDIR)/cpp -P -C -traditional
P_FLAGS = -D_FAST_WAY_ -D_TIME_ -D_OPENFILE_
#P_FLAGS = -D_FAST_WAY_ -D_TIME_ -D_SP_ -D__IBM -D_ESSL_
#P_FLAGS = -D_FAST_WAY_ -D_TIME_ -D_FFTW_ -D_SP_
#P_FLAGS = -D_FAST_WAY_ -D_TIME_ -D__IBM -D_ESSL_
WORKDIR = CPPSRC


MODULES = m_pmd.o m_para.o my_mpi.o

MLWF =

NOVECT = mlwf.o other.o fftg2r.o \

writing.o mix.o moment.o sm_hyb_ene_force.o pdos.o ldau.o \
dav_fd.o pulay.o aldos.o vibration.o scf.o main.o \
header.o input_nhc.o reading_nhc.o writing_nhc.o detdof.o util.o printave.o

m_para_wann.o wann.o project.o mmnkb.o

VECT = dav_jrc1.o xc_gga.o swffft.o chgfft.o stlhxc.o fsrfsi.o \
subspace.o kbint.o setup_hsr.o blugel_ishida.o jrcat_ft.o \
ifft.o ifft_mpi.o eigen.o rmm.o

ALL = $(MODULES) $(MLWF) $(NOVECT) $(VECT)

default: STATE

STATE : $(ALL)
$(LINKER) $(FLAGD) -o STATE $(ALL) $(LAPACK) $(LIBS)

log : $(ALL)
$(LINKER) $(ALL) -o STATE $(FLAGD) $(LIBS) $(DEBUG)

clean:
\rm *.o

$(MODULES): $(@:.o=.f90)
@echo cpping $*.f90
@$(CPP) $(P_FLAGS) < $*.f90 > $(WORKDIR)/$*.f
@echo Compiling $*.f
@(cd $(WORKDIR); $(F90) -c $(FLAG) $(INCLUDE) $*.f; cd ..)
@mv $(WORKDIR)/$@ .

$(MLWF): $(@:.o=.f90)
@echo cpping $*.f90
@$(CPP) $(P_FLAGS) < $*.f90 > $(WORKDIR)/$*.f
@echo Compiling $*.f
@(cd $(WORKDIR); $(F90) -c $(MLWF_FLAG) $(INCLUDE) $*.f; cd ..)
@mv $(WORKDIR)/$@ .


$(NOVECT): $(@:.o=.f90)
@echo cpping $*.f90
@$(CPP) $(P_FLAGS) < $*.f90 > $(WORKDIR)/$*.f
@echo Compiling $*.f
@(cd $(WORKDIR); $(F90) -c $(FLAG) $(INCLUDE) $*.f; cd ..)
@mv $(WORKDIR)/$@ .

$(VECT): $(@:.o=.f90)
@echo cpping $*.f90
@$(CPP) $(P_FLAGS) < $*.f90 > $(WORKDIR)/$*.f
@echo Compiling $*.f
@(cd $(WORKDIR); $(F90) -c $(FLAGS) $(INCLUDE) $*.f; cd ..)
@mv $(WORKDIR)/$@ .

When I type "make " ,there are a lot of errors
stress.o(.text+0x45e): In function `stress_':
: undefined reference to `hsr_diff_'
stress.o(.text+0x9bc1): In function `xcfft_diff_':
: undefined reference to `tstatc0_'
stress.o(.text+0x9da4): In function `xcfft_diff_':
: undefined reference to `xcchg2_'
stress.o(.text+0xa27b): In function `xcfft_diff_':
: undefined reference to `xccgng_'
stress.o(.text+0xa31e): In function `xcfft_diff_':
: undefined reference to `xccgt_'
/usr/lib/liblapack.a(zhegs2.o)(.text+0x606): In function `zhegs2_':
: undefined reference to `zher2_'
/usr/lib/liblapack.a(zhegs2.o)(.text+0x67f): In function `zhegs2_':
: undefined reference to `ztrsv_'
/usr/lib/liblapack.a(zhegs2.o)(.text+0x812): In function `zhegs2_':
: undefined reference to `zher2_'
/usr/lib/liblapack.a(zhegs2.o)(.text+0x87c): In function `zhegs2_':
: undefined reference to `ztrsv_'
make: *** [STATE] Error 1

I can find those *.f90 in LAPACK/SRC and BLAS /SRC .
Has anyone else gotten this to work?
I would appreciate any advice you give me .
Thanks in advance.
cs521
 
Posts: 1
Joined: Sat Oct 21, 2006 4:14 am

Postby Julien Langou » Sat Oct 21, 2006 10:01 am

You have to set of undefined references. You will need to handle by yourself the ones that come from stress.o. For the undefined reference that comes from the liblapack.a library, this is due to
Code: Select all
LAPACK = -L/usr/lib -lblas -llapack

This is wrong. First LAPACK, then BLAS. Thus the following will be clearly better.
Code: Select all
LAPACK = -L/usr/lib -llapack -lblas


-j
Julien Langou
 
Posts: 835
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 6 guests