[MacPorts] #69131: mpich-gcc12 @4.1.2_0+fortran: cmake no longer locates MPI_C and MPI_CXX (but still finds MPI_Fortran OK)

MacPorts noreply at macports.org
Fri Jan 19 00:59:18 UTC 2024


#69131: mpich-gcc12 @4.1.2_0+fortran: cmake no longer locates MPI_C and MPI_CXX
(but still finds MPI_Fortran OK)
--------------------------+--------------------
  Reporter:  floquet-cxx  |      Owner:  (none)
      Type:  defect       |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  ports        |    Version:  2.8.1
Resolution:               |   Keywords:
      Port:               |
--------------------------+--------------------

Old description:

> The application I'm compiling/developing uses C++, C, F77 and MPI.  It
> has compiled and run fine for many years, though it's still in
> development.   I was recently forced to "upgrade" from Ventura to Sonoma
> (14.2.1) and Xcode15 and now MPI_C and MPI_CXX can't be found by cmake
> (worked fine before the "upgrade").  Problem now happens on both ARM M2
> macs I have.  I  did  a clean reinstall if macports and all the ports I
> use.
>
> I'm not completely sure the issue is with mpich, but it doesn't occur
> with openmpi, so I am  assuming it's an mpich port issue as opposed to a
> cmake port issue.  Though I'm using gcc12, the same problem occurs with
> gcc13.
>
> Here are the commands I use to install gcc12 and mpich (on both Ventura
> and Sonoma)
>
> {{{
>
>   sudo port -N install cmake
>   sudo port -N install gcc12
>   sudo port -N install mpich-gcc12
>   sudo port select --set mpi mpich-gcc12-fortran
>
> }}}
>
> I require the MPI package with cmake for this application.  I believe
> this means that MPI_C, MPI_CXX and MPI_Fortran will be required as
> linkers - even though the top-level code is C++, some lower-level
> libraries in my application use C and F77.  So here are the errors I now
> get when cmake is run:
>
> {{{
>
> build (master) >$ cmake ..
> -- The C compiler identification is AppleClang 15.0.0.15000100
> -- The CXX compiler identification is AppleClang 15.0.0.15000100
> -- The Fortran compiler identification is GNU 12.3.0
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Check for working C compiler:
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
> - skipped
> -- Detecting C compile features
> -- Detecting C compile features - done
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Check for working CXX compiler:
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
> - skipped
> -- Detecting CXX compile features
> -- Detecting CXX compile features - done
> -- Checking whether Fortran compiler has -isysroot
> -- Checking whether Fortran compiler has -isysroot - yes
> -- Checking whether Fortran compiler supports OSX deployment target flag
> -- Checking whether Fortran compiler supports OSX deployment target flag
> - yes
> -- Detecting Fortran compiler ABI info
> -- Detecting Fortran compiler ABI info - done
> -- Check for working Fortran compiler: /opt/local/bin/gfortran - skipped
> -- Building with Apple Accelerate BLAS and LAPACK.
> -- Building code with standard release optimizations.
> -- Found BISON: /opt/local/bin/bison (found version "3.8.2")
> -- Looking for Fortran sgemm
> -- Looking for Fortran sgemm - found
> -- Found BLAS:
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/libblas.tbd
> -- Looking for Fortran cheev
> -- Looking for Fortran cheev - found
> -- Found LAPACK:
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/liblapack.tbd;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/libblas.tbd
> -- Could NOT find MPI_C (missing: MPI_C_WORKS)
> -- Could NOT find MPI_CXX (missing: MPI_CXX_WORKS)
> -- Found MPI_Fortran: /opt/local/lib/mpich-gcc12/libmpifort.dylib (found
> version "4.0")
> CMake Error at
> /opt/local/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:230
> (message):
>   Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND) (found version
>   "4.0")
> Call Stack (most recent call first):
> /opt/local/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:594
> (_FPHSA_FAILURE_MESSAGE)
>   /opt/local/share/cmake-3.24/Modules/FindMPI.cmake:1835
> (find_package_handle_standard_args)
>   CMakeLists.txt:100 (find_package)
>
> -- Configuring incomplete, errors occurred!
> See also "/Users/hmb/develop-git/semtex-
> master/build/CMakeFiles/CMakeOutput.log".
> See also "/Users/hmb/develop-git/semtex-
> master/build/CMakeFiles/CMakeError.log".
>
> }}}
>
> Perhaps related: you can see that Apple's C and C++ compilers are
> selected, but GNU's Fortran compiler gets selected.  However, this
> combination has worked in  the past.
>
> I looks like the cmake MPI package resolver has a conflict with the
> version numbers of libmpicxx and libmpi although they are apparently
> consistent with libmpifort (all 4.0).
>
> Here is a listing of what is in /opt/local/lib/mpich-gcc12:
>
> {{{
>
> build (master) >$ ls /opt/local/lib/mpich-gcc12/
> libfmpich.dylib@        libmpicxx.12.dylib*     libopa.dylib@
> libmpi.12.dylib*        libmpicxx.a             libpmpi.12.dylib*
> libmpi.a                libmpicxx.dylib@        libpmpi.a
> libmpi.dylib@           libmpifort.12.dylib*    libpmpi.dylib@
> libmpich.dylib@         libmpifort.a            pkgconfig/
> libmpichcxx.dylib@      libmpifort.dylib@
> libmpichf90.dylib@      libmpl.dylib@
>

> }}}

