Problem at building LAMMPS through CMake

I am trying to build LAMMPS through CMake, but encountered error as below:

~/Documents/lammps-29Sep2021/build$ cmake -C …/cmake/presets/basic.cmake
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.

loading initial cache file …/cmake/presets/basic.cmake
CMake Error at CMakeLists.txt:62 (include) :
include could not find requested file:
LAMMPSUtils

Cake Error at CMakeLtsts.txt:64 (get lammps version) :
Unknown Cake command “get lamps version”.

–Configuring incomplete, errors occurred!
See also
“/home/mehdi/Documents/lammps-29Sep2021/build/CMakeFiles/CMakeOutput.log”

That is because you are not using the correct command line. Please have another look at the instructions in the LAMMPS manual and/or the CMake documentation.

Thanks. yes checked I missed another …/cmake at the end.

I encountered the following issue while compiling LAMMPS using the CMake method provided on the official website. I’m unsure how to resolve it. Seeking assistance, thank you.
In file included from /home/tongmj/software/lammps20240228/lammps-7Feb2024/src/pointers.h:33:0,
from …/lammps-7Feb2024/src/angle.h:17,
from …/lammps-7Feb2024/src/angle.cpp:14:
…/lammps-7Feb2024/src/fmt/format.h:1082:29: error: ‘std::runtime_error::runtime_error’ names constructor
…/lammps-7Feb2024/src/fmt/format.h: In function ‘OutputIt fmt::v10_lmp::detail::write_bytes(OutputIt, fmt::v10_lmp::string_view, const fmt::v10_lmp::format_specs&)’:
…/lammps-7Feb2024/src/fmt/format.h:1824:39: error: no default argument for ‘Char’
…/lammps-7Feb2024/src/fmt/format.h:1824:39: error: no default argument for ‘OutputIt’
…/lammps-7Feb2024/src/fmt/format.h: At global scope:
…/lammps-7Feb2024/src/fmt/format.h:2488:25: error: bit-field ‘format’ with non-integral type
…/lammps-7Feb2024/src/fmt/format.h: In function ‘fmt::v10_lmp::detail::float_specs fmt::v10_lmp::detail::parse_float_type_spec(const fmt::v10_lmp::format_specs&)’:
…/lammps-7Feb2024/src/fmt/format.h:2504:12: error: ‘struct fmt::v10_lmp::detail::float_specs’ has no member named ‘format’
…/lammps-7Feb2024/src/fmt/format.h:2510:12: error: ‘struct fmt::v10_lmp::detail::float_specs’ has no member named ‘format’
…/lammps-7Feb2024/src/fmt/format.h:2516:12: error: ‘struct fmt::v10_lmp::detail::float_specs’ has no member named ‘format’
…/lammps-7Feb2024/src/fmt/format.h:2523:12: error: ‘struct fmt::v10_lmp::detail::float_specs’ has no member named ‘format’
…/lammps-7Feb2024/src/fmt/format.h:2530:12: error: ‘struct fmt::v10_lmp::detail::float_specs’ has no member named ‘format’
…/lammps-7Feb2024/src/fmt/format.h: In lambda function:
…/lammps-7Feb2024/src/fmt/format.h:2680:16: error: ‘const struct fmt::v10_lmp::detail::float_specs’ has no member named ‘format’
…/lammps-7Feb2024/src/fmt/format.h:2681:16: error: ‘const struct fmt::v10_lmp::detail::float_specs’ has no member named ‘format’
…/lammps-7Feb2024/src/fmt/format.h: In function ‘OutputIt fmt::v10_lmp::detail::do_write_float(OutputIt, const DecimalFP&, const fmt::v10_lmp::format_specs&, fmt::v10_lmp::detail::float_specs, fmt::v10_lmp::detail::locale_ref)’:
…/lammps-7Feb2024/src/fmt/format.h:2724:36: error: ‘struct fmt::v10_lmp::detail::float_specs’ has no member named ‘format’
…/lammps-7Feb2024/src/fmt/format.h: In function ‘void fmt::v10_lmp::detail::adjust_precision(int&, int)’:
…/lammps-7Feb2024/src/fmt/format.h:2839:5: error: no matching function for call to ‘fmt::v10_lmp::format_error::format_error(const char [18])’
…/lammps-7Feb2024/src/fmt/format.h:2839:5: note: candidate is:
…/lammps-7Feb2024/src/fmt/format.h:1080:36: note: fmt::v10_lmp::format_error::format_error(const fmt::v10_lmp::format_error&)
…/lammps-7Feb2024/src/fmt/format.h:1080:36: note: no known conversion for argument 1 from ‘const char [18]’ to ‘const fmt::v10_lmp::format_error&’
…/lammps-7Feb2024/src/fmt/format.h: In function ‘int fmt::v10_lmp::detail::format_float(Float, int, fmt::v10_lmp::detail::float_specs, fmt::v10_lmp::detail::buffer&)’:
…/lammps-7Feb2024/src/fmt/format.h:3347:28: error: ‘struct fmt::v10_lmp::detail::float_specs’ has no member named ‘format’
…/lammps-7Feb2024/src/fmt/format.h: In function ‘OutputIt fmt::v10_lmp::detail::write_float(OutputIt, T, fmt::v10_lmp::format_specs, fmt::v10_lmp::detail::locale_ref)’:
…/lammps-7Feb2024/src/fmt/format.h:3673:14: error: ‘struct fmt::v10_lmp::detail::float_specs’ has no member named ‘format’
…/lammps-7Feb2024/src/fmt/format.h:3682:14: error: ‘struct fmt::v10_lmp::detail::float_specs’ has no member named ‘format’
…/lammps-7Feb2024/src/fmt/format.h:3687:21: error: ‘struct fmt::v10_lmp::detail::float_specs’ has no member named ‘format’
In file included from …/lammps-7Feb2024/src/angle.cpp:18:0:
…/lammps-7Feb2024/src/error.h: At global scope:
…/lammps-7Feb2024/src/error.h:26:3: error: expected unqualified-id before ‘[’ token
…/lammps-7Feb2024/src/error.h:27:3: error: expected unqualified-id before ‘[’ token
…/lammps-7Feb2024/src/error.h:30:3: error: expected unqualified-id before ‘[’ token
…/lammps-7Feb2024/src/error.h:37:3: error: expected unqualified-id before ‘[’ token
…/lammps-7Feb2024/src/error.h:57:3: error: expected unqualified-id before ‘[’ token
…/lammps-7Feb2024/src/error.h:75:3: error: expected unqualified-id before ‘[’ token
…/lammps-7Feb2024/src/error.h:76:3: error: expected unqualified-id before ‘[’ token
…/lammps-7Feb2024/src/angle.cpp:58:15: error: declaration of ‘virtual LAMMPS_NS::Angle::~Angle() noexcept (false)’ has a different exception specifier
In file included from …/lammps-7Feb2024/src/angle.cpp:14:0:
…/lammps-7Feb2024/src/angle.h:50:3: error: from previous declaration ‘virtual LAMMPS_NS::Angle::~Angle() noexcept (true)’
In file included from …/lammps-7Feb2024/src/angle.cpp:18:0:
…/lammps-7Feb2024/src/error.h: In instantiation of ‘void LAMMPS_NS::Error::all(const string&, int, const string&, Args&& …) [with Args = {}; std::string = std::basic_string]’:
…/lammps-7Feb2024/src/angle.cpp:73:84: required from here
…/lammps-7Feb2024/src/error.h:34:5: error: ‘_all’ was not declared in this scope
…/lammps-7Feb2024/src/error.h: In instantiation of ‘void LAMMPS_NS::Error::all(const string&, int, const string&, Args&& …) [with Args = {char*&, char*&}; std::string = std::basic_string]’:
…/lammps-7Feb2024/src/angle.cpp:87:89: required from here
…/lammps-7Feb2024/src/error.h:34:5: error: ‘_all’ was not declared in this scope
make[2]: *** [CMakeFiles/lammps.dir/build.make:63: CMakeFiles/lammps.dir/…/lammps-7Feb2024/src/angle.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1029: CMakeFiles/lammps.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

There is no enough information here to reproduce the error you are seeing and without the ability to reproduce it, there is no chance to give meaningful assistance.

Please provide:

  • the platform information (CPU, OS version etc.)
  • the information of which compiler and which version was used
  • the exact command line and output(!) from your CMake command

Dear Professor Kohlmeyer
I apologize for not providing detailed information.
1.(cmake …/cmake)
– Appending /opt/intel/oneapi/vpl/2023.0.0/lib:/opt/intel/oneapi/tbb/2021.8.0/env/…/lib/intel64/gcc4.8:/opt/intel/oneapi/mpi/2021.10.0//libfabric/lib:/opt/intel/oneapi/mpi/2021.10.0//lib/release:/opt/intel/oneapi/mpi/2021.10.0//lib:/opt/intel/oneapi/mkl/2023.0.0/lib/intel64:/opt/intel/oneapi/ipp/2021.7.0/lib/intel64:/opt/intel/oneapi/ippcp/2021.6.3/lib/intel64:/opt/intel/oneapi/ipp/2021.7.0/lib/intel64:/opt/intel/oneapi/dnnl/2023.0.0/cpu_dpcpp_gpu_dpcpp/lib:/opt/intel/oneapi/dal/2023.0.0/lib/intel64:/opt/intel/oneapi/compiler/2023.0.0/linux/compiler/lib/intel64_lin:/opt/intel/oneapi/compiler/2023.0.0/linux/lib:/opt/intel/oneapi/clck/2021.7.2/lib/intel64:/opt/intel/oneapi/ccl/2021.8.0/lib/cpu_gpu_dpcpp:/home/lxl/intel/compilers_and_libraries_2020.0.139/linux/mpi/intel64/libfabric/lib:/home/lxl/intel/compilers_and_libraries_2020.0.139/linux/ipp/lib/intel64:/home/lxl/intel/compilers_and_libraries_2020.0.139/linux/compiler/lib/intel64_lin:/home/lxl/intel/compilers_and_libraries_2020.0.139/linux/mkl/lib/intel64_lin:/home/lxl/intel/compilers_and_libraries_2020.0.139/linux/tbb/lib/intel64/gcc4.8:/home/lxl/intel/compilers_and_libraries_2020.0.139/linux/tbb/lib/intel64/gcc4.8:/home/lxl/intel/compilers_and_libraries_2020.0.139/linux/daal/lib/intel64_lin:/home/lxl/intel/compilers_and_libraries_2020.0.139/linux/daal/…/tbb/lib/intel64_lin/gcc4.4 to CMAKE_LIBRARY_PATH: /opt/intel/oneapi/vpl/2023.0.0/lib:/opt/intel/oneapi/tbb/2021.8.0/env/…/lib/intel64/gcc4.8:/opt/intel/oneapi/mpi/2021.10.0//libfabric/lib:/opt/intel/oneapi/mpi/2021.10.0//lib/release:/opt/intel/oneapi/mpi/2021.10.0//lib:/opt/intel/oneapi/mkl/2023.0.0/lib/intel64:/opt/intel/oneapi/ipp/2021.7.0/lib/intel64:/opt/intel/oneapi/ippcp/2021.6.3/lib/intel64:/opt/intel/oneapi/ipp/2021.7.0/lib/intel64:/opt/intel/oneapi/dnnl/2023.0.0/cpu_dpcpp_gpu_dpcpp/lib:/opt/intel/oneapi/dal/2023.0.0/lib/intel64:/opt/intel/oneapi/compiler/2023.0.0/linux/compiler/lib/intel64_lin:/opt/intel/oneapi/compiler/2023.0.0/linux/lib:/opt/intel/oneapi/clck/2021.7.2/lib/intel64:/opt/intel/oneapi/ccl/2021.8.0/lib/cpu_gpu_dpcpp:/home/lxl/intel/compilers_and_libraries_2020.0.139/linux/mpi/intel64/libfabric/lib:/home/lxl/intel/compilers_and_libraries_2020.0.139/linux/ipp/lib/intel64:/home/lxl/intel/compilers_and_libraries_2020.0.139/linux/compiler/lib/intel64_lin:/home/lxl/intel/compilers_and_libraries_2020.0.139/linux/mkl/lib/intel64_lin:/home/lxl/intel/compilers_and_libraries_2020.0.139/linux/tbb/lib/intel64/gcc4.8:/home/lxl/intel/compilers_and_libraries_2020.0.139/linux/tbb/lib/intel64/gcc4.8:/home/lxl/intel/compilers_and_libraries_2020.0.139/linux/daal/lib/intel64_lin:/home/lxl/intel/compilers_and_libraries_2020.0.139/linux/daal/…/tbb/lib/intel64_lin/gcc4.4
– <<< Build configuration >>>
LAMMPS Version: 20240207
Operating System: Linux Ubuntu" 20.04
CMake Version: 3.16.3
Build type: RelWithDebInfo
Install path: …/.local
Generator: Unix Makefiles using /usr/bin/make
– Enabled packages:
– <<< Compilers and Flags: >>>
– C++ Compiler: /usr/bin/c++
Type: GNU
Version: 4.7.4
C++ Flags: -O2 -g -DNDEBUG
Defines: LAMMPS_SMALLBIG;LAMMPS_MEMALIGN=64;LAMMPS_OMP_COMPAT=3;LAMMPS_GZIP;LAMMPS_FFMPEG
– <<< Linker flags: >>>
– Executable name: lmp
– Static library flags:
– <<< MPI flags >>>
– MPI_defines: MPICH_SKIP_MPICXX;OMPI_SKIP_MPICXX;_MPICC_H
– MPI includes: /opt/intel/oneapi/mpi/2021.10.0/include
– MPI libraries: /opt/intel/oneapi/mpi/2021.10.0/lib/libmpicxx.so;/opt/intel/oneapi/mpi/2021.10.0/lib/release/libmpi.so;/usr/lib/x86_64-linux-gnu/librt.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libdl.so;
– Configuring done
– Generating done
– Build files have been written to: …/lammps-7Feb2024/build
2.the commmand i use is (cmake --build .)
3.the whole output is
[ 0%] Generating includes/lammps/citeme.h
[ 0%] Built target citeme.h
[ 0%] Generating includes/lammps/neigh_list.h
[ 0%] Built target neigh_list.h
[ 0%] Generating includes/lammps/universe.h
[ 0%] Built target universe.h
[ 0%] Generating includes/lammps/kspace.h
[ 0%] Built target kspace.h
[ 0%] Generating includes/lammps/neighbor.h
[ 0%] Built target neighbor.h
[ 0%] Generating includes/lammps/memory.h
[ 0%] Built target memory.h
[ 1%] Generating includes/lammps/modify.h
[ 1%] Built target modify.h
[ 1%] Generating includes/lammps/lattice.h
[ 1%] Built target lattice.h
[ 1%] Generating includes/lammps/fmt/format.h
[ 1%] Built target fmt_format.h
[ 1%] Generating includes/lammps/lmppython.h
[ 1%] Built target lmppython.h
[ 1%] Generating includes/lammps/output.h
[ 1%] Built target output.h
[ 1%] Generating includes/lammps/domain.h
[ 1%] Built target domain.h
[ 1%] Generating includes/lammps/comm.h
[ 1%] Built target comm.h
[ 2%] Generating includes/lammps/lammps.h
[ 2%] Built target lammps.h
[ 3%] Generating includes/lammps/force.h
[ 3%] Built target force.h
[ 3%] Generating includes/lammps/compute.h
[ 3%] Built target compute.h
[ 3%] Generating includes/lammps/bond.h
[ 3%] Built target bond.h
[ 3%] Generating includes/lammps/exceptions.h
[ 3%] Built target exceptions.h
[ 3%] Generating includes/lammps/angle.h
[ 3%] Built target angle.h
[ 3%] Generating includes/lammps/improper.h
[ 3%] Built target improper.h
[ 3%] Generating includes/lammps/library.h
[ 3%] Built target library.h
[ 3%] Generating includes/lammps/lmptype.h
[ 3%] Built target lmptype.h
[ 3%] Generating includes/lammps/dihedral.h
[ 3%] Built target dihedral.h
[ 3%] Generating includes/lammps/atom.h
[ 3%] Built target atom.h
[ 4%] Generating includes/lammps/input.h
[ 4%] Built target input.h
[ 4%] Generating includes/lammps/update.h
[ 4%] Built target update.h
– Git Directory: …/lammps-7Feb2024/.git
– Generating lmpgitversion.h…
[ 4%] Built target gitversion
[ 5%] Generating includes/lammps/error.h
[ 5%] Built target error.h
[ 5%] Generating includes/lammps/group.h
[ 5%] Built target group.h
[ 6%] Generating includes/lammps/variable.h
[ 6%] Built target variable.h
[ 6%] Generating includes/lammps/fmt/core.h
[ 6%] Built target fmt_core.h
[ 6%] Generating includes/lammps/region.h
[ 6%] Built target region.h
[ 6%] Generating includes/lammps/utils.h
[ 6%] Built target utils.h
[ 7%] Generating includes/lammps/pair.h
[ 7%] Built target pair.h
[ 7%] Generating includes/lammps/pointers.h
[ 7%] Built target pointers.h
[ 8%] Generating includes/lammps/timer.h
[ 8%] Built target timer.h
[ 8%] Generating includes/lammps/info.h
[ 8%] Built target info.h
[ 8%] Generating includes/lammps/platform.h
[ 8%] Built target platform.h
[ 9%] Generating includes/lammps/command.h
[ 9%] Built target command.h
[ 9%] Generating includes/lammps/fix.h
[ 9%] Built target fix.h
[ 9%] Building CXX object CMakeFiles/lammps.dir/…/lammps-7Feb2024/src/angle.cpp.o
the rest of the output is the content I replied to earlier

This is a very old C++ compiler and not suitable for compiling LAMMPS which requires full C++11 compatibility.

It is strange to see this version used, since your OS is Ubuntu 20.04 which ships with GNU 9.4.0 which is fully C++11 compliant (and more).

Bottom line. The problem is that you have a messed up Linux installation. This is not a problem of LAMMPS.

Dear Professor Kohlmeyer
After following your advice, my QUIP package has been successfully installed. However, when running the in.gap file, I encountered the error code ‘SYSTEM ABORT: IPModel_GAP_Initialise_str: must be compiled with HAVE_GAP.’ What should I do next to resolve this issue? Thank you for your guidance."

The error is self-explanatory. You didn’t follow my instructions about how to compile/install this and that is why your QUIP library is misconfigured.