The Hurd is based on the Mach microkernel, and thus __MACH__ is defined; since also macOS is (loosely) based on Mach, it defines __MACH__ as well. Because of this, the wrong variant of sort_r (i.e. the BSD one) is used for the Hurd, which does not work.
Since on macOS __APPLE__ is defined, and __DARWIN__ helps for older Mac OS X, then simply drop the __MACH__ selection: the preprocessor check for the Linux sort_r is properly used for the Hurd (using __GNU__), and that variant works fine.
The Hurd is based on the Mach microkernel, and thus
__MACH__
is defined; since also macOS is (loosely) based on Mach, it defines__MACH__
as well. Because of this, the wrong variant ofsort_r
(i.e. the BSD one) is used for the Hurd, which does not work.Since on macOS
__APPLE__
is defined, and__DARWIN__
helps for older Mac OS X, then simply drop the__MACH__
selection: the preprocessor check for the Linuxsort_r
is properly used for the Hurd (using__GNU__
), and that variant works fine.