Subject: toolchain/30145: build.sh fails on NetBSD-1.5.2 host
To: None <toolchain-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Alan Barrett <apb@cequrux.com>
List: netbsd-bugs
Date: 05/05/2005 21:01:01
>Number: 30145
>Category: toolchain
>Synopsis: build.sh fails on NetBSD-1.5.2 host
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: toolchain-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu May 05 21:01:01 +0000 2005
>Originator: Alan Barrett
>Release: NetBSD 2.0.2
>Organization:
Not much
>Environment:
NetBSD-1.5.2/i386 host
attempting to build NetBSD-2.0.2
>Description:
Using build.sh to build netBSD-2.0.2 on a NetBSD-1.5.2 host fails
with the following message:o
# compile binstall/getid.lo
cc -O -I/usr/obj/build/tools/compat -I/usr/obj/build/tools/compat/include -I/usr/src/tools/binstall/../compat -DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -I/usr/src/bin/ls -I/usr/src/usr.sbin/mtree -c -o getid.lo.o /usr/src/usr.sbin/mtree/getid.c
In file included from /usr/src/usr.sbin/mtree/extern.h:47,
from /usr/src/usr.sbin/mtree/getid.c:85:
/usr/include/netdb.h:250: conflicting types for `socklen_t'
/usr/src/tools/binstall/../compat/compat_defs.h:131: previous declaration of `socklen_t'
The config.log file in ${OBJDIR}/tools/compat contains the following
relevant messages:
configure:3148: checking for socklen_t
configure:3171: cc -c -O conftest.c >&5
In file included from configure:3156:
/usr/include/sys/socket.h:186: syntax error before `u_char'
/usr/include/sys/socket.h:214: syntax error before `u_char'
/usr/include/sys/socket.h:216: `u_char' undeclared here (not in a function)
/usr/include/sys/socket.h:218: `u_char' undeclared here (not in a function)
/usr/include/sys/socket.h:218: `u_char' undeclared here (not in a function)
configure:3174: $? = 1
configure: failed program was:
#line 3154 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
int
main ()
{
if ((socklen_t *) 0)
return 0;
if (sizeof (socklen_t))
return 0;
;
return 0;
}
configure:3190: result: no
The underlying problem is that the confdefs.h file created by the
tools/compat/configure defines _POSIX_SOURCE and _XOPEN_SOURCE and
other similar macros, the <sys/types.h> in NetBSD-1.5.2 fails to
define u_char when _POSIX_SOURCE or _XOPEN_SOURCE are defined, the
<sys/socket.h> in NetBSD-1.5.2 tries to use u_char although it was
not defined; this leads to the configure script incorrectly thinking
that NetBSD-1.5.2's <sys/socket.h> does not define socklen_t; and so
tools/compat/compat_defs.h defines socklen_t as "int"; but this does not
match the "unsigned int" that <sys/socket.h> and <netdb.h> really want
to use.
>How-To-Repeat:
1. have a NetBSD-1.5.2 host
2. check out a NetBSD-2.0.2 source tree
3. sh ./build.sh tools
>Fix:
Unknown.
Note that in NetBSD-1.5.2, this fails with errors about u_char
and u_short being undefined:
#define _POSIX_SOURCE 1
#include <sys/types.h>
#include <sys/socket.h>
I don't know whether it's a bug in NetBSD-1.5.2 that the above fails, or
a bug in tools/compat/configure that it tries to use a construct similar
to the above.