CMake warning: "mpi.h was not found" (Manjaro Linux)

Having trouble installing or compiling FreeCAD? Get help here.
User avatar
Kunda1
Posts: 5781
Joined: Thu Jan 05, 2017 9:03 pm

CMake warning: "mpi.h was not found" (Manjaro Linux)

Postby Kunda1 » Mon Apr 08, 2019 5:42 pm

Trying to install the 0.18.16111 off of the Arch AUR I see this in the output:

Code: Select all

-- Checking for one of the modules 'ompi-cxx'
CMake Warning at CMakeLists.txt:745 (message):
  mpi.h was not found.  Check for error above.
gbs, the packager responds with:
Kunda: there is something strange with the pkg-config for OpenMPI, because OPENMPI_INCLUDE_DIRS is empty on the CMake side. That's the reason for that warning. However, said include dir is just /usr/include, so at the end it doesn't matter.
I'm not clear what this means. Can the CMake output re-assure that in 'the end it doesn't matter' ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
yorik
Site Admin
Posts: 11552
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: CMake warning: "mpi.h was not found" (Manjaro Linux)

Postby yorik » Tue Apr 09, 2019 3:23 pm

I think it means that cmake just looks for .h files in order to find their containing directory, which is needed at build time. In this case, the containing directory is /usr/include, which is very standard, and will be included anyway by one of the many other files that cmake is scanning for (most .h files live in /usr/include on linux).

Generally speaking if cmake reports a warning (instead of an error), it's safe to go forward, if make fails (for ex. because needed mpi.h was not found), then we might have a problem. But, at least on debian-based platforms, this mpi package is a strange thing that has several versions and several alternative .h files (I don't fully understand it) so this file might very well not be used during the build...
User avatar
Kunda1
Posts: 5781
Joined: Thu Jan 05, 2017 9:03 pm

Re: CMake warning: "mpi.h was not found" (Manjaro Linux)

Postby Kunda1 » Tue Apr 09, 2019 4:16 pm

yorik wrote:
Tue Apr 09, 2019 3:23 pm
Generally speaking if cmake reports a warning (instead of an error), it's safe to go forward, if make fails (for ex. because needed mpi.h was not found), then we might have a problem. But, at least on debian-based platforms, this mpi package is a strange thing that has several versions and several alternative .h files (I don't fully understand it) so this file might very well not be used during the build...
I usually ignore the standard CMake warnings, 'Didn''t find X file in Y location. Found it instead in Z location' but this warning stands out a bit different that's why I mentioned a way to at least CMake says something about it instead of leaving us hanging.
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
yorik
Site Admin
Posts: 11552
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: CMake warning: "mpi.h was not found" (Manjaro Linux)

Postby yorik » Wed Apr 10, 2019 8:10 pm

I agree with you, it is confusing and looks totally like a showstopper issue...

But I'm not sure of what should be done, if this file is required or not. Our main cmake file contains this:

Code: Select all

                # Med Fichier can require MPI
                pkg_search_module(OPENMPI ompi-cxx)
                add_compile_options(${OPENMPI_CFLAGS})
                link_directories(${OPENMPI_LIBRARY_DIRS})
                link_libraries(${OPENMPI_LIBRARIES})
                find_file(MpidotH mpi.h PATHS ${OPENMPI_INCLUDE_DIRS} NO_DEFAULT_PATH)
                if(NOT MpidotH)
                    message( WARNING "mpi.h was not found. Check for error above.")
                endif()
which puzzles me a little bit... it seems to require the openmpi package, (on debian libopenmpi-dev indeed contains mpi.h), which - i think - should abort the process if not found, but then in that case, looking for mpi.h seems redundant...

Anyone mpi-enlightened around? :)
ezzieyguywuf
Posts: 558
Joined: Tue May 19, 2015 1:11 am

Re: CMake warning: "mpi.h was not found" (Manjaro Linux)

Postby ezzieyguywuf » Mon Apr 15, 2019 8:57 pm

yorik wrote:
Wed Apr 10, 2019 8:10 pm
Anyone mpi-enlightened around?
I don't consider myself particularly enlightened, however the cMake documentation seems to suggest that the following change would result in the behaviour you describe:

Code: Select all

-pkg_search_module(OPENMPI ompi-cxx)
+pkg_search_module(OPENMPI REQUIRED ompi-cxx)
lonaowna
Posts: 1
Joined: Fri Aug 30, 2019 8:14 pm

Re: CMake warning: "mpi.h was not found" (Manjaro Linux)

Postby lonaowna » Fri Aug 30, 2019 8:27 pm

All of this code has been added in commit git commit b765193 by ysangkok with absolutely no documentation.. Are they still around to explain the change?

The thing that confuses me the most is the NO_DEFAULT_PATH in the following line:
find_file(MpidotH mpi.h PATHS ${OPENMPI_INCLUDE_DIRS} NO_DEFAULT_PATH)

This means that it will not look for mpi.h in /include, which is where Arch Linux (and I assume many other distros) ship it. It makes no sense.