rpki-client / rpki-client-portable

Portability shim for OpenBSD's rpki-client

Home Page:https://rpki-client.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Apparent lack of HOST_NAME_MAX on macOS?

artkiver opened this issue · comments

Hello there!

I have been making efforts to update the MacPorts Portfile from 8.2 to 8.3 and have run into the following issue during an attempted build and installation:


output-ometric.c:131:16: error: use of undeclared identifier 'HOST_NAME_MAX'
        char hostname[HOST_NAME_MAX + 1];
                      ^
1 error generated.
  CC       rpki_client-roa.o
make[1]: *** [rpki_client-output-ometric.o] Error 1
make[1]: *** Waiting for unfinished jobs....

Documented (along with some rabbit holes not worth expounding upon here) and explored by a fellow MacPorts contributor in comment:
https://trac.macports.org/ticket/67126#comment:6

"As far as I can tell, macOS does not currently define HOST_NAME_MAX. I found no references to it by grepping MacOSX.sdk/usr/include on Monterey. The macOS gethostname(3) manpage used to refer to HOST_NAME_MAX so I guess macOS used to define it (or the manpage mentioned it erroneously), but that manpage currently refers to sysconf(_SC_HOST_NAME_MAX) instead. So this is a bug in rpki-client that will have to be discussed with and addressed by its developers before the port can be updated to this version." ー @ryandesign

Similarly, on macOS Ventura (13.2.1) this seems to be the case as well:

% cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk/usr/include
 % grep -R HOST_NAME_MAX                   
./limits.h:#define _POSIX_HOST_NAME_MAX    255
./unistd.h:#define	_SC_HOST_NAME_MAX		72

The oldest macOS I had up and running was 10.6.8; it doesn't have HOST_NAME_MAX either.

See #85 (comment) for an update from my vantage (and the vantage of the MacPorts CI build bots testing on some other systems).

Thanks!