Subject: Re: evbarm tools build failed
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: James Chacon <jmc@NetBSD.org>
List: tech-userlevel
Date: 06/22/2004 15:42:16
--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Jun 22, 2004 at 01:20:26PM -0500, James Chacon wrote:
> On Tue, Jun 22, 2004 at 08:14:14PM +0200, Manuel Bouyer wrote:
> > On Wed, Jun 23, 2004 at 01:09:39AM +0700, Ian Zagorskih wrote:
> > > 
> > > # uname -a
> > > NetBSD NBSD1 2.0_BETA NetBSD 2.0_BETA (NBSD1) #1: Tue Jun 15 15:33:23 NOVST 
> > > 2004  ianzag@NBSD1:/usr/src/sys/arch/i386/compile/NBSD1 i386
> > > 
> > > Completely updated from CVS several minutes ago.
> > > 
> > > build.sh -m evbarm tools
> > > 
> > > [...]
> > > cc -O -I/usr/src/tools/compat/obj -I/usr/src/tools/compat/obj/include  
> > > -I/usr/src/tools/cap_mkdb/../compat -DHAVE_NBTOOL_CONFIG_H=1  
> > > -D_FILE_OFFSET_BITS=64  -c -o getcap.lo.o    /usr/src/lib/libc/gen/getcap.c
> > > /usr/src/lib/libc/gen/getcap.c: In function `__nbcompat_cgetent':
> > > /usr/src/lib/libc/gen/getcap.c:214: error: argument `db_array' doesn't match 
> > > prototype
> > 
> > I see this for sparc too.
> > 
> 
> Looking into it
> 

Apply this patch to your 2.0 tree and it'll build again. I'm getting it
pulled up also.

James

--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: tools/compat/compat_defs.h
===================================================================
RCS file: /cvsroot/src/tools/compat/compat_defs.h,v
retrieving revision 1.31.2.3
diff -u -r1.31.2.3 compat_defs.h
--- tools/compat/compat_defs.h	22 Jun 2004 07:36:34 -0000	1.31.2.3
+++ tools/compat/compat_defs.h	22 Jun 2004 20:41:59 -0000
@@ -514,10 +514,10 @@
 
 char	*cgetcap(char *, const char *, int);
 int	 cgetclose(void);
-int	 cgetent(char **, const char * const *, const char *);
-int	 cgetfirst(char **, const char * const *);
+int	 cgetent(char **, char **, const char *);
+int	 cgetfirst(char **, char **);
 int	 cgetmatch(const char *, const char *);
-int	 cgetnext(char **, const char * const *);
+int	 cgetnext(char **, char **);
 int	 cgetnum(char *, const char *, long *);
 int	 cgetset(const char *);
 int	 cgetstr(char *, const char *, char **);
Index: lib/libc/gen/pwcache.c
===================================================================
RCS file: /cvsroot/src/lib/libc/gen/pwcache.c,v
retrieving revision 1.25.2.1
diff -u -r1.25.2.1 pwcache.c
--- lib/libc/gen/pwcache.c	22 Jun 2004 07:28:35 -0000	1.25.2.1
+++ lib/libc/gen/pwcache.c	22 Jun 2004 20:42:00 -0000
@@ -66,6 +66,16 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+/*
+ * XXX Undefine the renames of these functions so that we don't
+ * XXX rename the versions found in the host's <pwd.h> by mistake!
+ */
+#undef group_from_gid
+#undef user_from_uid
+#endif
+
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
 #if 0
@@ -88,6 +98,12 @@
 #include <string.h>
 #include <unistd.h>
 
+#if HAVE_NBTOOL_CONFIG_H
+/* XXX Now, re-apply the renaming that we undid above. */
+#define	group_from_gid	__nbcompat_group_from_gid
+#define	user_from_uid	__nbcompat_user_from_uid
+#endif
+
 #ifdef __weak_alias
 __weak_alias(user_from_uid,_user_from_uid)
 __weak_alias(group_from_gid,_group_from_gid)
@@ -240,16 +256,14 @@
 	return (0);
 }
 
