Subject: toolchain/36165: Cross build of NetBSD/i386 on Windows XP with Cygwin fails for tools/sed
To: None <toolchain-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <bsh@netbsd.org>
List: netbsd-bugs
Date: 04/17/2007 20:20:00
>Number:         36165
>Category:       toolchain
>Synopsis:       Cross build of NetBSD/i386 on Windows XP with Cygwin fails for tools/sed
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 17 20:20:00 +0000 2007
>Originator:     Hiroyuki Bessho
>Release:        NetBSD-current as of 2007-Apr-16
>Organization:
>Environment:
System: CYGWIN_NT-5.1 takanoha 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin
Architecture: i386
Machine: i386
>Description:
	Cross build of NetBSD/i386 on WIndows XP with Cygwin 1.5.24 fails while compiling sed as a host tool.

===> build.sh command: ./build.sh -mi386 -U -D../destdir.i386 -T../tools -uo tools
===> build.sh started: Tue Apr 17 10:03:13     2007
===> NetBSD version:   4.99.17
===> MACHINE:          i386
===> MACHINE_ARCH:     i386
===> Build platform:   CYGWIN_NT-5.1 1.5.24(0.156/4/2) i686
===> HOST_SH:          /usr/bin/sh
===> TOOLDIR path:     /cygdrive/e/nb/current/src/../tools
===> DESTDIR path:     /cygdrive/e/nb/current/src/../destdir.i386
===> RELEASEDIR path:  /cygdrive/e/nb/current/src/releasedir
===> makewrapper:      /cygdrive/e/nb/current/src/../tools/bin/nbmake-i386
===> Updated /cygdrive/e/nb/current/src/../tools/bin/nbmake-i386
echo /cygdrive/e/nb/current/src/../tools >PREVIOUSTOOLDIR
dependall ===> host-mkdep
install ===> host-mkdep
dependall ===> compat

[snip]

dependall ===> sed
#    create  sed/compile.d
/cygdrive/e/nb/current/src/../tools/bin/nbhost-mkdep -f compile.d --     -I/cygdrive/e/nb/current/src/tools/compat/obj.i386 -I/cygdrive/e/nb/current/src/tools/compat/obj.i386/include  -I/cygdrive/e/nb/current/src/tools/sed/../compat -DHAVE_NBTOOL_CONFIG_H=1  -D_FILE_OFFSET_BITS=64   /cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c
#    create  sed/main.d
/cygdrive/e/nb/current/src/../tools/bin/nbhost-mkdep -f main.d --     -I/cygdrive/e/nb/current/src/tools/compat/obj.i386 -I/cygdrive/e/nb/current/src/tools/compat/obj.i386/include  -I/cygdrive/e/nb/current/src/tools/sed/../compat -DHAVE_NBTOOL_CONFIG_H=1  -D_FILE_OFFSET_BITS=64   /cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/main.c
#    create  sed/misc.d
/cygdrive/e/nb/current/src/../tools/bin/nbhost-mkdep -f misc.d --     -I/cygdrive/e/nb/current/src/tools/compat/obj.i386 -I/cygdrive/e/nb/current/src/tools/compat/obj.i386/include  -I/cygdrive/e/nb/current/src/tools/sed/../compat -DHAVE_NBTOOL_CONFIG_H=1  -D_FILE_OFFSET_BITS=64   /cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/misc.c
#    create  sed/process.d
/cygdrive/e/nb/current/src/../tools/bin/nbhost-mkdep -f process.d --     -I/cygdrive/e/nb/current/src/tools/compat/obj.i386 -I/cygdrive/e/nb/current/src/tools/compat/obj.i386/include  -I/cygdrive/e/nb/current/src/tools/sed/../compat -DHAVE_NBTOOL_CONFIG_H=1  -D_FILE_OFFSET_BITS=64   /cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/process.c
#    create  sed/.depend
rm -f .depend
/cygdrive/e/nb/current/src/../tools/bin/nbhost-mkdep -d -f .depend -s .lo\ .ln compile.d main.d misc.d process.d
#   compile  sed/compile.lo
cc -O -I/cygdrive/e/nb/current/src/tools/compat/obj.i386 -I/cygdrive/e/nb/current/src/tools/compat/obj.i386/include  -I/cygdrive/e/nb/current/src/tools/sed/../compat -DHAVE_NBTOOL_CONFIG_H=1  -D_FILE_OFFSET_BITS=64  -c -o compile.lo.o    /cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c
/cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c: In function `compile_stream':
/cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c:192: error: `_POSIX2_LINE_MAX' undeclared (first use in this function)
/cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c:192: error: (Each undeclared identifier is reported only once
/cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c:192: error: for each function it appears in.)
/cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c:192: error: storage size of `lbuf' isn't known
/cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c: In function `compile_re':
/cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c:458: error: `_POSIX2_LINE_MAX' undeclared (first use in this function)
/cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c: In function `compile_subst':
/cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c:481: error: `_POSIX2_LINE_MAX' undeclared (first use in this function)
/cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c:481: error: storage size of `lbuf' isn't known
/cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c: In function `compile_flags':
/cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c:562: error: `_POSIX2_LINE_MAX' undeclared (first use in this function)
/cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c: In function `compile_tr':
/cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c:637: error: `_POSIX2_LINE_MAX' undeclared (first use in this function)
/cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c: In function `compile_text':
/cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c:676: error: `_POSIX2_LINE_MAX' undeclared (first use in this function)

