I am trying to build the LAMMPS on Ubuntu with this version: lammps/lammps at stable_29Aug2024_update1. The default of C++ version of this branch is set C++11 in CMakeLists.txt. When I compile it with C++11, the build goes smoothly. However, during test runs with the core-shell interatomic potential, an error message is generated: ERROR: Unrecognized pair style ‘born/coul/wolf/cs’ is part of the CORESHELL package, but seems to be missing because of a dependency (src/force.cpp:275). When using C+11, it generates a lot of the warning saying: warning #4041: constexpr if statements are a C++17 feature. So, I assumed that the coreshell package is not enabled successfully.
When building with C++17 by adding the command set(CMAKE_CXX_STANDARD 17) in cmake/CMakeLists.txt, the build goes very little warnings but fails to create the executable with this error message: input.cpp:(.text+0x1a35): more undefined references to `__builtin_is_constant_evaluated’ follow CMakeFiles/lmp.dir/build.make:108: recipe for target ‘lmp’ failed gmake[2]: *** [lmp] Error 1 CMakeFiles/Makefile2:521: recipe for target ‘CMakeFiles/lmp.dir/all’ failed gmake[1]: *** [CMakeFiles/lmp.dir/all] Error 2 Makefile:135: recipe for target ‘all’ failed gmake: *** [all] Error 2
If anyone could provide any guidance on this issue, it would be greatly appreciated.
That is not correct. These are two separate issues. The reason that pair style born/coul/wolf/cs is missing is that its implementation is derived from pair style born/coul/wolf and that is part of the EXTRA-PAIR package that you have not enabled. Because of that, the CORESHELL version is skipped over and therefore you get that error.
The constexpr warnings are probably due to enabling MKL from a very recent Intel compiler installation. If I remember correctly the very latest LLVM-based Intel compilers do not support C++11 at all. You seem to be using MKL with a GCC compiler though (what does it say in the summary after running cmake?).
It doesn’t make much sense to use MKL unless you are also using the Intel compilers. Same goes for the INTEL package.
Any error about missing symbols starting with __builtin indicate a problem with inconsistent compiler choices during compilation and linking.
I suggest you try to compile LAMMPS from a clean build folder with the default settings using GCC and -DFFT=kiss and make sure you add -D PKG_EXTRA-PAIR=on to your cmake command line and forget about anything Intel. If that works, you can then incrementally add -D CMAKE_CXX_STANDARD=17, the INTEL package, the Intel compiler, and the MKL library.
Best each from a new and empty build folder and then report back where you get excessive warnings or run failures. Then we can have a closer look.
[Update:]
For your reference, here is my cmake summary from configuring with GCC and without anything Intel for the same LAMMPS sources. There are only a few bogus warnings about some calls to memcpy() that show up for this: