We check for the availability of strndup and strnlen with autoconf macros. However, if they are available, we still define our own extern prototype for them. Recent glibcs have a slightly different prototype which causes a compile error against ours. This change arose at some point between glibc 2.13 and 2.19.
In file included from /usr/include/string.h:634:0,
from src/api/UpnpString.c:23:
src/api/UpnpString.c:47:15: error: expected identifier or '(' before 'extension'
extern char strndup(__const char __string, size_t __n);
^
Makefile:1266: recipe for target 'src/api/libupnp_la-UpnpString.lo' failed
make[5]: *** [src/api/libupnp_la-UpnpString.lo] Error 1
Most obvious fix is to not redefine them if autoconf tells us they are available anyway, see patch.
Last edit: Nick Leverton 2015-12-31
Nick,
Committed!
But for some reason, your patch did not apply, I had to do some changes, please check.
Regards,
Marcelo.
Hi Marcelo, the fix as applied looks good and builds, thanks. Not sure why my patch differed from mainstream.