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

Having trouble installing or compiling FreeCAD? Get help here.
User avatar
Kunda1
Posts: 7337
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: 11845
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: 7337
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: 11845
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: 642
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: 3
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.
lonaowna
Posts: 3
Joined: Fri Aug 30, 2019 8:14 pm

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

Postby lonaowna » Sat Apr 25, 2020 10:49 am

Pull request to don't show this error while OpenMPI is actually found:
https://github.com/FreeCAD/FreeCAD/pull/3390
etrombly
Posts: 80
Joined: Thu Dec 05, 2019 6:50 pm

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

Postby etrombly » Sat Apr 25, 2020 10:40 pm

I was trying to use openmpi for something I was working on and wasn't able to get it to detect it correctly for visual studio 2019 community, even though it's built in. From looking around it seems like CMake's openmpi detection is really flaky.
User avatar
Sudhanshu
Posts: 149
Joined: Mon Oct 15, 2018 5:22 am

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

Postby Sudhanshu » Tue Apr 28, 2020 6:29 pm

On Arch Linux, I am getting the same warning:

Code: Select all

CMake Warning at cMake/FreeCAD_Helpers/SetupSalomeSMESH.cmake:105 (message):
  mpi.h was not found.  Check for error above.
Call Stack (most recent call first):
  CMakeLists.txt:51 (SetupSalomeSMESH)
And there is no error above it.
lonaowna
Posts: 3
Joined: Fri Aug 30, 2019 8:14 pm

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

Postby lonaowna » Wed Apr 29, 2020 7:24 am

@Sudhanshu yes that's the issue that PR#3390 fixes. With that, it will only show the warning when it's actually not found.

@etrombly is it showing any errors? Does it actually not work, or does it just say it wasn't detected?