[lammps-users] compiling lamps on Mac OS 10.15

All,

Sorry for the basic question, but I’m at the South Pole and troubleshooting is difficult.

I’m trying to compile LAMMPS on mac os. I was having difficulties with clang, so I compiled GCC 10.2 and and openmpi 4.1 with GCC 10.2. I compile using make-mpi and it succesfully creates lmp_mpi, however when I try to run it I get an error:

dyld: Symbol not found: __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm

Referenced from: /Users/tjleps/Documents/lammps/src/lmp_mpi

Expected in: /usr/lib/libstdc++.6.dylib

in /Users/tjleps/Documents/lammps/src/lmp_mpi

libstdc++.6.dylib is the library from clang, not from GCC 10.2. I’m fairly certain I compiled openmpi with gcc not clang, so I’m not sure why it’s linking to the clang library.

Any advice is very much appreciated, it’s pretty hard to troubleshoot down here due to poor internet.

Thanks,

Thomas Leps

It is difficult to debug this from remote as well. You didn’t state which specific version of LAMMPS you are using.
My first suspicion would be that there is an issue with your GCC installation.
This could be tested for by compiling a serial version and testing that to see if you get the same kind of error or not.
The second potential issue would be an issue with your MPI library installation.
That could be tested for by compiling a simple MPI application (e.g. the one attached) and running it (mpicc -O pi_mpi.c; ./a.out 1000)
We do compile and test run LAMMPS on a macOS box regularly and as of a couple months ago, every time when a pull request is merged via GitHub actions (https://github.com/lammps/lammps/actions/workflows/unittest-macos.yml). this uses CMake and not the traditional build process to compile and test LAMMPS, though, since compiling and running the unit tests is only supported by the CMake build procedure.

Axel.

pi_mpi.c (2.25 KB)

Axel,

I’m using an older version of lammps (2019) because I built a custom atom style and fix that is not compatible with newer versions, however I have the same problem with a late 2020 version I downloaded before I got to the pole. I’ll try recompiling GCC and test your diagnostic advice.

I’ll let you know if there was any change when the satellites are up again tomorrow.

Thanks,
Thomas

Axel,

I compiled and ran the Pi estimator simple MPI program and it worked as expected. The serial version of lammps however failed in the same way as the mpi version.

I’ll attempt recompiling GCC later today.

Thanks,
Thomas

What were the issues that prevented you from using clang?
To tell OpenMPI to use clang instead of GCC you just need to set the environment variables OMPI_CC=clang and OMPI_CXX=clang++.

I’ve been using clang to compile LAMMPS on macOS without much of a problem (at least with the conventional build) with OpenMPI.
For CMake one needs to explicitly request “clang” and “clang++” instead of “cc” and “c++” which is done when using the “clang.cmake” preset (in newer versions of LAMMPS) otherwise CMake gets confused and picks up incorrect paths to the compilers that result in messed up include file reading.

axel.

Axel,

I recompiled GCC, still getting the same linking error. So I went back to making clank work. It’s now compilling but I’m getting a g_ewald could not be calculated error from a non-convergent newton-raphson solver. I’m running a simulation I’ve previously run on a centos machine compiled with intel and gnu compilers and openmpi, though I used fftw previously rather than KISS FFT.

Thanks for any help you can provide,
Thomas