-lmpich errore during compile

during compiling last release of lammps, I obtain this error afer long compilation time

/usr/bin/ld: cannot find -lmpich
collect2: ld returned 1 exit status
make[1]: *** […/lmp_mpi] Error 1
make[1]: Leaving directory `/opt/lammps-31Mar17/src/Obj_mpi’
make: *** [mpi] Error 2


compiler/linker settings

specify flags and libraries needed for your compiler

export OMPI_CXX = g++
CC = /opt/openmpi-1.4.5/bin/mpicxx
CCFLAGS = -g -O3

LINK = /opt/openmpi-1.4.5/bin/mpicxx
SIZE = size

SHLIBFLAGS = -shared


LAMMPS-specific settings, all OPTIONAL

specify settings for LAMMPS features you will use

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

LAMMPS ifdef settings

see possible settings in Section 2.2 (step 4) of manual


MPI library

see discussion in Section 2.2 (step 5) of manual

MPI wrapper compiler/linker can provide this info

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

use -D MPICH and OMPI settings in INC to avoid C++ lib conflicts

INC = path for mpi.h, MPI compiler settings

PATH = path for MPI library

LIB = name of MPI library

MPI_INC = -I/opt/openmpi-1.4.5/include -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1
MPI_PATH = -L/opt/openmpi-1.4.5/lib -lmpich
MPI_LIB = -lmpich -lpthread

FFT library

see discussion in Section 2.2 (step 6) of manual

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 = -I/usr/local/fftw-3.3.6-pl2/include -DFFT_FFTW3
FFT_PATH = -L/usr/local/fftw-3.3.6-pl2/lib
FFT_LIB = -lfftw3




now the error is

/usr/bin/ld: cannot find -lmpich

what path lib I must insert in makefile




​sorry the ‘correct’ error is

/usr/bin/ld: cannot find -lmp

what path lib I must insert in makefile



You probably want -lmpi. That’s a “i” at the end, not a small “L”.


Nearly all your compiling errors have to do with libraries or includes, etc not being in your PATH. Try to figure out how to add them to your PATH or find them on your system and put the full path in the Makefile, so it can find what it is looking for.


the error is correctly
/usr/bin/ld: cannot find -lmpl
collect2: ld returned 1 exit status
make[1]: *** […/lmp_mpi] Error 1
make[1]: Leaving directory `/opt/lammps-31Mar17/src/Obj_mpi’
make: *** [mpi] Error 2

with small ‘L’

but what library have extension -lmpl

perahps a lib LAMMPS?

I compiled reax poems meeam

and this is my status package
]# make package-status
Installed YES: package ASPHERE
Installed YES: package BODY
Installed YES: package CLASS2
Installed YES: package COLLOID
Installed YES: package COMPRESS
Installed YES: package CORESHELL
Installed YES: package DIPOLE
Installed NO: package GPU
Installed YES: package GRANULAR
Installed NO: package KIM
Installed NO: package KOKKOS
Installed YES: package KSPACE
Installed YES: package MANYBODY
Installed YES: package MC
Installed YES: package MEAM
Installed YES: package MISC
Installed YES: package MOLECULE
Installed YES: package MPIIO
Installed NO: package MSCG
Installed YES: package OPT
Installed YES: package PERI
Installed YES: package POEMS
Installed NO: package PYTHON
Installed YES: package QEQ
Installed YES: package REAX
Installed YES: package REPLICA
Installed YES: package RIGID
Installed YES: package SHOCK
Installed YES: package SNAP
Installed YES: package SRD
Installed NO: package VORONOI

