#1120617 openmpi: FTBFS on hurd-amd64 since PATH_MAX is not defined

#1120617#5
Date:
2025-11-13 11:02:11 UTC
From:
To:
openmpi is failing to build on hurd-amd64:

  CC       src/str/mpl_str.lo
../../../../../3rd-party/romio341/mpl/src/str/mpl_str.c: In function 'MPL_create_pathname':
../../../../../3rd-party/romio341/mpl/src/str/mpl_str.c:417:37: error: 'PATH_MAX' undeclared (first use in this function)
  417 |         MPL_snprintf(dest_filename, PATH_MAX, "%s/%s.%u.%u%c", dirname, prefix,
      |                                     ^~~~~~~~
../../../../../3rd-party/romio341/mpl/src/str/mpl_str.c:417:37: note: each undeclared identifier is reported only once for each function it appears in
make[5]: *** [Makefile:1161: src/str/mpl_str.lo] Error 1


The problem is kind of common on hurd.  A lot of packages like to use
MAXPATHLEN (or PATH_MAX in this case), but it's not actually a
mandatory element in the POSIX standard. So hurd chooses not to
provide it. On Linux (amd64) it's defined in /usr/include/x86_64-linux-gnu/sys/param.h

There is some discussion of the situation at
https://www.gnu.org/software/hurd/community/gsoc/project_ideas/maxpath.html

A robust way to manage it is to refactor to use dynamic memory
allocation without needing to provide PATH_MAX.

But a simpler workaround is to just give it a reasonable value (say
1000) if it's not already defined.

I'm not sure if we want to bug openmpi (or romio341) upstream about it.
But on the other hand openpmix accepted a patch for it,
https://github.com/openpmix/openpmix/issues/3671
https://github.com/openpmix/openpmix/pull/3672

#1120617#10
Date:
2025-11-13 11:26:41 UTC
From:
To:
Linux sets PATH_MAX to 4096 in /usr/include/linux/limits.h
(included in sys/param.h)

We already have a debian patch for hurd, so easy to update it to add
3rd-party/romio341/mpl/src/str/mpl_str.c.

Updated build_hurd patch attached (patched against salsa debian/latest)

#1120617#15
Date:
2026-01-15 11:27:45 UTC
From:
To:
openmpi 5.0.9-2 claimed to close Bug#1120217,
but I think this hurd bug #1120617 was intended.