Discussion:
[CMake] FindMPI troubles on macOS w/ small reproducer
Zaak Beekman
2018-10-29 16:21:00 UTC
Permalink
Hi All,

It seems to me that there is a bug in FindMPI in the latest CMake and/or in
the Travis-CI macOS (`osx`) environment. Has anyone had success testing
with the latest CMake a C & Fortran application that requires MPI on
Travis-CI osx nodes? (Ideally using GNU compilers all the way.) If you
could share a `.travis.yml` file that shows how you accomplished this, I
would be very grateful.

I'm trying to debug the CI test system for a project I help maintain,
OpenCoarrays. I'm seeing some very strange behavior: Running the build
locally on my macOS machine succeeds without issue. However running the
same build in a Travis-CI.org `osx` environment causes `FindMPI` to fail.
It fails in a strange way, however. It finds all the libraries and sets
`MPI_Fortran_FOUND` to true but `MPI_{C,CXX}_FOUND` to false.

I have setup a pretty simple, and small minimally complete verifiable
example (MCVE) at https://github.com/zbeekman/CMake-mac-travis-MCVE. I have
also added a comment on the kitware gitlab bug tracker:
https://gitlab.kitware.com/cmake/cmake/issues/18139#note_475842. I told
CMake to dump TONS of debug information, but I couldn't spot obvious
issues. If someone could please take a look through the output, e.g., here:
https://travis-ci.com/zbeekman/CMake-mac-travis-MCVE/jobs/154349779 to
figure out why FindMPI is behaving this way, or experiment with my test
repositoryI would appreciate it very much.

The CMake file is super simple:

```CMake
cmake_minimum_required(VERSION 3.4)
project(foo LANGUAGES C CXX Fortran)
find_package( MPI )
if ( (NOT MPI_C_FOUND) OR (NOT MPI_Fortran_FOUND) OR (NOT MPIEXEC))
# Get default install location of MPICH from install.sh
message(WARNING "Could not find all MPI components!")
message(FATAL_ERROR "
MPI_C_FOUND = ${MPI_C_FOUND}
MPI_CXX_FOUND = ${MPI_CXX_FOUND}
MPI_Fortran_FOUND = ${MPI_Fortran_FOUND}
MPIEXEC = ${MPIEXEC}
")
endif()
```

And the [`.travis.yml` file](
https://github.com/zbeekman/CMake-mac-travis-MCVE/blob/master/.travis.yml)
is pretty simple too; it just defines a build matrix with two jobs, one to
test MPICH and one to test OpenMPI both on the `osx` configuration of
Travis-CI. It also has to fix some issues when installing GCC 8.2 vai
homebrew. Then it launches CMake using GNU 8.2 toolchain. The MPI
implementations shipped by homebrew are built using clang, but I really
don't see how this could/should affect finding the C wrapper scripts and
setting `MPI_C_FOUND` to true, since C compilers should produce ABI
compatible C libraries.

Thanks,
Zaak
Send CMake mailing list submissions to
To subscribe or unsubscribe via the World Wide Web, visit
https://cmake.org/mailman/listinfo/cmake
or, via email, send a message with subject or body 'help' to
You can reach the person managing the list at
When replying, please edit your Subject line so it is more specific
than "Re: Contents of CMake digest..."
1. Re: CMake script mode not backward compatible? (Brad King)
2. Re: TARGET_FILE generator expression and multi-config (i.e.
VS) (Hendrik Greving)
----------------------------------------------------------------------
Message: 1
Date: Mon, 29 Oct 2018 11:12:54 -0400
Subject: Re: [CMake] CMake script mode not backward compatible?
Content-Type: text/plain; charset=utf-8
Hi,
Since cmake 3.10, using cmake in script mode (-P) produce an error with
the
cmake_minimum_required(VERSION 3.9)
set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL FALSE)
I did not see something related in the release notes of cmake 3.10 so I
would like to know if it is a regression, or if I was lucky that it
worked
in cmake prior to 3.10?
https://gitlab.kitware.com/cmake/cmake/issues/18523
Please follow progress there.
FWIW, there is little reason to use this command in script mode.
Thanks,
-Brad
------------------------------
Message: 2
Date: Mon, 29 Oct 2018 08:15:21 -0700
Subject: Re: [CMake] TARGET_FILE generator expression and multi-config
(i.e. VS)
<CABVVhih0c1=
Content-Type: text/plain; charset="utf-8"
Subject: $<TARGET_FILE:tgt>
Thanks
I am not seeing any generator expression
On Thu, Oct 25, 2018 at 2:25 PM Hendrik Greving
multi-config generators?
Thanks in advance
--
Powered by www.kitware.com
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For
more
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
https://cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <
https://cmake.org/pipermail/cmake/attachments/20181029/80fe6146/attachment-0001.html
------------------------------
Subject: Digest Footer
--
Powered by www.kitware.com
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
https://cmake.org/mailman/listinfo/cmake
------------------------------
End of CMake Digest, Vol 174, Issue 67
**************************************
Loading...