# FindMPI fails if suffix is limited to .a and .lib

**URL:** https://discourse.cmake.org/t/findmpi-fails-if-suffix-is-limited-to-a-and-lib/15500
**Category:** Code
**Tags:** os:linux
**Created:** [February 7, 2026, 1:21pm UTC](https://discourse.cmake.org/t/findmpi-fails-if-suffix-is-limited-to-a-and-lib/15500 "2026-02-07T13:21:34Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![KazuFurutaka](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/0ea827/32.png) [@KazuFurutaka](https://discourse.cmake.org/u/KazuFurutaka)
#### Post date: [February 7, 2026, 1:21pm UTC](https://discourse.cmake.org/t/findmpi-fails-if-suffix-is-limited-to-a-and-lib/15500/1 "2026-02-07T13:21:34Z")

</div>

Dear experts.

`find_package(MPI)` “fails” (resulting in `MPI_FOUND`=`FALSE`) if `CMAKE_FIND_LIBRARY_SUFFIXES` is set to `“.a;.lib”` although it finds `libmpichfort.a` and `libmpich.a` (as reported in `MPI_Fortran_LIBRARIES`).

OS: Linux (Ubuntu 24.04.3 LTS)

CMake version: 4.2.3

MPI: mpich 4.1 (`mpich-4.2.0-5build3` and `libmpich12-4.2.0-5build3`)

 ![FindMPI_suffixes_changed](https://discourse.cmake.org/uploads/default/original/2X/1/18cc208e144b2ef9d801b0326ae85d144f56b9a9.png)

p.s. setting `MPI_USE_STATIC_LIBS` to `TRUE` seems to have no effect in selecting static libraries, right?

---

<div class="post-metadata">

### Author: ![KazuFurutaka](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/0ea827/32.png) [@KazuFurutaka](https://discourse.cmake.org/u/KazuFurutaka)
#### Post date: [February 11, 2026, 4:39am UTC](https://discourse.cmake.org/t/findmpi-fails-if-suffix-is-limited-to-a-and-lib/15500/2 "2026-02-11T04:39:50Z")

</div>

Intel oneAPI ifx runs OK, but GNU gfortran fails…

 ![ifx_OK-gf_fail](https://discourse.cmake.org/uploads/default/original/2X/b/b52442a6b3d1838079a469938784febb169c535d.png)

---

<div class="post-metadata">

### Author: ![KazuFurutaka](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/0ea827/32.png) [@KazuFurutaka](https://discourse.cmake.org/u/KazuFurutaka)
#### Post date: [February 15, 2026, 5:34am UTC](https://discourse.cmake.org/t/findmpi-fails-if-suffix-is-limited-to-a-and-lib/15500/3 "2026-02-15T05:34:46Z")

</div>

It seems that TryCompile-s fail because of undefined references to the symbols in PMIx, UCX, and so on…

`mpifort -show` (MPICH on Ubuntu 24.04.3 LTS) prints the following:

`furutaka@ubuntu:~/practices/MPI$ mpifort -show -static`  
`gfortran -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/build/mpich-C3oteG/mpich-4.2.0=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -fcf-protection -fdebug-prefix-map=/build/mpich-C3oteG/mpich-4.2.0=/usr/src/mpich-4.2.0-5build3 -fallow-invalid-boz -fallow-argument-mismatch -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -Wl,-z,relro -L/usr/lib -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu/pmix2/lib -static -I/usr/lib/x86_64-linux-gnu/mpich/include -I/usr/lib/x86_64-linux-gnu/mpich/include -L/usr/lib/x86_64-linux-gnu/mpich/lib -lmpichfort -lmpich -L/usr/lib -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu/pmix2/lib -lhwloc -lpmix -lucp -lucs -lpthread`

`furutaka@ubuntu:~/practices/MPI$ mpifort -show -shared`  
`gfortran -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/build/mpich-C3oteG/mpich-4.2.0=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -fcf-protection -fdebug-prefix-map=/build/mpich-C3oteG/mpich-4.2.0=/usr/src/mpich-4.2.0-5build3 -fallow-invalid-boz -fallow-argument-mismatch -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -Wl,-z,relro -shared -I/usr/lib/x86_64-linux-gnu/mpich/include -I/usr/lib/x86_64-linux-gnu/mpich/include -L/usr/lib/x86_64-linux-gnu/mpich/lib -lmpichfort -lmpich`

I’ve tried to attach an example output of try\_compile (MPI\_RESULT\_Fortran\_test\_mpi\_F77\_HEADER\_NOKIND), but as **a new user** I couldn’t do so (and I couldn’t paste it here because of the limit on the number of characters…).  
How can I show it???

My ultimate question is, HOW CAN I DO STATIC LINKING OF MPI LIBRARIES???
