Skip to content

Cannot include mpi-ext.h without mpi.h #12111

@eschnett

Description

@eschnett

In a project of mine I am using the cmake statement check_include_file(mpi-ext.h HAVE_MPI_EXT_H) to see whether MPI provides the file mpi-ext.h. Surprisingly this check fails for OpenMPI 5.0.0. The error message is

FAILED: CMakeFiles/cmTC_aa701.dir/CheckIncludeFile.c.o 
/Users/eschnett/openmpi-5.0.0/bin/mpicc   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -std=gnu99 -o CMakeFiles/cmTC_aa701.dir/CheckIncludeFile.c.o -c /Users/eschnett/src/c/MPItrampoline6/mpiwrapper/build-openmpi/CMakeFiles/CMakeTmp/CheckIncludeFile.c
In file included from /Users/eschnett/openmpi-5.0.0/include/mpi-ext.h:16,
                 from /Users/eschnett/src/c/MPItrampoline6/mpiwrapper/build-openmpi/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:
/Users/eschnett/openmpi-5.0.0/include/openmpi/mpiext/mpiext_affinity_c.h:24:14: error: expected ';' before 'int'
   24 | OMPI_DECLSPEC int OMPI_Affinity_str(ompi_affinity_fmt_t fmt_type,
      |              ^~~~
      |              ;

The reason seems to be that the file mpi-ext.h includes openmpi/mpiext/mpiext_affinity_c.h, which uses the symbol OMPI_DECLSPEC without defining it first. This symbol is defined in mpi.h, but mpi-ext.h does not include mpi.h.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions