make fails with "undefined reference to..."

i am compiling a program called vasp on suse and get the following error. there are many more preprocess and ifort commands prior so i just grabbed the tail of the log file:

./preprocess <main.F | /usr/bin/cpp -P -C -traditional >main.f90 -DMPI  -DHOST=\"LinuxIFC\" -DIFC -Dkind8 -DNGZhalf -DCACHE_SIZE=4000 -DPGF90 -Davoidalloc -DMPI_BLOCK=500 -DRPROMU_DGEMV  -DRACCMU_DGEMV
ifort -FR -lowercase -assume byterecl -I/usr/apps/vasp/4.6/fftw-3.3/include -I/usr/apps/vasp/4.6/mpich2-1.2.1p1/include-FR -O0   -c main.f90
rm -f vasp
ifort -o vasp  main.o  base.o     mpi.o      smart_allocate.o      xml.o constant.o jacobi.o   main_mpi.o  scala.o asa.o      lattice.o  poscar.o   ini.o      setex.o     radial.o pseudo.o   mgrid.o    mkpoints.o wave.o      wave_mpi.o  symmetry.o symlib.o   lattlib.o  random.o    nonl.o     nonlr.o    dfast.o    choleski2.o mix.o      charge.o   xcgrad.o   xcspin.o    potex1.o   potex2.o metagga.o  constrmag.o pot.o      cl_shift.o force.o    dos.o      elf.o tet.o      hamil.o    steep.o chain.o    dyna.o     relativistic.o LDApU.o sphpro.o  paw.o   us.o ebs.o      wavpre.o   wavpre_noio.o broyden.o dynbr.o    rmm-diis.o reader.o   writer.o   tutor.o xml_writer.o brent.o    stufak.o   fileio.o   opergrid.o stepver.o dipol.o    xclib.o    chgloc.o   subrot.o   optreal.o   davidson.o edtest.o   electron.o shm.o      pardens.o  paircorrection.o optics.o   constr_cell_relax.o   stm.o    finite_diff.o elpol.o    setlocalpp.o aedens.o    fftw3d.o fft3dlib.o   /usr/apps/vasp/4.6/fftw-3.3/lib/libfftw3.a -L../vasp.4.lib -ldmy ../vasp.4.lib/linpack_double.o ../vasp.4.lib/lapack_double.o /usr/apps/vasp/4.6/atlas/lib/libf77blas.a /usr/apps/vasp/4.6/atlas/lib/libatlas.a  /usr/apps/vasp/4.6/mpich2-1.2.1p1/lib/libmpich.a /usr/apps/vasp/4.6/mpich2-1.2.1p1/lib/libfmpich.a /usr/apps/vasp/4.6/mpich2-1.2.1p1/lib/libmpichf90.a /usr/apps/vasp/4.6/mpich2-1.2.1p1/lib/libmpichcxx.a /usr/apps/vasp/4.6/mpich2-1.2.1p1/lib/libopa.a
main.o: In function `MAIN__':
main.f90:(.text+0x13af3): undefined reference to `mapset_'
main.f90:(.text+0x13b68): undefined reference to `mapset_'
main.f90:(.text+0x13b77): undefined reference to `mapset_'
main.f90:(.text+0x13bec): undefined reference to `mapset_'
make: *** [vasp] Error 1

any insight would be appreciated.

It's trying to use a variable or function called 'mapset' which does not exist.

i probably should have mentioned i am not a programmer of this type. so although the error is somewhat clear i am certainly not clear on how i might go about "fixing" it. any suggestions would be greatly appreciated.

Neither am I, but this error is common to most languages with a linking step.

this seems to be related. You don't get mapset without certain options.

thanx, but i already had this come up in a google search. i tried to map the thread to my issue to understand what is wrong with no luck. i clearly need more hand holding than what that page offered.

I'm not withholding the answer. I have no more information and no means to test with.

1 Like

i know you're not as most folks here don't. i was just stating a fact. i've already tried a few different things and failed. i'll keep at it and if get it figured out or someone rescues me i'll be sure to post. thanx for chiming in though, always appreciated.

---------- Post updated at 10:03 AM ---------- Previous update was at 10:02 AM ----------

corona688, you got me thinking about it so i started digging deeper. i found a file in the same dir that actually defined the mapset subroutine. so i checked to see if this file was part of the whole compilation process and it was not as it had no equivalent .o file. so that got me to dig even deeper. i then discovered that the makefile defines which files in that dir actually get processed and then get included in the "make"ing of the executable. that one file was missing. once i included it the error disappeared and in its place the executable. thanx for the spark! take care.

1 Like