-#if !HAVE_USER_FROM_UID
 /*
  * user_from_uid()
  *	caches the name (if any) for the uid. If noname clear, we always
- *	return the the stored name (if valid or invalid match).
+ *	return the stored name (if valid or invalid match).
  *	We use a simple hash table.
  * Return
  *	Pointer to stored name (or a empty string)
  */
-
 const char *
 user_from_uid(uid_t uid, int noname)
 {
@@ -314,12 +328,11 @@
 /*
  * group_from_gid()
  *	caches the name (if any) for the gid. If noname clear, we always
- *	return the the stored name (if valid or invalid match).
+ *	return the stored name (if valid or invalid match).
  *	We use a simple hash table.
  * Return
  *	Pointer to stored name (or a empty string)
  */
-
 const char *
 group_from_gid(gid_t gid, int noname)
 {
@@ -380,7 +393,6 @@
 	}
 	return (ptr->name);
 }
-#endif /* HAVE_USER_FROM_UID */
 
 /*
  * uid_from_user()
@@ -388,7 +400,6 @@
  * Return
  *	the uid (if any) for a user name, or a -1 if no match can be found
  */
-
 int
 uid_from_user(const char *name, uid_t *uid)
 {
@@ -453,7 +464,6 @@
  * Return
  *	the gid (if any) for a group name, or a -1 if no match can be found
  */
-
 int
 gid_from_group(const char *name, gid_t *gid)
 {
Index: lib/libc/stdio/fparseln.c
===================================================================
RCS file: /cvsroot/src/lib/libc/stdio/fparseln.c,v
retrieving revision 1.2.2.3
diff -u -r1.2.2.3 fparseln.c
--- lib/libc/stdio/fparseln.c	22 Jun 2004 07:17:40 -0000	1.2.2.3
+++ lib/libc/stdio/fparseln.c	22 Jun 2004 20:42:00 -0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: fparseln.c,v 1.2.2.3 2004/06/22 07:17:40 tron Exp $	*/
+/*	$NetBSD: fparseln.c,v 1.2 2003/01/18 11:29:52 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1997 Christos Zoulas.  All rights reserved.
@@ -29,9 +29,13 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fparseln.c,v 1.2.2.3 2004/06/22 07:17:40 tron Exp $");
+__RCSID("$NetBSD: fparseln.c,v 1.2 2003/01/18 11:29:52 thorpej Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -48,20 +52,6 @@
 
 #if ! HAVE_FPARSELN
 
-#ifndef HAVE_NBTOOL_CONFIG_H
-#include "reentrant.h"
-#include "local.h"
-#else
-#define FLOCKFILE(fp)
-#define FUNLOCKFILE(fp)
-#endif
-
-#if defined(_REENTRANT) && !HAVE_NBTOOL_CONFIG_H
-#define __fgetln(f, l) __fgetstr(f, l, '\n')
-#else
-#define __fgetln(f, l) fgetln(f, l)
-#endif
-
 static int isescaped(const char *, const char *, int);
 
 /* isescaped():
@@ -124,15 +114,13 @@
 	 */
 	nl  = '\n';
 
-	FLOCKFILE(fp);
-
 	while (cnt) {
 		cnt = 0;
 
 		if (lineno)
 			(*lineno)++;
 
-		if ((ptr = __fgetln(fp, &s)) == NULL)
+		if ((ptr = fgetln(fp, &s)) == NULL)
 			break;
 
 		if (s && com) {		/* Check and eliminate comments */
@@ -164,7 +152,6 @@
 			continue;
 
 		if ((cp = realloc(buf, len + s + 1)) == NULL) {
-			FUNLOCKFILE(fp);
 			free(buf);
 			return NULL;
 		}
@@ -175,8 +162,6 @@
 		buf[len] = '\0';
 	}
 
-	FUNLOCKFILE(fp);
-
 	if ((flags & FPARSELN_UNESCALL) != 0 && esc && buf != NULL &&
 	    strchr(buf, esc) != NULL) {
 		ptr = cp = buf;

--nFreZHaLTZJo0R7j--