SCOREC / core

parallel finite element unstructured meshes
Other
179 stars 63 forks source link

compiling with `fatal error: mpi.h: No such file or directory` #401

Closed Jing-Lee-tj closed 8 months ago

Jing-Lee-tj commented 8 months ago

Hi,I'm trying to compile core with relatively compilers, and get errors due to fatal error: mpi.h: No such file or directory My compilers:

root@DESKTOP-BSTM044:/opt/core/build# gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

root@DESKTOP-BSTM044:/opt/core/build# apt install mpich
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
mpich is already the newest version (4.0-3).
0 upgraded, 0 newly installed, 0 to remove and 22 not upgraded.

the compiling process and the errors:

/root@DESKTOP-BSTM044:/opt/core/build# cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX
CMake Deprecation Warning at CMakeLists.txt:7 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- CMAKE_VERSION: 3.28.20231012-gbf5185e
-- SCOREC_VERSION: 2.2.7
-- BUILD_TESTING: OFF
-- CMAKE_INSTALL_PREFIX: /opt
-- BUILD_SHARED_LIBS: OFF
-- CMAKE_CXX_FLAGS:  -g -Werror -Wall -Wextra -Wno-strict-overflow
-- CMAKE_CXX_FLAGS =  -g -Werror -Wall -Wextra -Wno-strict-overflow
-- CMAKE_C_FLAGS =    -g -Werror -Wall -Wextra -Wno-strict-overflow
-- IS_TESTING: OFF
-- MESHES: /opt/core/pumi-meshes
-- BUILD_EXES: ON
-- PUMI_FORTRAN_INTERFACE: OFF
-- PUMI_PYTHON_INTERFACE: OFF
-- MPIRUN: /usr/bin/mpirun -np
-- ENABLE_SIMMETRIX: OFF
-- ENABLE_OMEGA_H: OFF
-- ENABLE_FPP: OFF
-- LION_COMPRESS: OFF
-- PCU_COMPRESS: OFF
-- MDS_SET_MAX: 256
-- MDS_ID_TYPE: int
-- ENABLE_ZOLTAN: OFF
-- ENABLE_STK: OFF
-- ENABLE_STK_MESH: OFF
-- ENABLE_DSP: OFF
-- Configuring done (0.1s)
-- Generating done (0.2s)

root@DESKTOP-BSTM044:/opt/core/build# make
[  1%] Built target lion
[  1%] Building C object pcu/CMakeFiles/pcu.dir/pcu.c.o
In file included from /opt/core/pcu/pcu.c:34:
/opt/core/pcu/PCU.h:16:10: fatal error: mpi.h: No such file or directory

   16 | #include <mpi.h>
      |          ^~~~~~~
compilation terminated.
make[2]: *** [pcu/CMakeFiles/pcu.dir/build.make:76: pcu/CMakeFiles/pcu.dir/pcu.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:709: pcu/CMakeFiles/pcu.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

I have tested the simple C program to see whether including the file would cause similar errors, and the results were fine. Thanks in advance.

cwsmith commented 8 months ago

Hello,

Try using mpicxx and mpicc for the C++ and C compilers, respectively.

This page describes the configuration options, including the use of mpi compiler wrappers: https://github.com/SCOREC/core/wiki/General-Build-instructions#user-content-Configure