I get the following error when trying to build on OSX Mavericks (specifically 10.9.1). (Note that this was reported a while ago in Homebrew, but seems to have never made its way upstream: homebrew/Homebrew#24688).
In file included from src/main.c:13:
./src/syshdr.h:183:8: error: expected parameter declarator
size_t strlcpy (char *dst, const char *src, size_t dst_sz);
^
/usr/include/secure/_string.h:105:44: note: expanded from macro 'strlcpy'
__builtin___strlcpy_chk (dest, src, len, __darwin_obsz (dest))
^
/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
^
/usr/include/secure/_common.h:30:32: note: expanded from macro '_USE_FORTIFY_LEVEL'
# define _USE_FORTIFY_LEVEL 2
^
In file included from src/main.c:13:
./src/syshdr.h:183:8: error: expected ')'
/usr/include/secure/_string.h:105:44: note: expanded from macro 'strlcpy'
__builtin___strlcpy_chk (dest, src, len, __darwin_obsz (dest))
^
/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
^
/usr/include/secure/_common.h:30:32: note: expanded from macro '_USE_FORTIFY_LEVEL'
# define _USE_FORTIFY_LEVEL 2
^
./src/syshdr.h:183:8: note: to match this '('
/usr/include/secure/_string.h:105:44: note: expanded from macro 'strlcpy'
__builtin___strlcpy_chk (dest, src, len, __darwin_obsz (dest))
^
/usr/include/secure/_common.h:39:53: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
^
In file included from src/main.c:13:
./src/syshdr.h:183:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
size_t strlcpy (char *dst, const char *src, size_t dst_sz);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:105:44: note: expanded from macro 'strlcpy'
__builtin___strlcpy_chk (dest, src, len, __darwin_obsz (dest))
^~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_common.h:39:31: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
^~~~~~~~~~~~~~~~~~~~~
In file included from src/main.c:13:
./src/syshdr.h:183:8: error: conflicting types for '__builtin___strlcpy_chk'
/usr/include/secure/_string.h:105:3: note: expanded from macro 'strlcpy'
__builtin___strlcpy_chk (dest, src, len, __darwin_obsz (dest))
^
./src/syshdr.h:183:8: note: '__builtin___strlcpy_chk' is a builtin with type 'unsigned long (char *, const char *, unsigned long, unsigned long)'
/usr/include/secure/_string.h:105:3: note: expanded from macro 'strlcpy'
__builtin___strlcpy_chk (dest, src, len, __darwin_obsz (dest))
^
1 warning and 3 errors generated.
It's pretty nasty looking because strlcpy is a macro in Mavericks.
The first error above, in syshdr.h, refers to these lines, which are behind #ifndef HAVE_STRLCPY. So, my first thought was "hmm... autoconf doesn't think we have strlcpy."
But looking through the output of the configure script, that actually isn't the case:
checking whether strlcpy is declared... yes
checking whether strlcat is declared... yes
So, what's up? Turns out, since configure.ac is using AC_CHECK_DECLS to look for the function, the variable that gets defined is not called HAVE_STRLCPY, but instead HAVE_DECL_STRLCPY. You can confirm this in the generated config.h.
There's an incoming pull request for this. I'd definitely be interested to know if this is portable or just the fault of OSX's autotools. It seems from the docs that the _DECL_ is standard.
I get the following error when trying to build on OSX Mavericks (specifically 10.9.1). (Note that this was reported a while ago in Homebrew, but seems to have never made its way upstream: homebrew/Homebrew#24688).
It's pretty nasty looking because
strlcpy
is a macro in Mavericks.The first error above, in syshdr.h, refers to these lines, which are behind
#ifndef HAVE_STRLCPY
. So, my first thought was "hmm... autoconf doesn't think we havestrlcpy
."But looking through the output of the configure script, that actually isn't the case:
So, what's up? Turns out, since
configure.ac
is usingAC_CHECK_DECLS
to look for the function, the variable that gets defined is not calledHAVE_STRLCPY
, but insteadHAVE_DECL_STRLCPY
. You can confirm this in the generatedconfig.h
.There's an incoming pull request for this. I'd definitely be interested to know if this is portable or just the fault of OSX's autotools. It seems from the docs that the
_DECL_
is standard.