Subject: Cygwin NetBSD cross tools
To: None <tech-toolchain@netbsd.org>
From: Jesse Off <joff@embeddedARM.com>
List: tech-toolchain
Date: 06/16/2006 10:41:08
I've been attempting to use Windows with Cygwin to compile NetBSD. I wanted
to "seed" the inevitable Google search our customers will be doing when they
attempt the same with NetBSD on our products by offering some tidbits of
information. The current information google returns is a bit out-dated.
*) The top-level "build.sh" shell script in the NetBSD source distribution
needs a small modification on cygwin because cygwin's /bin/pwd does not
support -P:
--- build.sh.orig 2006-06-16 10:00:25.812500000 -0700
+++ build.sh 2006-06-16 10:05:13.468750000 -0700
@@ -89,6 +89,12 @@
unset PWD
TOP=$(/bin/pwd -P 2>/dev/null)
+ # Some systems do not support the -P option to /bin/pwd
+ #
+ if [ -z "$TOP" ]; then
+ TOP=$(/bin/pwd 2>/dev/null)
+ fi
+
# Set defaults.
#
toolprefix=nb
*) I'd recommend normalizing your PATH while in cygwin to /bin:/usr/bin e.g.
export PATH=/bin:/usr/bin I had some programs in my path that happened to
conflict with some of the tools used in the build.
*) Make sure you get the "minires-devel" package from Cygwin or else you
will get a tools build failure in asn1_compile. That build will be looking
for the "resolv.h" and "nameser.h" include files that come with that package
and I don't think that package is selected by default when installing
cygwin.
*) The current Cygwin distribution as of 6/16/2006 has a problem with the
cygwin /usr/include/sys/stdio.h-- It includes an unconditional declaration
of getline(). This has been fixed in the current Cygwin CVS for many
months, but hasn't made it to a release yet. You can do the modification
yourself to this file:
--- stdio.h.orig 2006-06-16 10:31:46.187500000 -0700
+++ stdio.h 2006-06-16 09:51:16.421875000 -0700
@@ -28,8 +28,10 @@
__BEGIN_DECLS
+#ifdef _GNU_SOURCE
ssize_t _EXFUN(getline, (char **, size_t *, FILE *));
ssize_t _EXFUN(getdelim, (char **, size_t *, int, FILE *));
+#endif /* _GNU_SOURCE */
__END_DECLS
*) Due to the nature of the Windows filesystem you can't e.g. have both a
'CVS' dir and a 'cvs' executable in the same directory. This will cause
build problems
when traversing the cleandir rule of cvs where it tried to "rm -f *.o blah
blah cvs". The build will fail with "Can't remove cvs -- is a directory" I
fixed this by just recursively removing the 'CVS' directories in the source
dist-- you don't really need them unless you want to track future CVS
changes. You can do that with this command from the top-level directory:
find . -type d -name 'CVS' | xargs rm -rf
With the above worked around, I was successfully able to build the cross
tools and also use ./build.sh to compile a kernel for evbarm (./build.sh -m
evbarm kernel=TS7200) I haven't attempted to make release yet so there may
be some more unknown issues there.
//Jesse Off