Dear Siesta developers/users:

I tried to compile the trunk branch (746 revisions). However, although I 
compiled the code successfully as a serial version, the compilation with MPI 
does not work, reporting the following errors at the last step (linking obj 
files into the executables):

fsockets.o: In function `__f90sockets_MOD_readbuffer_dv':
fsockets.f90:(.text+0x23): undefined reference to `readbuffer'
fsockets.o: In function `__f90sockets_MOD_readbuffer_s':
fsockets.f90:(.text+0x89): undefined reference to `readbuffer'
fsockets.f90:(.text+0xef): undefined reference to `readbuffer'
fsockets.o: In function `__f90sockets_MOD_readbuffer_i':
fsockets.f90:(.text+0x125): undefined reference to `readbuffer'
fsockets.o: In function `__f90sockets_MOD_readbuffer_d':
fsockets.f90:(.text+0x155): undefined reference to `readbuffer'
fsockets.o: In function `__f90sockets_MOD_writebuffer_dv':
fsockets.f90:(.text+0x183): undefined reference to `writebuffer'
fsockets.o: In function `__f90sockets_MOD_writebuffer_s':
fsockets.f90:(.text+0x1fc): undefined reference to `writebuffer'
fsockets.f90:(.text+0x221): undefined reference to `writebuffer'
fsockets.o: In function `__f90sockets_MOD_writebuffer_i':
fsockets.f90:(.text+0x257): undefined reference to `writebuffer'
fsockets.o: In function `__f90sockets_MOD_writebuffer_d':
fsockets.f90:(.text+0x27b): undefined reference to `writebuffer'
fsockets.o: In function `__f90sockets_MOD_create_socket':
fsockets.f90:(.text+0x38f): undefined reference to `create_socket'
fsockets.o: In function `__f90sockets_MOD_open_socket':
fsockets.f90:(.text+0x41f): undefined reference to `open_socket'
fsockets.o: In function `__f90sockets_MOD_close_socket':
fsockets.f90:(.text+0x1): undefined reference to `close_socket'
collect2: error: ld returned 1 exit status

I wonder if you could help me to identify the problem? I am using intelmpi 
(g++/gfortran) and my arch.make file is as follows:

.SUFFIXES:
.SUFFIXES: .f .F .o .c .a .f90 .F90

SIESTA_ARCH = x86-64

CC = g++
FPP = $(FC) -E -P
FC = mpif90
FC_SERIAL = gfortran

FFLAGS = -O2 -fPIC

AR = ar
RANLIB = ranlib

SYS = nag

SP_KIND = 4
DP_KIND = 8
KINDS = $(SP_KIND) $(DP_KIND)

LDFLAGS =

#COMP_LIBS = libsiestaLAPACK.a libsiestaBLAS.a

FPPFLAGS = $(DEFS_PREFIX)-DMPI -DFC_HAVE_FLUSH -DFC_HAVE_ABORT #

LIBS = -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64 -lmkl_lapack95_lp64 
-lmkl_intel_lp64 \
      -lmkl_intel_thread -lmkl_core -liomp5 -lm -lpthread

# SIESTA needs an F90 interface to MPI
MPI_INTERFACE = libmpi_f90.a
MPI_INCLUDE = .

# Dependency rules ---------

FFLAGS_DEBUG = -g -O1   # your appropriate flags here...

# The atom.f code is very vulnerable. Particularly the Intel compiler
# will make an erroneous compilation of atom.f with high optimization
# levels.
atom.o: atom.F
        $(FC) -c $(FFLAGS_DEBUG) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $< 

.c.o:
        $(CC) -c $(CFLAGS) $(INCFLAGS) $(CPPFLAGS) $< 
.F.o:
        $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F)  $< 
.F90.o:
        $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_free_F90) $< 
.f.o:
        $(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_fixed_f)  $<
.f90.o:
        $(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_free_f90)  $<


Thank you very much!

Best,
Zhiping

Responder a