Skip to content

Build error on macOS (SSIZE_MAX undefined) #12109

@eschnett

Description

@eschnett

I am building OpenMPI 5.0.0 on macOS with a MacPorts-installed GCC 13.2.

My configure options are

$ ./configure --prefix=$HOME/openmpi-5.0.0 --with-libevent=internal CC=gcc CXX=g++ FC=gfortran

This fails with the error message

get_elements_x.c: In function 'PMPI_Get_elements_x':
get_elements_x.c:77:63: error: 'SSIZE_MAX' undeclared (first use in this function); did you mean 'RSIZE_MAX'?
   77 |         if (OMPI_SUCCESS == ret && internal_count <= (size_t) SSIZE_MAX) {
      |                                                               ^~~~~~~~~
      |                                                               RSIZE_MAX
get_elements_x.c:77:63: note: each undeclared identifier is reported only once for each function it appears in

Adding the lines

#ifndef SSIZE_MAX
#define SSIZE_MAX LONG_MAX
#endif

after the #include <limits.h> resolves the issue for me.

I'm sure there is a more elegant way, probably requiring a certain POSIX level, but I could not figure it out.

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