Subject: Re: kern/12298: fairly impressive cross-compilation bogon in sys/lib/libsa/tftp.c
To: Todd Vierling <>
From: Chris G. Demetriou <>
List: netbsd-bugs
Date: 02/28/2001 17:45:34
Todd Vierling <> writes:
> There are NetBSD target environments that have *no* userland, and thus,
> really shouldn't need src/include.

while this is mostly true, in practice it may fall down a bit for
"BSD-ish" systems with current development GCC (and perhaps previous
version; i've never tried them).

This may have been an issue with my configuration of GCC, but since
the stock configuration for NetBSD-on-mips in the master GCC
repository ... "doesn't work" (at least as of 2001-01-03), I don't
know that i call it a bug only of mine.  8-)

Anyway, for most OS targets (e.g. linux), the way I build cross
compilers is:

	(1) configure GCC with "LANGUAGES=c" and built it with the
	    following make variables set:


	    That gets you a cross-compiler with libgcc, which on most
	    systems doesn't depend on the target system's OS headers
	    to build.

	(2) you then build and install the target OS includes, and
            build and install the 'basic' target OS libs (i.e., those
            that can be built with only a C compiler).  (really, to
            the second gcc build mentioned below happy, all you
            probably _really_ need are C and threads libraries &
            include, but i'm not really sure on that.  8-)

	(3) you then go back and build gcc in its full g(l)ory: all
	    the languages that you want, all the target libs, etc.

	(4) you then build the rest of the target os libs.

If you want a kernel-only build environment, you could stop after (1).

I ran into problems where even if USER_H cleared out most of GCC's
headers, the libgcc build would still try to use gcc's <stddef.h>,
which does:

/* On 4.3bsd-net2, make sure ansi.h is included, so we have
   one less case to deal with in the following.  */
#if defined (__BSD_NET2__) || defined (____386BSD____) || defined
|| defined(__NetBSD__)
#include <machine/ansi.h>

That required me install NetBSD includes, as step "(0)" of the list
above.  8-)

I know you're also doing compiler stuff, Todd, something to think
about...  8-)

Chris Demetriou - -
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.