Hello,
I have tried to compile a LAMMPS with QUIP but facing an issue regarding linking.
The version of LAMMPS is 23-Jun-2022.
I use cmake and QUIP is separated compiled aforehand, and the location of the library file of QUIP (libquip.a) is included in the cmake file (basic_w_quip.cmake) to build LAMMPS.
My linux server use modules and modules I am using are below
autotools, ohpc, libfabric, openmpi4, scalapack, prun, ucx, gnu9, openblas, cmake.
Below is the error message I encountered.
[ 97%] Building CXX object CMakeFiles/lammps.dir/home/yxj200002/_LAMMPS/lammps-23Jun2022_cmake/src/MANYBODY/pair_tersoff_zbl.cpp.o
[ 97%] Building CXX object CMakeFiles/lammps.dir/home/yxj200002/_LAMMPS/lammps-23Jun2022_cmake/src/MANYBODY/pair_threebody_table.cpp.o
[ 97%] Building CXX object CMakeFiles/lammps.dir/home/yxj200002/_LAMMPS/lammps-23Jun2022_cmake/src/MANYBODY/pair_vashishta.cpp.o
[ 97%] Building CXX object CMakeFiles/lammps.dir/home/yxj200002/_LAMMPS/lammps-23Jun2022_cmake/src/MANYBODY/pair_vashishta_table.cpp.o
[ 97%] Building CXX object CMakeFiles/lammps.dir/home/yxj200002/_LAMMPS/lammps-23Jun2022_cmake/src/ML-QUIP/pair_quip.cpp.o
[ 98%] Linking CXX shared library liblammps.so
[ 98%] Built target lammps
Scanning dependencies of target lmp
[ 98%] Building CXX object CMakeFiles/lmp.dir/home/yxj200002/_LAMMPS/lammps-23Jun2022_cmake/src/main.cpp.o
[100%] Linking CXX executable lmp
liblammps.so.0: undefined reference to `mpi_cart_shift_'
liblammps.so.0: undefined reference to `mpi_allgather_'
liblammps.so.0: undefined reference to `mpi_sendrecv_'
liblammps.so.0: undefined reference to `mpi_initialized_'
liblammps.so.0: undefined reference to `mpi_allgatherv_'
liblammps.so.0: undefined reference to `mpi_gatherv_'
liblammps.so.0: undefined reference to `mpi_comm_set_errhandler_'
liblammps.so.0: undefined reference to `mpi_comm_size_'
liblammps.so.0: undefined reference to `mpi_send_'
liblammps.so.0: undefined reference to `mpi_barrier_'
liblammps.so.0: undefined reference to `mpi_scatter_'
liblammps.so.0: undefined reference to `mpi_allreduce_'
liblammps.so.0: undefined reference to `mpi_wtime_'
liblammps.so.0: undefined reference to `mpi_get_count_'
liblammps.so.0: undefined reference to `mpi_comm_free_'
liblammps.so.0: undefined reference to `mpi_comm_split_'
liblammps.so.0: undefined reference to `mpi_cart_coords_'
liblammps.so.0: undefined reference to `mpi_abort_'
liblammps.so.0: undefined reference to `mpi_error_string_'
liblammps.so.0: undefined reference to `mpi_cart_create_'
liblammps.so.0: undefined reference to `mpi_comm_rank_'
liblammps.so.0: undefined reference to `mpi_recv_'
liblammps.so.0: undefined reference to `mpi_gather_'
liblammps.so.0: undefined reference to `mpi_bcast_'
liblammps.so.0: undefined reference to `mpi_get_processor_name_'
liblammps.so.0: undefined reference to `mpi_init_'
liblammps.so.0: undefined reference to `mpi_finalize_'
liblammps.so.0: undefined reference to `mpi_scatterv_'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/lmp.dir/build.make:89: lmp] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:669: CMakeFiles/lmp.dir/all] Error 2
gmake: *** [Makefile:130: all] Error 2
[[email protected] build_quip]$ module
Below is the cmake file I customized for LAMMPS.
# basic_w_quip.cmake
# NECESSARY OPTIONS FOR LAMMPS-python MODULES
set(BUILD_SHARED_LIBS "on" CACHE STRING "" FORCE)
set(LAMMPS_EXCEPTIONS "on" CACHE STRING "" FORCE)
# BUILD_MPI; default="yes"
set(BUILD_MPI "yes" CACHE STRING "" FORCE)
# LAMMPS_MACHINE; this string will be added at the rear tag of the executable.
set(LAMMPS_MACHINE "" CACHE STRING "" FORCE)
# DEFINE LAMMPS PACKAGES WHICH ARE INCLUDED.
# 'set' command creates a variable with a given value.
# set(<variable> <value> ... )
#set(ALL_PACKAGES KSPACE MANYBODY MOLECULE RIGID MEAM PHONON QEQ PYTHON ML-QUIP)
set(ALL_PACKAGES KSPACE MANYBODY ML-QUIP)
# Alternative way to include a LAMMPS package
#set(PKG_PYTHON "yes" CACHE STRING "" FORCE)
#
foreach(PKG ${ALL_PACKAGES})
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
endforeach()
# ML-QUIP
set(QUIP_LIBRARY "/home/yxj200002/_QUIP/0.9.12/build/linux_x86_64_gfortran_openmpi/libquip.a" CACHE STRING "" FORCE)
Below is CMakeCache.txt.
CMakeCache.txt (37.5 KB)
I guess the cause of error might be trivial but because of my lack of experience, I cannot figure out how I can solve this issue and where I can start to look.
Could anyone who can help me with this issue?
Thank you.