On Sat, 13 Jun 2009 00:54:37 Mary Ellen Foster wrote:
> I'm a co-maintainer of the SWI prolog package on Fedora, and I've been
> trouble shooting a problem where the latest 5.7.x versions don't build
> properly. The compiler (GCC 4.4.0) doesn't like the declaration of
> "strndup" in src/mkvmi.c -- it says:
> mkvmi.c:146: error: static declaration of 'strndup' follows
> non-static declaration
> The previous compiler (GCC 4.3.2) has no problem with this, so it's
> probably something new triggered in the latest version, for what it's
> worth.
>
> If I just comment out the declaration of strndup, the compilation
> proceeds successfully as far as I can tell. Why is this function there
> in the first place, though?
>
> Thanks for any suggestions,
>
> MEF
Are you using glibc-2.10? That library version contains new POSIX functions
that are essentially "backports" of existing GNU extensions (including
strndup). Now being POSIX functions they're declared to the C compiler even
when _GNU_SOURCE is not defined.
Non-GNU SWI-Prolog builds probably still need a local declaration of strndup.
But it looks like Jan had run across a similar problem in plld.c and solved
it thusly:
commit f1f03ea8cad026bc8f835f333188b5c14e18f986
Author: Jan Wielemaker <
wielemak@...>
Date: Tue Feb 5 09:07:56 2002 +0000
* Fix name-clash
diff --git a/src/plld.c b/src/plld.c
index a3a5566..9575792 100644
--- a/src/plld.c
+++ b/src/plld.c
@@ -126,6 +126,8 @@ embedded application.
#define oserror xoserror
#undef strdup
#define strdup plld_strdup
+#undef strndup
+#define strndup plld_strndup
#ifdef HAVE_DMALLOC_H
#undef xmalloc
#undef xrealloc
_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog