fbuessen / SpinParser

Pseudofermion functional renormalization group solver for (frustrated) quantum magnets in two and three spatial dimensions.
MIT License
24 stars 6 forks source link

cmake find_package(MPI REQUIRED) Error. #4

Closed QG-phy closed 2 years ago

QG-phy commented 2 years ago

Hi, I did all the steps in the installation of your document. but it failed at the step cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../install ../SpinParserSource

Here, i pasted the error message.

-- The C compiler identification is GNU 9.4.0 -- The CXX compiler identification is GNU 9.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.71") found components: regex thread system program_options filesystem timer date_time unit_test_framework -- HDF5: Using hdf5 compiler wrapper to determine C configuration -- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.4") found components: C -- Found OpenMP_C: -fopenmp (found version "4.5") -- Found OpenMP_CXX: -fopenmp (found version "4.5") -- Found OpenMP: TRUE (found version "4.5") CMake Error in /root/soft/SpinParser/build/CMakeFiles/CMakeTmp/CMakeLists.txt: Imported target "MPI::MPI_C" includes non-existent path

"/root/soft/SpinParser/SpinParserSource/'/opt/intel/oneapi/mpi/2021.1.1/include'"

in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:

CMake Error in /root/soft/SpinParser/build/CMakeFiles/CMakeTmp/CMakeLists.txt: Imported target "MPI::MPI_C" includes non-existent path

"/root/soft/SpinParser/SpinParserSource/'/opt/intel/oneapi/mpi/2021.1.1/include'"

in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:

CMake Error at /usr/share/cmake-3.16/Modules/FindMPI.cmake:1194 (try_compile): Failed to generate test project build system. Call Stack (most recent call first): /usr/share/cmake-3.16/Modules/FindMPI.cmake:1245 (_MPI_try_staged_settings) /usr/share/cmake-3.16/Modules/FindMPI.cmake:1505 (_MPI_check_lang_works) CMakeLists.txt:29 (find_package)

-- Configuring incomplete, errors occurred! See also "/root/soft/SpinParser/build/CMakeFiles/CMakeOutput.log". See also "/root/soft/SpinParser/build/CMakeFiles/CMakeError.log".

QG-phy commented 2 years ago

Here is the CMakeError.log:

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output: Change Dir: /root/soft/SpinParser/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_de9a1/fast && /usr/bin/make -f CMakeFiles/cmTC_de9a1.dir/build.make CMakeFiles/cmTC_de9a1.dir/build make[1]: Entering directory '/root/soft/SpinParser/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_de9a1.dir/src.c.o /usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -o CMakeFiles/cmTC_de9a1.dir/src.c.o -c /root/soft/SpinParser/build/CMakeFiles/CMakeTmp/src.c Linking C executable cmTC_de9a1 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_de9a1.dir/link.txt --verbose=1 /usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD CMakeFiles/cmTC_de9a1.dir/src.c.o -o cmTC_de9a1 /usr/bin/ld: CMakeFiles/cmTC_de9a1.dir/src.c.o: in function main': src.c:(.text+0x46): undefined reference topthread_create' /usr/bin/ld: src.c:(.text+0x52): undefined reference to pthread_detach' /usr/bin/ld: src.c:(.text+0x63): undefined reference topthread_join' collect2: error: ld returned 1 exit status make[1]: [CMakeFiles/cmTC_de9a1.dir/build.make:87: cmTC_de9a1] Error 1 make[1]: Leaving directory '/root/soft/SpinParser/build/CMakeFiles/CMakeTmp' make: [Makefile:121: cmTC_de9a1/fast] Error 2

Source file was:

include

void test_func(void data) { return data; }

