LIGGGHTS Compilation Issues: limpi.so.12

Submitted by geotech1215 on Mon, 06/05/2023 - 18:48

Hi,

I am attempting to compile LIGGGHTS on Ubuntu 20.04.

My Makefile.user has the following flags and paths set:

USE_MPI = "ON"
USE_CATALYST = "OFF"
USE_VTK = "ON"
AUTOINSTALL_VTK = "ON"
USE_SUPERQUADRICS = "ON"
USE_JPG = "OFF"
USE_FPIC = "ON"
USE_DEBUG = "OFF"
USE_PROFILE = "OFF"
USE_CONVEX = "OFF"
USE_GZIP = "OFF"
USE_XDR = "OFF"
USE_MFEM = "OFF"
BUILD_LIBRARIES = "ALL"
MPICXX_USR=/bin/mpic++
MPI_INC_USR=/usr/lib/x86_64-linux-gnu/openmpi/include
MPI_LIB_USR=/usr/lib/x86_64-linux-gnu/openmpi/lib
VTK_INC_USR=-I/home/kckuei/LIGGGHTS-PUBLIC/lib/vtk/install/include/vtk-8.0
VTK_LIB_USR=-L/home/kckuei/LIGGGHTS-PUBLIC/lib/vtk/install/lib
MAKEFILE_USER_VERSION = "1.4"

I am getting the following compilation error when I run `make auto`:

/usr/bin/ld: warning: libmpi.so.12, needed by /home/kckuei/LIGGGHTS-PUBLIC/lib/vtk/install/lib/libvtkParallelMPI-8.0.so, may conflict with libmpi.so.40
/usr/bin/ld: dump_local_gran_vtk.o: in function `LAMMPS_NS::DumpLocalGranVTK::DumpLocalGranVTK(LAMMPS_NS::LAMMPS*, int, char**)':
dump_local_gran_vtk.cpp:(.text+0xae0): undefined reference to `vtkMPICommunicatorOpaqueComm::vtkMPICommunicatorOpaqueComm(ompi_communicator_t**)'
/usr/bin/ld: dump_custom_vtm.o: in function `LAMMPS_NS::DumpCustomVTM::DumpCustomVTM(LAMMPS_NS::LAMMPS*, int, char**)':
dump_custom_vtm.cpp:(.text+0x21e9): undefined reference to `vtkMPICommunicatorOpaqueComm::vtkMPICommunicatorOpaqueComm(ompi_communicator_t**)'
/usr/bin/ld: dump_mesh_vtm.o: in function `LAMMPS_NS::DumpMeshVTM::DumpMeshVTM(LAMMPS_NS::LAMMPS*, int, char**)':
dump_mesh_vtm.cpp:(.text+0x5b3): undefined reference to `vtkMPICommunicatorOpaqueComm::vtkMPICommunicatorOpaqueComm(ompi_communicator_t**)'
/usr/bin/ld: dump_mesh_vtk.o: in function `LAMMPS_NS::DumpMeshVTK::DumpMeshVTK(LAMMPS_NS::LAMMPS*, int, char**)':
dump_mesh_vtk.cpp:(.text+0x893): undefined reference to `vtkMPICommunicatorOpaqueComm::vtkMPICommunicatorOpaqueComm(ompi_communicator_t**)'
/usr/bin/ld: dump_custom_vtk.o: in function `LAMMPS_NS::DumpCustomVTK::DumpCustomVTK(LAMMPS_NS::LAMMPS*, int, char**)':
dump_custom_vtk.cpp:(.text+0xec0): undefined reference to `vtkMPICommunicatorOpaqueComm::vtkMPICommunicatorOpaqueComm(ompi_communicator_t**)'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:1382: ../lmp_auto] Error 1
make[1]: Leaving directory '/home/kckuei/LIGGGHTS-PUBLIC/src/Obj_auto'
make: *** [Makefile:114: auto] Error 2

I don't appear to have libmpi.so.12 in my MPI path, but I found it in other locations:

/opt/ParaView-5.11/lib/libmpi.so.12
/opt/ParaView-5.11/lib/mpi/libmpi.so.12
/home/kckuei/anaconda3/pkgs/mpich-3.3.2-hc856adb_0/lib/libmpi.so.12
/home/kckuei/anaconda3/envs/backup/lib/libmpi.so.12
/home/kckuei/anaconda3/lib/libmpi.so.12

If I remake the symbolic link to point to libmpi.so.12 in the ParaView folder, and attempt to recompile, I get the following error:

/usr/bin/ld: warning: libmpi.so.40, needed by /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so, may conflict with libmpi.so.12
/usr/bin/ld: image.o: undefined reference to symbol 'ompi_mpi_byte'
/usr/bin/ld: /lib/x86_64-linux-gnu/libmpi.so.40: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:1382: ../lmp_auto] Error 1
make[1]: Leaving directory '/home/kckuei/LIGGGHTS-PUBLIC/src/Obj_auto'
make: *** [Makefile:114: auto] Error 2

It seems that libmpi_cxx.so is linked to libmpi_cxx.so.40.20.1. I don't appear to have a corresponding libmpi_cxx.so to libmpi.so.12 elsewhere on the system.

Any suggestions/advice for resolving this?

Cheers,

geotech1215 | Wed, 06/07/2023 - 07:52

I came to a resolution, experimenting with various docker images. To summarize what I found:

1. Using a docker image for Ubuntu:18.04 works out of the box for LIGGGHTS installation, since it installs Open MPI 2.1.1, which contains the needed libmpi.so.12 and other files.
2. Using a docker image for Ubuntu:20.04 does not work out of box, since it installs Open MPI 4.0.3.

Running 'apt-cache madison openmpi-bin' shows that only version 4.0.3 is available for Ubuntu:20.04, so I had to manually download 2.1.1 from the MPI website (https://www.open-mpi.org/software/ompi/v2.1/) and then install it in the docker container.

I copied the openmpi-2.1.1.tar.gz to the container then installed MPI as follows:

tar -xf openmpi-2.1.1.tar.gz
cd openmpi-2.1.1
./configure --prefix=/usr/local/openmpi-2.1.1
make
make install

Then exported the paths to the bash.bashrc file:

export PATH=/usr/local/openmpi-2.1.1/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/openmpi-2.1.1/lib:$LD_LIBRARY_PATH

Might also need to run the following commands beforehand:

apt-get -y update
apt-get install -y make
apt install build-essential

My Makefile.user configuration was as follows:

USE_MPI="ON"
USE_CATALYST = "OFF"
USE_VTK="ON"
AUTOINSTALL_VTK = "ON"
USE_SUPERQUADRICS = "ON"
USE_JPG = "OFF"
USE_FPIC = "ON"
USE_DEBUG = "OFF"
USE_PROFILE = "OFF"
USE_CONVEX = "OFF"
USE_GZIP = "OFF"
USE_XDR = "OFF"
USE_MFEM = "OFF"
BUILD_LIBRARIES = "ALL"
MPICXX_USR=/usr/local/openmpi-2.1.1/bin/mpic++
MPI_INC_USR=/usr/local/openmpi-2.1.1/include
MPI_LIB_USR=/usr/local/openmpi-2.1.1/lib
VTK_INC_USR=-I/LIGGGHTS-PUBLIC/lib/vtk/install/include/vtk-8.0
VTK_LIB_USR=-L/LIGGGHTS-PUBLIC/lib/vtk/install/lib
MAKEFILE_USER_VERSION = "1.4"

And also exported this path to bash.bashrc:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/LIGGGHTS-PUBLIC/lib/vtk/install/lib