During the cmake
, which I have as:
cmake -D CMAKE_INSTALL_PREFIX=/path/to/lammps-23Jun2022 -D ENABLE_TESTING=yes -D CMAKE_CXX_COMPILER=g++ -D MPI_CXX_COMPILER=mpicxx -D BUILD_MPI=yes -D BUILD_OMP=yes -D PKG_VTK=yes -D PKG_GRANULAR=on -D PKG_EXTRA-FIX=on -D PKG_FIX=on -D CMAKE_BUILD_TYPE=Release -D CMAKE_CXX_FLAGS_RELEASE="-Ofast -DNDEBUG" -D PKG_USER-OMP=yes -D PKG_MOLECULE=yes ../cmake
-- Found Python: /usr/local/bin/python3.7 (found version "3.7.3") found components: Interpreter
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Looking for a Fortran compiler
-- Looking for a Fortran compiler - /usr/bin/f95
-- Skipping Tests for the LAMMPS Fortran Module: cannot identify Fortran compiler
-- Skipping Tests for the LAMMPS Python Module: must enable BUILD_SHARED_LIBS
-- Found Python: /usr/local/bin/python3.7 (found suitable version "3.7.3", minimum required is "3.5") found components: Interpreter
-- Could NOT find YAML (missing: YAML_LIBRARY YAML_INCLUDE_DIR)
-- Downloading https://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz
It ends with:
[ 80%] Building CXX object CMakeFiles/lammps.dir/path/to/lammps-23Jun2022/src/VTK/dump_vtk.cpp.o
[ 80%] Linking CXX static library liblammps.a
[ 80%] Built target lammps
make: *** [all] Error 2
cat ./CMakeFiles/CMakeError.log
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /path/to/lammps-23Jun2022/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_46140/fast && /usr/bin/gmake -f CMakeFiles/cmTC_46140.dir/build.make CMakeFiles/cmTC_46140.dir/build
gmake[1]: Entering directory `/path/to/lammps-23Jun2022/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_46140.dir/src.c.o
/cm/local/apps/gcc/7.2.0/bin/gcc -DCMAKE_HAVE_LIBC_PTHREAD -fPIE -o CMakeFiles/cmTC_46140.dir/src.c.o -c /path/to/lammps-23Jun2022/build/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_46140
/path/to/cmake-3.21.2/cmake-3.21.2-linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/cmTC_46140.dir/link.txt --verbose=1
/cm/local/apps/gcc/7.2.0/bin/gcc CMakeFiles/cmTC_46140.dir/src.c.o -o cmTC_46140
CMakeFiles/cmTC_46140.dir/src.c.o: In function `main':
src.c:(.text+0x2f): undefined reference to `pthread_create'
src.c:(.text+0x3b): undefined reference to `pthread_detach'
src.c:(.text+0x47): undefined reference to `pthread_cancel'
src.c:(.text+0x58): undefined reference to `pthread_join'
src.c:(.text+0x6c): undefined reference to `pthread_atfork'
collect2: error: ld returned 1 exit status
gmake[1]: *** [cmTC_46140] Error 1
gmake[1]: Leaving directory `/path/to/lammps-23Jun2022/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTC_46140/fast] Error 2
Source file was:
#include <pthread.h>
static void* test_func(void* data)
{
return data;
}
int main(void)
{
pthread_t thread;
pthread_create(&thread, NULL, test_func, NULL);
pthread_detach(thread);
pthread_cancel(thread);
pthread_join(thread, NULL);
pthread_atfork(NULL, NULL, NULL);
pthread_exit(NULL);
return 0;
}
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /path/to/lammps-23Jun2022/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_3a19c/fast && /usr/bin/gmake -f CMakeFiles/cmTC_3a19c.dir/build.make CMakeFiles/cmTC_3a19c.dir/build
gmake[1]: Entering directory `/path/to/lammps-23Jun2022/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_3a19c.dir/CheckFunctionExists.c.o
/cm/local/apps/gcc/7.2.0/bin/gcc -DCHECK_FUNCTION_EXISTS=pthread_create -fPIE -o CMakeFiles/cmTC_3a19c.dir/CheckFunctionExists.c.o -c /path/to/cmake-3.21.2/cmake-3.21.2-linux-x86_64/share/cmake-3.21/Modules/CheckFunctionExists.c
Linking C executable cmTC_3a19c
/path/to/cmake-3.21.2/cmake-3.21.2-linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3a19c.dir/link.txt --verbose=1
/cm/local/apps/gcc/7.2.0/bin/gcc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_3a19c.dir/CheckFunctionExists.c.o -o cmTC_3a19c -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
gmake[1]: *** [cmTC_3a19c] Error 1
gmake[1]: Leaving directory `/path/to/lammps-23Jun2022/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTC_3a19c/fast] Error 2
Modules & versions loaded:
openmpi/gcc/64/4.0.0
openblas/0.3.3
ffmpeg/4.2.1
cmake/3.21.2
gcc/7.2.0
RHEL 7. Other CMake errors::
[ 6%] Building C object _deps/libyaml-build/CMakeFiles/yaml.dir/src/dumper.c.o
/path/to/lammps-23Jun2022/build/_deps/libyaml-src/src/api.c: In function ‘yaml_get_version_string’:
/path/to/lammps-23Jun2022/build/_deps/libyaml-src/src/api.c:11:12: error: ‘YAML_VERSION_STRING’ undeclared (first use in this function); did you mean ‘YAML_PARSE_END_STATE’?
return YAML_VERSION_STRING;
^~~~~~~~~~~~~~~~~~~
YAML_PARSE_END_STATE
/path/to/lammps-23Jun2022/build/_deps/libyaml-src/src/api.c:11:12: note: each undeclared identifier is reported only once for each function it appears in
/path/to/lammps-23Jun2022/build/_deps/libyaml-src/src/api.c: In function ‘yaml_get_version’:
/path/to/lammps-23Jun2022/build/_deps/libyaml-src/src/api.c:21:14: error: ‘YAML_VERSION_MAJOR’ undeclared (first use in this function); did you mean ‘YAML_PARSER_ERROR’?
*major = YAML_VERSION_MAJOR;
^~~~~~~~~~~~~~~~~~
YAML_PARSER_ERROR
/path/to/lammps-23Jun2022/build/_deps/libyaml-src/src/api.c:22:14: error: ‘YAML_VERSION_MINOR’ undeclared (first use in this function); did you mean ‘YAML_VERSION_MAJOR’?
*minor = YAML_VERSION_MINOR;
^~~~~~~~~~~~~~~~~~
YAML_VERSION_MAJOR
/path/to/lammps-23Jun2022/build/_deps/libyaml-src/src/api.c:23:14: error: ‘YAML_VERSION_PATCH’ undeclared (first use in this function); did you mean ‘YAML_VERSION_MAJOR’?
*patch = YAML_VERSION_PATCH;
^~~~~~~~~~~~~~~~~~
YAML_VERSION_MAJOR
make[2]: *** [_deps/libyaml-build/CMakeFiles/yaml.dir/src/api.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 6%] Building CXX object CMakeFiles/lammps.dir/moto/home/rk3199/lammps-23Jun2022/src/angle.cpp.o
make[1]: *** [_deps/libyaml-build/CMakeFiles/yaml.dir/all] Error 2
-- Found Python: /usr/local/bin/python3.7 (found version "3.7.3") found components: Interpreter
-- Could NOT find ClangFormat (missing: ClangFormat_EXECUTABLE) (Required is at least version "8.0")
-- Could NOT find ClangFormat (missing: ClangFormat_EXECUTABLE) (Required is at least version "8.0")
-- The following tools and libraries have been found and configured:
And why does it end with:
CMake Warning:
Manually-specified variables were not used by the project:
PKG_FIX
PKG_USER-OMP
What am I doing wrong?