<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/121212>121212</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
error: 'mpi.h' file not found [clang-diagnostic-error]
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
pierre-24
</td>
</tr>
</table>
<pre>
While running clang-tidy, using `clang-tidy -checks=* openmpi_test.cpp `, on this file, I get (among other things) `error: 'mpi.h' file not found [clang-diagnostic-error]`:
```c++
#include <mpi.h>
#include <cstdio>
void print_processors() {
// Initialize the MPI environment
MPI_Init(nullptr, nullptr);
// Get the number of processes
int world_size;
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
// Get the rank of the process
int world_rank;
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
// Get the name of the processor
char processor_name[MPI_MAX_PROCESSOR_NAME];
int name_len;
MPI_Get_processor_name(processor_name, &name_len);
// Print off a hello world message
printf("Hello world from processor %s, rank %d out of %d processors\n",
processor_name, world_rank, world_size);
// Finalize the MPI environment.
MPI_Finalize();
}
```
However, while using `mpicxx main.cpp openmpi_test.cpp -o test` (`main.cpp` only calls `print_processors()`), everything goes well. Thus, this is not supposed to be reported :)
Furthermore, it is not possible to supress this "error" with `NOLINT`.
Tested with:
+ Clang-tidy v19.1.5 on Fedora 41, with OpenMPI,
+ Clang-tidy v19.1.6 on Ubuntu 22.04 (Github runner) with OpenMPI/Intel MPI (installed using [this action](https://github.com/mpi4py/setup-mpi)).
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykVVGP2jgQ_jXmZUQUJgSShzwAW1qkUlZtT703FJJJ4qtjR7YD3f76k50scLt7ew8nIuHY33zfeDz-khvDa0mUsXjN4odJ3ttG6azjpDVNcT45qfIp-9FwQaB7KbmsoRC5rKeWl08MN9AbN8cW4W0apkVDxU_DogeGK1AdybbjR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