Errors when compiling LAMMPS on CentOS 6.2 with OpenMPI

I am a very new user to Linux and compiling on my own cluster. I have attempted to install OpenMPI on my own and thereafter compile LAMMPS (21 Jan 2013). However I encountered errors which I simply could not resolve:

angle_charmm.o: In function Intracomm': /usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to MPI::Comm::Comm()’
/usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to MPI::Comm::Comm()' angle_charmm.o: In function Intracomm’:
/usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/intracomm_inln.h:23: undefined reference to MPI::Comm::Comm()' angle_charmm.o: In function MPI::Op::Init(void ()(void const, void*, int, MPI::Datatype const&), bool)’:
/usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/op_inln.h:122: undefined reference to ompi_mpi_cxx_op_intercept' angle_charmm.o: In function Intracomm’:
/usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to MPI::Comm::Comm()' /usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to MPI::Comm::Comm()’
/usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to MPI::Comm::Comm()' angle_charmm.o: In function Intracomm’:
/usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/intracomm_inln.h:23: undefined reference to MPI::Comm::Comm()' /usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/intracomm_inln.h:23: undefined reference to MPI::Comm::Comm()’
angle_charmm.o:/usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/intracomm_inln.h:23: more undefined references to MPI::Comm::Comm()' follow angle_charmm.o:(.rodata._ZTVN3MPI3WinE[vtable for MPI::Win]+0x48): undefined reference to MPI::Win::Free()’
angle_charmm.o:(.rodata._ZTVN3MPI8DatatypeE[vtable for MPI::Datatype]+0x78): undefined reference to MPI::Datatype::Free()' collect2: ld returned 1 exit status make[1]: *** [../lmp_linux] Error 1 make[1]: Leaving directory /opt/lammps-21Jan13/src/Obj_linux’
make: *** [linux] Error 2

Does anyone have experience with this issue? Have I somehow installed OpenMPI wrongly or is this an issue with LAMMPS? I issued the commands:

make yes-standard no-GPU no-REAX no-POEMS no-MEAM no-KIM

My makefile settings are as below:

SHELL = /bin/sh

---------------------------------------------------------------------

compiler/linker settings

specify flags and libraries needed for your compiler

CC = mpicc
CCFLAGS = -g -O
SHFLAGS = -fPIC
DEPFLAGS = -M

LINK = mpicc
LINKFLAGS = -O
LIB = -lstdc++
SIZE = size

ARCHIVE = ar
ARFLAGS = -rc
SHLIBFLAGS = -shared

---------------------------------------------------------------------

LAMMPS-specific settings

specify settings for LAMMPS features you will use

if you change any -D setting, do full re-compile after “make clean”

LAMMPS ifdef settings, OPTIONAL

see possible settings in doc/Section_start.html#2_2 (step 4)

LMP_INC = -DLAMMPS_GZIP

MPI library, REQUIRED

see discussion in doc/Section_start.html#2_2 (step 5)

can point to dummy MPI library in src/STUBS as in Makefile.serial

INC = path for mpi.h, MPI compiler settings

PATH = path for MPI library

LIB = name of MPI library

MPI_INC = -DMPICH_IGNORE_CXX_SEEK
MPI_PATH =
MPI_LIB =

FFT library, OPTIONAL

see discussion in doc/Section_start.html#2_2 (step 6)

can be left blank to use provided KISS FFT library

INC = -DFFT setting, e.g. -DFFT_FFTW, FFT compiler settings

PATH = path for FFT library

LIB = name of FFT library

FFT_INC =
FFT_PATH =
FFT_LIB =

JPEG library, OPTIONAL

see discussion in doc/Section_start.html#2_2 (step 7)

only needed if -DLAMMPS_JPEG listed with LMP_INC

INC = path for jpeglib.h

PATH = path for JPEG library

LIB = name of JPEG library

JPG_INC =
JPG_PATH =
JPG_LIB =

I would be very grateful for any pointers with regards to this issue, thank you!

Regards,
Jingjie Yeo
Ph.D. Student
School of Mechanical and Aerospace Engineering
Nanyang Technological University, Singapore

I am a very new user to Linux and compiling on my own cluster. I have
attempted to install OpenMPI on my own and thereafter compile LAMMPS (21 Jan
2013). However I encountered errors which I simply could not resolve:

please replace -DMPICH_IGNORE_CXX_SEEK (which is for MPICH)
with -DOMPI_SKIP_MPICXX=1 (which is the equivalent for OpenMPI).

you have to do a make clean-all since this affect inline functions.

once you get a working executable, you should try compiler
optimization to get a noticeable speed increase.

i have for CCFLAGS:
-O2 -fno-rtti -fno-exceptions -march=native -ffast-math -mpc64 \
-finline-functions -funroll-loops -fstrict-aliasing

good luck,
     axel.