int main(void) { pthread_t thread; pthread_create(&thread, NULL, test_func, NULL); pthread_detach(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: /root/soft/SpinParser/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_253e1/fast && /usr/bin/make -f CMakeFiles/cmTC_253e1.dir/build.make CMakeFiles/cmTC_253e1.dir/build make[1]: Entering directory '/root/soft/SpinParser/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_253e1.dir/CheckFunctionExists.c.o /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_253e1.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.16/Modules/Chec Linking C executable cmTC_253e1 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_253e1.dir/link.txt --verbose=1 /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_253e1.dir/CheckFunctionExists.c.o -o cmTC_253e1 -lpthreads /usr/bin/ld: cannot find -lpthreads collect2: error: ld returned 1 exit status make[1]: [CMakeFiles/cmTC_253e1.dir/build.make:87: cmTC_253e1] Error 1 make[1]: Leaving directory '/root/soft/SpinParser/build/CMakeFiles/CMakeTmp' make: [Makefile:121: cmTC_253e1/fast] Error

shishirkrpandey commented 2 years ago

Coincidentally, my installation also fails and shows the same error. Somewhere, some modification needed prior to installation?

fbuessen commented 2 years ago

Hi, it looks like CMake is having trouble locating the MPI package. What system are you running on, and which MPI distribution did you install?

You can aid cmake in locating the MPI library by passing definitions like -DMPI_HOME=/path/to/mpi when calling cmake. See the "Variables for locating MPI" section on https://cmake.org/cmake/help/latest/module/FindMPI.html for more detailed information.

To ensure that the compilation works smoothly without MPI, you can also define -DSPINPARSER_DISABLE_MPI=ON when calling cmake to disable the use of MPI.

QG-phy commented 2 years ago

Hi, it looks like CMake is having trouble locating the MPI package. What system are you running on, and which MPI distribution did you install?

You can aid cmake in locating the MPI library by passing definitions like -DMPI_HOME=/path/to/mpi when calling cmake. See the "Variables for locating MPI" section on https://cmake.org/cmake/help/latest/module/FindMPI.html for more detailed information.

To ensure that the compilation works smoothly without MPI, you can also define -DSPINPARSER_DISABLE_MPI=ON when calling cmake to disable the use of MPI.

Thanks for response. "-DMPI_HOME=/path/to/mpi" doesn't help. I realized this is a BUG in cmake. I delete all the "/root/soft/SpinParser/SpinParserSource/" in CMakeCache.txt as the error message said error in "/root/soft/SpinParser/SpinParserSource/'/opt/intel/oneapi/mpi/2021.1.1/include'".

Then, cmake successfully.

QG-phy commented 2 years ago

After cmake. and make . i run make test and there is something wrong with the tests. so i create a new issue about that. thanking you anticipating your response on this issue.

shishirkrpandey commented 2 years ago

Hi, it looks like CMake is having trouble locating the MPI package. What system are you running on, and which MPI distribution did you install? You can aid cmake in locating the MPI library by passing definitions like -DMPI_HOME=/path/to/mpi when calling cmake. See the "Variables for locating MPI" section on https://cmake.org/cmake/help/latest/module/FindMPI.html for more detailed information. To ensure that the compilation works smoothly without MPI, you can also define -DSPINPARSER_DISABLE_MPI=ON when calling cmake to disable the use of MPI.

Thanks for response. "-DMPI_HOME=/path/to/mpi" doesn't help. I realized this is a BUG in cmake. I delete all the "/root/soft/SpinParser/SpinParserSource/" in CMakeCache.txt as the error message said error in "/root/soft/SpinParser/SpinParserSource/'/opt/intel/oneapi/mpi/2021.1.1/include'".

Then, cmake successfully.

Thank you both for your responses. Indeed @QG-phy suggestion made it compiled successfully. Again, the same. Some of the tests fail in my case as well as been mentioned in the new issue.

fbuessen commented 2 years ago

The cmake bug is known to manifest in conjunction with Intel MPI 2021.1 and reported in https://gitlab.kitware.com/cmake/cmake/-/issues/21634 . It has been fixed in cmake 3.19.3.