[collectd] collectd-3.10.1-alt2: rebuild failed

Florian Forster octo at verplant.org
Fri Oct 20 09:16:29 CEST 2006


Hi Dmitry,

On Tue, Oct 17, 2006 at 04:24:15PM +0400, Dmitry V. Levin wrote:
> You should not care about bits/ too much, this directory contains
> glibc internals which should not be accessed directly by applications.

we don't include anything from `bits/' ourselves..

> But <sys/syslog.h> defines syslog(3) prototype for a long time yet.

We include <syslog.h> which, in the GNU libc, appears to simply pull in
<sys/syslog.h>. The Solaris libc defines syslog(3) in <syslog.h> and all
the defines in <sys/syslog.h> which is, again, pulled in. So simply
including <sys/syslog.h> instead of <syslog.h> doesn't change anything
with the GNU libc and effectively breaks Solaris support.

> So if application defines own syslog() prototype, there is a risk to
> conflict with prototype defined by glibc headers. That is, do not
> define syslog() prototype, include <syslog.h> instead.

We don't define a syslog prototype either. What we do define is the
following. I don't know _why_ that's done (it's not my code), but it
worked like a charm so far..

-- 8< --
 #if HAVE_SYSLOG
 # define syslog(...) syslog(__VA_ARGS__)
 # if HAVE_OPENLOG
 #  define openlog(...) openlog(__VA_ARGS__)
 # else
 #  define openlog(...) /**/
 # endif
 # if HAVE_CLOSELOG
 #  define closelog(...) closelog(__VA_ARGS__)
 # else
 #  define closelog(...) /**/
 # endif
 #else
 # define syslog(...) /**/
 # define openlog(...) /**/
 # define closelog(...) /**/
 #endif
-- >8 --

> collectd.h:132:1: error: "syslog" redefined
> In file included from /usr/include/sys/syslog.h:207,
>                  from /usr/include/syslog.h:1,
>                  from collectd.h:82,
>                  from apcups.c:32:
> /usr/include/bits/syslog.h:28:1: error: this is the location of the previous definition

If I understand the errormessage correctly, the problem is that some
earlier include already pulls in <bits/syslog.h>. Here's a list of all
the .h-files that are included _before_ <syslog.h>, in the order given.
Files that don't exist are ignored.

-- 8< --
 stdio.h
 sys/types.h
 sys/stat.h
 stdlib.h
 stddef.h
 stdlib.h
 memory.h
 string.h
 strings.h
 inttypes.h
 stdint.h
 unistd.h
 sys/wait.h
 signal.h
 fcntl.h
 errno.h
-- >8 --

Any hints as to what we're doing wrong are greatly appreciated, since I
don't have a clue.

Best regards,
-octo
-- 
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20061020/f77e61d0/attachment.pgp


More information about the collectd mailing list