New description:

 The application I'm compiling/developing uses C++, C, F77 and MPI.  It has
 compiled and run fine for many years, though it's still in development.
 I was recently forced to "upgrade" from Ventura to Sonoma (14.2.1) and
 Xcode15 and now MPI_C and MPI_CXX can't be found by cmake (worked fine
 before the "upgrade").  Problem now happens on both ARM M2 macs I have.  I
 did  a clean reinstall if macports and all the ports I use.

 I'm not completely sure the issue is with mpich, but it doesn't occur with
 openmpi, so I am  assuming it's an mpich port issue as opposed to a cmake
 port issue.  Though I'm using gcc12, the same problem occurs with gcc13.

 Here are the commands I use to install gcc12 and mpich (on both Ventura
 and Sonoma)

 {{{

   sudo port -N install cmake
   sudo port -N install gcc12
   sudo port -N install mpich-gcc12
   sudo port select --set mpi mpich-gcc12-fortran

 }}}

 I require the MPI package with cmake for this application.  I believe this
 means that MPI_C, MPI_CXX and MPI_Fortran will be required as linkers -
 even though the top-level code is C++, some lower-level libraries in my
 application use C and F77.  So here are the errors I now get when cmake is
 run:

 {{{

 build (master) >$ cmake ..
 -- The C compiler identification is AppleClang 15.0.0.15000100
 -- The CXX compiler identification is AppleClang 15.0.0.15000100
 -- The Fortran compiler identification is GNU 12.3.0
 -- Detecting C compiler ABI info
 -- Detecting C compiler ABI info - done
 -- Check for working C compiler:
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
 - skipped
 -- Detecting C compile features
 -- Detecting C compile features - done
 -- Detecting CXX compiler ABI info
 -- Detecting CXX compiler ABI info - done
 -- Check for working CXX compiler:
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
 - skipped
 -- Detecting CXX compile features
 -- Detecting CXX compile features - done
 -- Checking whether Fortran compiler has -isysroot
 -- Checking whether Fortran compiler has -isysroot - yes
 -- Checking whether Fortran compiler supports OSX deployment target flag
 -- Checking whether Fortran compiler supports OSX deployment target flag -
 yes
 -- Detecting Fortran compiler ABI info
 -- Detecting Fortran compiler ABI info - done
 -- Check for working Fortran compiler: /opt/local/bin/gfortran - skipped
 -- Building with Apple Accelerate BLAS and LAPACK.
 -- Building code with standard release optimizations.
 -- Found BISON: /opt/local/bin/bison (found version "3.8.2")
 -- Looking for Fortran sgemm
 -- Looking for Fortran sgemm - found
 -- Found BLAS:
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/libblas.tbd
 -- Looking for Fortran cheev
 -- Looking for Fortran cheev - found
 -- Found LAPACK:
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/liblapack.tbd;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/libblas.tbd
 -- Could NOT find MPI_C (missing: MPI_C_WORKS)
 -- Could NOT find MPI_CXX (missing: MPI_CXX_WORKS)
 -- Found MPI_Fortran: /opt/local/lib/mpich-gcc12/libmpifort.dylib (found
 version "4.0")
 CMake Error at
 /opt/local/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:230
 (message):
   Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND) (found version
   "4.0")
 Call Stack (most recent call first):
 /opt/local/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:594
 (_FPHSA_FAILURE_MESSAGE)
   /opt/local/share/cmake-3.24/Modules/FindMPI.cmake:1835
 (find_package_handle_standard_args)
   CMakeLists.txt:100 (find_package)

 -- Configuring incomplete, errors occurred!
 See also "/Users/hmb/develop-git/semtex-
 master/build/CMakeFiles/CMakeOutput.log".
 See also "/Users/hmb/develop-git/semtex-
 master/build/CMakeFiles/CMakeError.log".

 }}}

 Perhaps related: you can see that Apple's C and C++ compilers are
 selected, but GNU's Fortran compiler gets selected.  However, this
 combination has worked in the past.

 I looks like the cmake MPI package resolver has a conflict with the
 version numbers of libmpicxx and libmpi although they are apparently
 consistent with libmpifort (all 4.0).

 Here is a listing of what is in /opt/local/lib/mpich-gcc12:

 {{{

 build (master) >$ ls /opt/local/lib/mpich-gcc12/
 libfmpich.dylib@        libmpicxx.12.dylib*     libopa.dylib@
 libmpi.12.dylib*        libmpicxx.a             libpmpi.12.dylib*
 libmpi.a                libmpicxx.dylib@        libpmpi.a
 libmpi.dylib@           libmpifort.12.dylib*    libpmpi.dylib@
 libmpich.dylib@         libmpifort.a            pkgconfig/
 libmpichcxx.dylib@      libmpifort.dylib@
 libmpichf90.dylib@      libmpl.dylib@


 }}}

--

Comment (by floquet-cxx):

 I find that if I force the use of Macports gcc and g++ compilers on the
 command line, like so:

 {{{

 cmake -DCMAKE_C_COMPILER=/opt/local/bin/gcc
 -DCMAKE_CXX_COMPILER=/opt/local/bin/g++ ..

 }}}

 then the cmake errors go away, and compilation completes (instead, mpirun
 now fails!). However, the original code (both with/without Apple C and C++
 compilers) still works fine on pre-Sonoma OS X versions.

-- 
Ticket URL: <https://trac.macports.org/ticket/69131#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list