Skip to content

dependencies mpi: add -show-compile-info and -show-link-info for mpich#15586

Open
lgarrison wants to merge 1 commit intomesonbuild:masterfrom
lgarrison:mpich-show-compile-info
Open

dependencies mpi: add -show-compile-info and -show-link-info for mpich#15586
lgarrison wants to merge 1 commit intomesonbuild:masterfrom
lgarrison:mpich-show-compile-info

Conversation

@lgarrison
Copy link

Using dependency('mpi') with the MPICH compiler wrappers currently results in compiler warnings about unused command-line arguments. This is because Meson current discovers the compile and link arguments with -compile_info and -link_info:

# --showme for OpenMPI, -compile_info/-link_info for MPICH and IntelMPI
for comp, link in [('--showme:compile', '--showme:link'), ('-compile_info', '-link_info'), ('-show', None)]:
try:
c_args = self.get_config_value([comp], 'compile_args')
l_args = self.get_config_value([link], 'link_args') if link is not None else c_args
except DependencyException:
continue
else:
break
else:
self.is_found = False
return

The -compile_info and -link_info flags actually return complete (and identical) compile + link commands, causing link flags to get mixed into Meson's compile command:

❯ mpicc -compile_info
icx -I/opt/aurora/26.26.0/spack/unified/1.1.1/install/linux-x86_64/mpich-5.0.0.aurora_test.3c70a61-hlkigtk/include -L/opt/aurora/26.26.0/spack/unified/1.1.1/install/linux-x86_64/mpich-5.0.0.aurora_test.3c70a61-hlkigtk/lib -Wl,-rpath -Wl,/opt/aurora/26.26.0/spack/unified/1.1.1/install/linux-x86_64/mpich-5.0.0.aurora_test.3c70a61-hlkigtk/lib -lmpi

The newer -show-compile-info instead just shows the compile flags (likewise for -show-link-info):

❯ mpicc -show-compile-info
-I/opt/aurora/26.26.0/spack/unified/1.1.1/install/linux-x86_64/mpich-5.0.0.aurora_test.3c70a61-hlkigtk/include

Per pmodels/mpich#1045 (specifically pmodels/mpich@f8e9f16), it appears that -show-compile-info and -show-link-info are the preferred ways to get the compile and link flags in recent MPICH/Intel MPI, and that -compile_info and -link_info were kept for legacy reasons.

Summary of command output for completeness

❯ mpicc --version
Intel(R) oneAPI DPC++/C++ Compiler 2025.3.2 (2025.3.2.20260112)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/aurora/26.26.0/oneapi/compiler/2025.3/bin/compiler
Configuration file: /opt/aurora/26.26.0/oneapi/compiler/2025.3/bin/compiler/../icx.cfg

❯ mpicc -compile_info
icx -I/opt/aurora/26.26.0/spack/unified/1.1.1/install/linux-x86_64/mpich-5.0.0.aurora_test.3c70a61-hlkigtk/include -L/opt/aurora/26.26.0/spack/unified/1.1.1/install/linux-x86_64/mpich-5.0.0.aurora_test.3c70a61-hlkigtk/lib -Wl,-rpath -Wl,/opt/aurora/26.26.0/spack/unified/1.1.1/install/linux-x86_64/mpich-5.0.0.aurora_test.3c70a61-hlkigtk/lib -lmpi

❯ mpicc -show-compile-info
-I/opt/aurora/26.26.0/spack/unified/1.1.1/install/linux-x86_64/mpich-5.0.0.aurora_test.3c70a61-hlkigtk/include

❯ mpicc -link-info        
icx -I/opt/aurora/26.26.0/spack/unified/1.1.1/install/linux-x86_64/mpich-5.0.0.aurora_test.3c70a61-hlkigtk/include -L/opt/aurora/26.26.0/spack/unified/1.1.1/install/linux-x86_64/mpich-5.0.0.aurora_test.3c70a61-hlkigtk/lib -Wl,-rpath -Wl,/opt/aurora/26.26.0/spack/unified/1.1.1/install/linux-x86_64/mpich-5.0.0.aurora_test.3c70a61-hlkigtk/lib -lmpi

❯ mpicc -show-link-info
-L/opt/aurora/26.26.0/spack/unified/1.1.1/install/linux-x86_64/mpich-5.0.0.aurora_test.3c70a61-hlkigtk/lib -Wl,-rpath -Wl,/opt/aurora/26.26.0/spack/unified/1.1.1/install/linux-x86_64/mpich-5.0.0.aurora_test.3c70a61-hlkigtk/lib -lmpi

With this patch, I confirm that the compile and link arguments are no longer mixed in the Meson build.

@lgarrison lgarrison requested a review from jpakkane as a code owner February 25, 2026 14:50
@bonzini bonzini added this to the 1.11 milestone Feb 25, 2026
Per pmodels/mpich#1045 (specifically pmodels/mpich@f8e9f16),
-show-compile-info and -show-link-info are the preferred ways to get the compile and
link flags in recent MPICH/Intel MPI.
@lgarrison lgarrison force-pushed the mpich-show-compile-info branch from 27c3ead to b53d377 Compare March 11, 2026 16:05
@dcbaker
Copy link
Member

dcbaker commented Mar 11, 2026

Did you test this with Intel? I've had #15260 opened for a while because we don't actually query the right tools for the oneAPI based compilers.

@bonzini
Copy link
Contributor

bonzini commented Mar 11, 2026

I've had #15260 opened for a while because we don't actually query the right tools for the oneAPI based compilers.

If I understand it correctly, this one is orthogonal to yours (even though they conflict)? Anyway, since you have #15260 I was going to let you merge both in the order that you see fit!

@lgarrison
Copy link
Author

I was just using the MPICH wrappers (around the Intel LLVM compilers). A recent-ish Intel OneAPI compiler wrapper (on a different system) doesn't seem to know about -show-compile-info:

❯ which mpicc
/mnt/sw/nix/store/2nwiiy75jgsikpq64yvdgxzjw9iw9xrf-intel-oneapi-mpi-2021.14.2/mpi/2021.14/bin/mpicc

❯ mpicc -show-compile-info
gcc: error: unrecognized command line option ‘-show-compile-info’; did you mean ‘-fno-opt-info’?

But I think that's fine; it just means Meson will continue to discover flags through -compile_info. So I agree that this change should be orthogonal to #15260.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants