First of all: it’s the first time I’m filing an issue here. I also don’t know if I’m in the right place here for asking help for this issue. I also am NOT an advanced user of cmake, compilers, macports, etc. I just wanted to install a seemingly simple open-source program for doing Finite Element Analysis, but it turned out not as straight-forward as it seemed. Apologies beforehand for any stupid questions.
Problem
While trying to cmake and build a program called ‘elmerfem’, I get the following error:
CMake Error at cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
Could NOT find MPI_C (missing: MPI_C_LIBRARIES MPI_C_INCLUDE_PATH)
Call Stack (most recent call first):
cmake/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
cmake/Modules/FindMPI.cmake:615 (find_package_handle_standard_args)
CMakeLists.txt:254 (FIND_PACKAGE)
I tried many times including locations for this package via -DCMAKE_PREFIX_PATH=\<relevant_location>
, but this didn’t work. The commands below are (some of) the ones I tried:
cmake -DWITH_ELMERGUI:BOOLEAN=TRUE -DWITH_OpenMP:BOOLEAN=TRUE -DWITH_MPI:BOOLEAN=TRUE -DCMAKE_PREFIX_PATH=/opt/local/bin/mpiexec.hydra-mpich-mp -DCMAKE_INSTALL_PREFIX=../install ../elmerfem
cmake -DWITH_ELMERGUI:BOOLEAN=TRUE -DWITH_OpenMP:BOOLEAN=TRUE -DWITH_MPI:BOOLEAN=TRUE -DCMAKE_PREFIX_PATH=/opt/local/bin/mpiexec -DCMAKE_INSTALL_PREFIX=../install ../elmerfem
cmake -DWITH_ELMERGUI:BOOLEAN=TRUE -DWITH_OpenMP:BOOLEAN=TRUE -DWITH_MPI:BOOLEAN=TRUE -DCMAKE_PREFIX_PATH=/opt/local/bin/ -DCMAKE_INSTALL_PREFIX=../install ../elmerfem
Question:
- How do I point cmake to the relevant compilers, libraries, and packages it needs? Have I done something wrong, or overlooked something?
- How do I figure out where the problem is situated? Meaning, is it a fault on cmake’s side, or something in the CMakeLists.txt, or on Macports’ side, OSX, Xcode, … ?
My system
- Macbook Pro late 2011
- OSX 10.13.6
- Packages installed via Macports v2.7.2 (compilers, libs, …)
- Xcode 10.1
Other possibly relevant things:
- Previously I also had trouble with cmake finding the C-, CXX-, and Fortran-compilers. After a lot of searching, trying things out, failing and cursing everything to the moon, I ended up changing the CMakeLists.txt manually. I am aware that this is actually ‘not done’, but at least it worked. The relevant compilers where indeed found by cmake.
- all packages and libraries needed are installed via ‘Macports’. The installation-guide of ‘elmerfem’ is written for Homebrew instead of Macports. I’m guessing all the included installation-files are all aimed at locations typically used by Homebrew, and I probably need to adapt them for usage with Macports. Or is that stupid idea?
- Previously I tried building/compiling ‘elmerfem’ (also with cmake) on a Fedora 36 system. I got the same error for MPI_C.
- I got this kind of errors a lot, for MPI, MUMPS, and other libraries. This was the case on OSX as well as on Fedora36.
Many thanks in advance, and best regards,