[MacPorts] #54446: nghttp2 @1.24.0 does not build on PPC Leopard, Mac OS X 10.5.8, with configure.cxx_stdlib = macports-libstdc++ and macports-gcc-6 because "'AI_NUMERICSERV' was not declared in this scope"
MacPorts
noreply at macports.org
Wed Feb 28 19:17:41 UTC 2024
#54446: nghttp2 @1.24.0 does not build on PPC Leopard, Mac OS X 10.5.8, with
configure.cxx_stdlib = macports-libstdc++ and macports-gcc-6 because
"'AI_NUMERICSERV' was not declared in this scope"
------------------------+-------------------------
Reporter: ballapete | Owner: Schamschula
Type: defect | Status: closed
Priority: Normal | Milestone:
Component: ports | Version: 2.4.1
Resolution: fixed | Keywords: leopard
Port: nghttp2 |
------------------------+-------------------------
Comment (by barracuda156):
Replying to [comment:8 ballapete]:
> The folloging patch makes `nghttp2` build on PPC Snow Leopard:
>
> {{{
> --- src/shrpx_config.cc~ 2017-07-02 10:46:31.000000000 +0200
> +++ src/shrpx_config.cc 2017-07-09 22:29:41.000000000 +0200
> @@ -43,6 +43,21 @@
> #endif // HAVE_UNISTD_H
> #include <dirent.h>
>
> +#ifdef __APPLE__ // this
block only for Macs
> +# ifndef __MAC_OS_X_VERSION_MIN_REQUIRED // are
AvailabilityMacros.h or Availability.h not yet included?
> +# if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 // then
for Leopard and later…
> +# include <Availability.h> //
…either include this…
> +# else
> +# include <AvailabilityMacros.h> // …or
include that
> +# endif
> +# endif
> +# if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 // and
for some OS versions do this…
> +# ifndef AI_NUMERICSERV
> +# define AI_NUMERICSERV 0
> +# endif
> +# endif //
finish OS version discrimination
> +#endif //
finish Apple case
> +
> #include <cstring>
> #include <cerrno>
> #include <limits>
> }}}
>
>
> Portfile needs a line
>
> {{{
> patchfiles-append src-shrpx_config.diff
> }}}
Sorry, maybe I miss something here, but this looks a) unnecessarily
complicated and b) also wrong (and working just by chance).
This should work fine:
{{{
#ifndef AI_NUMERICSERV
#define AI_NUMERICSERV 0
#endif
}}}
This is wrong, there should be no leading underscore here: `# if
__MAC_OS_X_VERSION_MIN_REQUIRED < 1060`.
Because `AvailabilityMacros.h`, which is used for Tiger here, does not
have those: https://github.com/alexey-lysiuk/macos-
sdk/blob/a79de83d781f7fb76d329aee456bab9f72f935d1/MacOSX10.4u.sdk/usr/include/AvailabilityMacros.h#L83-L93
This perhaps still works as-is, but simply because
`__MAC_OS_X_VERSION_MIN_REQUIRED` is undefined and defaults to 0, which is
still < 1060, so condition is evaluated as true.
I do not see any reason to use conditioning on OS versions, however.
--
Ticket URL: <https://trac.macports.org/ticket/54446#comment:11>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list