Subject: Re: cross-building from Cygwin: host tool problems
To: Thomas Klausner <wiz@NetBSD.org>
From: John Gordon <mailing.lists@dial.pipex.com>
List: tech-toolchain
Date: 09/10/2003 00:29:13
Hello,

Checkout the patch I made a while ago that did all of this and build the 
full system under Windows. It can be found at:

http://www.bluedonkey.org/cgi-bin/twiki/bin/view/Netbsd/CygwinBuild

It is probably a little out of date as I haven't maintained it against 
-current, but most should be still useful. Also, some of the changes 
have been incorporated into the CVS code base since this was first 
published (so some parts of the patch may be unnecessary).

HTH,
John...

Thomas Klausner wrote:

> 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
> 

-- 
John Gordon
- VxWorks, NetBSD, PalmOS & more             http://www.bluedonkey.org