Installed NO: package USER-ATC
Installed NO: package USER-AWPMD
Installed NO: package USER-CG-CMM
Installed NO: package USER-CGDNA
Installed NO: package USER-COLVARS
Installed NO: package USER-DIFFRACTION
Installed NO: package USER-DPD
Installed NO: package USER-DRUDE
Installed NO: package USER-EFF
Installed NO: package USER-FEP
Installed NO: package USER-H5MD
Installed NO: package USER-INTEL
Installed NO: package USER-LB
Installed NO: package USER-MANIFOLD
Installed NO: package USER-MGPT
Installed NO: package USER-MISC
Installed NO: package USER-MOLFILE
Installed NO: package USER-NC-DUMP
Installed NO: package USER-OMP
Installed NO: package USER-PHONON
Installed NO: package USER-QMMM
Installed NO: package USER-QTB
Installed NO: package USER-QUIP
Installed NO: package USER-REAXC
Installed NO: package USER-SMD
Installed NO: package USER-SMTBQ
Installed NO: package USER-SPH
Installed NO: package USER-TALLY
Installed NO: package USER-VTK


The point is that you have written -lmpl in your makefile, but there is no such library. You should correct that to -lmpi which Stefan suggested. The error correctly shows that it cannot find -lmpl.

So fix your makefile :slight_smile:

I think to be near at the end of installation

thanks to see an refused error in makefile !!!

Now I recived this error

/usr/bin/ld: cannot find -lfftw
collect2: ld returned 1 exit status
make[1]: *** […/lmp_mpi] Error

in may make file

FFT_INC = -I/usr/local/fftw-3.3.4/include -DFFT_FFTW
FFT_PATH = -L/usr/local/fftw-3.3.4/lib
FFT_LIB = -lfftw

in my fftw-3.3.4/lib


I must create a link or I must compile a differnt version of FFTW



The linker looks for a file named libfftw.a, but as you mentioned, your file is called libfftw3.a. You can try to change your makefile to link with
FFT_LIB = -lfftw3


with this link

FFT_INC = -I/usr/local/fftw-3.3.6-pl2/include -DFFT_FFTW3
FFT_PATH= -L/usr/local/fftw-3.3.6-pl2/lib
FFT_LIB = -lfftw3

I obtain

obtain long sequence of this

reax_inout.F:(.text+0x79aa): undefined reference to for_read_seq_fmt' reax_inout.F:(.text+0x79da): undefined reference to for_read_seq_fmt_xmit’
reax_inout.F:(.text+0x7aa2): undefined reference to for_read_seq_fmt' reax_inout.F:(.text+0x7ad6): undefined reference to for_read_seq_fmt_xmit’
reax_inout.F:(.text+0x7b0a): undefined reference to for_read_seq_fmt_xmit' reax_inout.F:(.text+0x7b45): undefined reference to for_read_seq_fmt_xmit’
reax_inout.F:(.text+0x7b7f): undefined reference to for_read_seq_fmt_xmit' reax_inout.F:(.text+0x7cf1): undefined reference to for_write_seq_lis’
reax_inout.F:(.text+0x7e41): undefined reference to for_write_seq_lis' reax_inout.F:(.text+0x7ee0): undefined reference to for_write_seq_lis’
reax_inout.F:(.text+0x7ff6): undefined reference to for_write_seq_lis' reax_inout.F:(.text+0x801a): undefined reference to for_write_seq_lis_xmit’
reax_inout.F:(.text+0x8055): undefined reference to for_write_seq_lis_xmit' reax_inout.F:(.text+0x8149): undefined reference to for_write_seq_lis’
reax_inout.F:(.text+0x81f8): undefined reference to for_write_seq_lis' reax_inout.F:(.text+0x8234): undefined reference to for_write_seq_lis_xmit’
reax_inout.F:(.text+0x8300): undefined reference to for_write_seq_lis' reax_inout.F:(.text+0x83c3): undefined reference to for_write_seq_lis’
reax_inout.F:(.text+0x8511): undefined reference to for_write_seq_lis' reax_inout.F:(.text+0x8544): undefined reference to for_write_seq_lis_xmit’
reax_inout.F:(.text+0x856f): undefined reference to for_write_seq_lis_xmit' reax_inout.F:(.text+0x85a0): undefined reference to for_write_seq_lis_xmit’
reax_inout.F:(.text+0x85ed): undefined reference to for_write_seq_lis_xmit' reax_inout.F:(.text+0x876c): undefined reference to for_write_seq_lis’
reax_inout.F:(.text+0x879f): undefined reference to for_write_seq_lis_xmit' reax_inout.F:(.text+0x87ca): undefined reference to for_write_seq_lis_xmit’
reax_inout.F:(.text+0x8816): undefined reference to for_write_seq_lis_xmit' reax_inout.F:(.text+0x88fb): undefined reference to for_write_seq_lis’
reax_inout.F:(.text+0x8924): undefined reference to for_write_seq_lis_xmit' reax_inout.F:(.text+0x894d): undefined reference to for_write_seq_lis_xmit’

