Subject: cross-building from Cygwin: host tool problems
To: None <tech-toolchain@NetBSD.org>
From: Thomas Klausner <wiz@NetBSD.org>
List: tech-toolchain
Date: 09/09/2003 16:11:28
Hi!

For testing a patch I set up a Cygwin environment to build NetBSD.

I stumbled over the following problems with building the host tools:

1) The bootstrap nbmake created by Cygwin is called nbmake.exe and not nbmake;
   the 'cp' (=install) step thus fails.
   Workaround: add .exe; perhaps depending on uname -s output.

2) If bootstrap nbmake is built and installed successfully and the
   build is restarted with
	./build.sh -u -T i386/tools -O i386/obj -m i386 tools
   I get:
	nbmake: "/cygdrive/c/temp/nb/tools/makefile" line 74: warning: "cat PREVIOUSTOOLDIR" returned non-zero status
   which leads to automatic 'make cleandir' in tools/ even if I
   have the same tooldir as previously.
   I'm not sure when exactly this happens, it does not happen on each restart.
   Workaround: remove the 'make cleandir' line.

3) group_from_gid is in /usr/include/grp.h, but not in /usr/lib/*;
   leads to conflict between compat_defs.h and grp.h (const char *
   vs char * as return type)
   Workaround: #ifndef __CYGWIN__ the definition in compat_defs.h

4) lib/libc/stdio/gettemp.c includes "reentrant.h" which is not provided.
   Workaround: remove inclusion; or add dummy reentrant.h.

5) lib/libc/gen/pwcache.c has const char *group_from_gid, while /usr/include/grp.h
   has its return value as char * (see 3 above).
   Workaround: #ifdef __CYGWIN__

6) asn1_compile's gen.c includes roken.h, which tries to include arpa/nameser.h and
   resolv.h, which don't exist on Cygwin.
   Workaround: #ifndef __CYGWIN__

7) config: _PATH_UNIX is not defined.
   Solution: define in compat_defs.h?

8) groff has some endless cycle that starts like this:
test -f grnexmpl.g || cp /cygdrive/c/temp/nb/gnu/dist/groff/doc/grnexmpl.g .
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.comm' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.sub' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.comm' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/src/include/Makefile.sub' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.man' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.comm' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/src/libs/libgroff/Makefile.sub' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.lib' is up to date.
`Makefile.dep' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.comm' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/src/libs/libdriver/Makefile.sub' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.lib' is up to date.
`Makefile.dep' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.comm' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/src/libs/libbib/Makefile.sub' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.lib' is up to date.
`Makefile.dep' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.comm' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/src/roff/groff/Makefile.sub' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.ccpg' is up to date.
`Makefile.dep' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.comm' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/src/roff/troff/Makefile.sub' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.ccpg' is up to date.
`Makefile.dep' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.comm' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/src/preproc/tbl/Makefile.sub' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.ccpg' is up to date.
`Makefile.dep' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.comm' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/src/preproc/pic/Makefile.sub' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.ccpg' is up to date.
`Makefile.dep' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.comm' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/src/preproc/eqn/Makefile.sub' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.ccpg' is up to date.
`Makefile.dep' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.comm' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/src/preproc/grn/Makefile.sub' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.ccpg' is up to date.
`Makefile.dep' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.comm' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/src/preproc/refer/Makefile.sub' is up to date.
`/cygdrive/c/temp/nb/gnu/dist/groff/Makefile.ccpg' is up to date.
`Makefile.dep' is up to date.
and so on. Haven't looked yet where this comes from.

I'd welcome suggestions on the correct way to fix these problems.
 Thomas