*** Failed target:  compile.lo
*** Failed command: cc -O -I/cygdrive/e/nb/current/src/tools/compat/obj.i386 -I/cygdrive/e/nb/current/src/tools/compat/obj.i386/include -I/cygdrive/e/nb/current/src/tools/sed/../compat -DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -c -o compile.lo.o /cygdrive/e/nb/current/src/tools/sed/../../usr.bin/sed/compile.c
*** Error code 1

Stop.
nbmake: stopped in /cygdrive/e/nb/current/src/tools/sed

*** Failed target:  dependall
*** Failed command: cd /cygdrive/e/nb/current/src/tools/sed; /cygdrive/e/nb/current/src/../tools/bin/nbmake realall
*** Error code 1

Stop.
nbmake: stopped in /cygdrive/e/nb/current/src/tools/sed

*** Failed target:  dependall-sed
*** Failed command: _makedirtarget() { dir="$1"; shift; target="$1"; shift; case "${dir}" in /*) this="${dir}/"; real="${dir}" ;; .) this=""; real="/cygdrive/e/nb/current/src/tools" ;; *) this="${dir}/"; real="/cygdrive/e/nb/current/src/tools/${dir}" ;; esac; show=${this:-.}; echo "${target} ===> ${show%/}${1:+ (with: $@)}"; cd "${real}" && /cygdrive/e/nb/current/src/../tools/bin/nbmake _THISDIR_="${this}" "$@" ${target}; }; _makedirtarget sed dependall
*** Error code 1

Stop.
nbmake: stopped in /cygdrive/e/nb/current/src/tools

ERROR: Failed to make dependall tools
*** BUILD ABORTED ***
>How-To-Repeat:
	run "build.sh tools"  (This happens after 36159/toolchain is fixed)
>Fix:

	Cygwin doesn't have _POSIX2_LINE_MAX in <limits.h>

Index: tools/compat/compat_defs.h
===================================================================
RCS file: /u0/cvsupbase/cvsroot-netbsd/src/tools/compat/compat_defs.h,v
retrieving revision 1.58
diff -u -r1.58 compat_defs.h
--- tools/compat/compat_defs.h	9 Jan 2007 17:34:27 -0000	1.58
+++ tools/compat/compat_defs.h	17 Apr 2007 20:08:09 -0000
@@ -499,6 +499,10 @@
 #define LLONG_MIN ((long long)(~LLONG_MAX))
 #endif
 
+#ifndef	_POSIX2_LINE_MAX
+#define	_POSIX2_LINE_MAX	2048
+#endif
+
 /* <paths.h> */
 
 /* The host's _PATH_BSHELL might be broken, so override it. */