I think there is a great problem in source code


with this link

FFT_INC = -I/usr/local/fftw-3.3.6-pl2/include -DFFT_FFTW3
FFT_PATH= -L/usr/local/fftw-3.3.6-pl2/lib
FFT_LIB = -lfftw3

I obtain

obtain long sequence of this

reax_inout.F:(.text+0x79aa): undefined reference to `for_read_seq_fmt'
reax_inout.F:(.text+0x79da): undefined reference to `for_read_seq_fmt_xmit'
reax_inout.F:(.text+0x7aa2): undefined reference to `for_read_seq_fmt'
reax_inout.F:(.text+0x7ad6): undefined reference to `for_read_seq_fmt_xmit'
reax_inout.F:(.text+0x7b0a): undefined reference to `for_read_seq_fmt_xmit'
reax_inout.F:(.text+0x7b45): undefined reference to `for_read_seq_fmt_xmit'
reax_inout.F:(.text+0x7b7f): undefined reference to `for_read_seq_fmt_xmit'
reax_inout.F:(.text+0x7cf1): undefined reference to `for_write_seq_lis'
reax_inout.F:(.text+0x7e41): undefined reference to `for_write_seq_lis'
reax_inout.F:(.text+0x7ee0): undefined reference to `for_write_seq_lis'
reax_inout.F:(.text+0x7ff6): undefined reference to `for_write_seq_lis'
reax_inout.F:(.text+0x801a): undefined reference to
reax_inout.F:(.text+0x8055): undefined reference to
reax_inout.F:(.text+0x8149): undefined reference to `for_write_seq_lis'
reax_inout.F:(.text+0x81f8): undefined reference to `for_write_seq_lis'
reax_inout.F:(.text+0x8234): undefined reference to
reax_inout.F:(.text+0x8300): undefined reference to `for_write_seq_lis'
reax_inout.F:(.text+0x83c3): undefined reference to `for_write_seq_lis'
reax_inout.F:(.text+0x8511): undefined reference to `for_write_seq_lis'
reax_inout.F:(.text+0x8544): undefined reference to
reax_inout.F:(.text+0x856f): undefined reference to
reax_inout.F:(.text+0x85a0): undefined reference to
reax_inout.F:(.text+0x85ed): undefined reference to
reax_inout.F:(.text+0x876c): undefined reference to `for_write_seq_lis'
reax_inout.F:(.text+0x879f): undefined reference to
reax_inout.F:(.text+0x87ca): undefined reference to
reax_inout.F:(.text+0x8816): undefined reference to
reax_inout.F:(.text+0x88fb): undefined reference to `for_write_seq_lis'
reax_inout.F:(.text+0x8924): undefined reference to
reax_inout.F:(.text+0x894d): undefined reference to

I think there is a great problem in source code

​no. PEBCAK.

this often happens to people that don't pay sufficient attention to README
files and manuals.​


Compile without reax and get a successful compile before you start trying to compile with reax.


thanks joshua for your idea… now the compile end successfully

Thanks a lot to all for ideas, time, and pacience