#1107589 libopenmpi-dev: Support a cross-compatible way of discovering MPI support for C++

Package:
libopenmpi-dev
Source:
libopenmpi-dev
Description:
high performance message passing library -- header files
Submitter:
Helmut Grohne
Date:
2025-07-19 20:43:02 UTC
Severity:
normal
#1107589#5
Date:
2025-06-10 05:17:33 UTC
From:
To:
Hi,

cross building src:spfft fails. It uses CMake to discover an MPI
implementation and attempts to use OpenMPI on 64bit architectures. The
CMake code strongly prefers using the compiler wrappers mpicc and
others. These are fundamentally incompatible with cross compilation and
everywhere else the solution has been not to use mpicc. Ideally,
FindMPI.cmake would eventually prefer pkgconf, but it is less than clear
how to get there in a backwards-compatible way. It can be made to use
pkgconf by setting -DMPI_SKIP_COMPILER_WRAPPER=ON, but then we run into
the next problem. It searches for a package named "mpi-cxx" and there is
none. libopenmpi-dev installs lots of ompi-*.pc including ompi-cxx.pc
and manages mpi-*.pc via update-alternatives. Its postinst has a comment
saying that mpi-cxx.pc was removed in OpenMPI >= 5.0.0, which is not
actually the case. What was removed is libmpi++.so and libmpi_cxx.so,
but ompi-cxx.pc continues to exist.

So at present, we're in a situation where CMake + MPI + C++ + cross
compilation does not work in any way. It works if you don't cross build
(via mpicxx) or if you don't use C++ (via mpi-c.pc). How can we move
forward here?

What is the proper way to discover MPI support for C++?

Helmut

#1107589#12
Date:
2025-07-19 20:41:45 UTC
From:
To:
Hello,

Helmut Grohne, le mar. 10 juin 2025 07:17:33 +0200, a ecrit:

Yes, since that's the way everybody compiles MPI code.

I don't think anybody really uses mpi-c.pc :) Normally one uses mpicc.

The usual way is calling mpicxx

Some programs would provide a --with-mpicxx= configure option to specify
another one to use, but there is no real standard.

Samuel