Skip to content

`xstrdup()` and friends unsupported on macOS

Hey there, maintainer of the Homebrew formula for man-db here. 👋 Whilst bumping the formula's version to 2.10.0, I encountered a build error:

../gl/lib/regex.h:528:27: note: expanded from macro '_REGEX_NELTS'
#  define _REGEX_NELTS(n) n
                          ^
man.c:386:4: error: expected expression
                        char *s = xstrdup (arg ? arg : default_roff_warnings);
                        ^
man.c:389:27: error: use of undeclared identifier 's'
                        for (warning = strtok (s, ","); warning;
                                               ^
man.c:394:10: error: use of undeclared identifier 's'

After some digging, I learnt that macOS's C library doesn't contain an xmalloc.h, so xstrdup() and others of its ilk result in compiler errors. Here's the full build log; note that I had CFLAGS='-std=c99' exported in my environment so Clang would work properly.

This might not be the only error stopping compilation on macOS: I'm merely reporting what I've encountered thus far.