Error when trying to use "make mpi"

I am trying to compile LAMMPS using “make mpi” command.
I am getting the following error msg.

Gathering installed package information (may take a little while)
make[1]: Entering directory ‘/home/sadgun/lammps-23Jun2022/src’
make[1]: ‘lmpinstalledpkgs.h’ is up to date.
Gathering git version information
make[1]: Leaving directory ‘/home/sadgun/lammps-23Jun2022/src’
Compiling LAMMPS for machine mpi
make[1]: Entering directory ‘/home/sadgun/lammps-23Jun2022/src/Obj_mpi’
make[1]: Leaving directory ‘/home/sadgun/lammps-23Jun2022/src/Obj_mpi’
make[1]: Entering directory ‘/home/sadgun/lammps-23Jun2022/src/Obj_mpi’
mpicxx -g -O3 -std=c++11 main.o -L. -llammps_mpi -L/usr/lib/python2.7/config-x86_64-linux-gnu -L/usr/lib -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -L/usr/lib/x86_64-linux-gnu/pkgconfig/…/…/…//lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/x86_64-linux-gnu/pkgconfig/…/…/…//lib/x86_64-linux-gnu -lkim-api -L/home/sadgun/anaconda3/lib -lcurl -ldl -o …/lmp_mpi
/usr/bin/ld: ./liblammps_mpi.a(lammps.o): in function LAMMPS_NS::LAMMPS::LAMMPS(int, char**, int)': /home/sadgun/lammps-23Jun2022/src/Obj_mpi/../lammps.cpp:127: undefined reference to LAMMPS_NS::Universe::Universe(LAMMPS_NS::LAMMPS*, int)’
/usr/bin/ld: /home/sadgun/lammps-23Jun2022/src/Obj_mpi/…/lammps.cpp:184: undefined reference to LAMMPS_NS::Universe::Universe(LAMMPS_NS::LAMMPS*, int)' /usr/bin/ld: ./liblammps_mpi.a(library.o): in function lammps_open’:
/home/sadgun/lammps-23Jun2022/src/Obj_mpi/…/library.cpp:186: undefined reference to LAMMPS_NS::LAMMPS::LAMMPS(int, char**, ompi_communicator_t*)' /usr/bin/ld: ./liblammps_mpi.a(library.o): in function lammps_open_no_mpi’:
/home/sadgun/lammps-23Jun2022/src/Obj_mpi/…/library.cpp:186: undefined reference to LAMMPS_NS::LAMMPS::LAMMPS(int, char**, ompi_communicator_t*)' /usr/bin/ld: ./liblammps_mpi.a(library.o): in function lammps_open_fortran’:
/home/sadgun/lammps-23Jun2022/src/Obj_mpi/…/library.cpp:186: undefined reference to `LAMMPS_NS::LAMMPS::LAMMPS(int, char**, ompi_communicator_t*)’
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:94: …/lmp_mpi] Error 1
make[1]: Leaving directory ‘/home/sadgun/lammps-23Jun2022/src/Obj_mpi’
make: *** [Makefile:393: mpi] Error 2

Please kindly suggest a solution to this problem. Thanks in advance.

Please try ‘make clean-all; make mpi’ to do a clean compile. The error is likely due to you making changes to address compilation issues, but not cleaning objects compiled with different settings.

The alternative would be to switch to CMake based compilation, which has more internal checks to avoid inconsistent compilation.

1 Like

I tried with ‘make clean-all’ and then ‘make mpi’.
The previous error is gone. But I am getting a new error as below.

mpicxx -g -O3 -std=c++11 main.o -L. -llammps_mpi -L/usr/lib/python2.7/config-x86_64-linux-gnu -L/usr/lib -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -L/usr/lib/x86_64-linux-gnu/pkgconfig/…/…/…//lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/x86_64-linux-gnu/pkgconfig/…/…/…//lib/x86_64-linux-gnu -lkim-api -L/home/sadgun/anaconda3/lib -lcurl -ldl -o …/lmp_mpi
/usr/bin/ld: /home/sadgun/anaconda3/lib/libcurl.so: undefined reference to `nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation’
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:94: …/lmp_mpi] Error 1
make[1]: Leaving directory ‘/home/sadgun/lammps-23Jun2022/src/Obj_mpi’
make: *** [Makefile:393: mpi] Error 2

kindly could you address this issue?

This is not a LAMMPS issue but a problem of your libcurl installation.

1 Like