Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0

From: Paul Eggert <[email-masked]>
Date: Sat, 19 Jan 2013 19:31:50 -0800

On 01/19/2013 07:02 PM, Assaf Gordon wrote:
> So if I understand correctly, this is the cause:
> 1. string.h does have "stpncpy", as a macro/inline
> 2. linking programs with stpncpy fails, leading "configure" to think there's no "stpncpy"

OK, so far so good.  'configure' is correct: stpncpy is
busted on that platform.

> 3. 'string.h' is #include'd, but so is gnulib's stpncpy.c

But shouldn't the compiler be including the gnulib string.h?
And doesn't gnulib's string.h contain something that looks like this?

/* Copy no more than N bytes of SRC to DST, returning a pointer past the        
   last non-NUL byte written into DST.  */
#if 1
# if 1
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#   undef stpncpy
#   define stpncpy rpl_stpncpy
#  endif

This should #undef the system's <string.h> stpncpy, which is
busted, and substitute gnulib's good one.  We need to figure out why
that isn't working.

Could you please try this:

./configure
make clean
make V=1

I'm interested in the last (failing) command executed by the last 'make'.
Suppose it is like this:

gcc -std=gnu99  -I. -I./lib  -Ilib ... -o lib/stpncpy.o lib/stpncpy.c

Please send the relevant part of the preprocessed output for that command,
i.e., the output of

gcc -E -std=gnu99 -I. -I./lib  -Ilib ... lib/stpncpy.c

where the "..." contains all the -I options that ar relevant to the
preprocessor.  I'm interested in any part of that output that has anything
to do with stpncpy.

Thanks.