Subject: toolchain/20699: Build vs. Host mixup when compiling gnu/usr.bin/gcc
To: None <>
From: None <>
List: netbsd-bugs
Date: 03/13/2003 18:36:51
>Number:         20699
>Category:       toolchain
>Synopsis:       Build vs. Host mixup when compiling gnu/usr.bin/gcc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 13 18:37:00 PST 2003
>Originator:     Jason R Thorpe
>Release:        NetBSD 1.6P
Wasabi Systems, Inc.
System: Darwin 6.4 Darwin Kernel Version 6.4: Wed Jan 29 18:50:42 PST 2003; root:xnu/xnu-344.26.obj~1/RELEASE_PPC  Power Macintosh powerpc
Architecture: powerpc
Machine: Power Macintosh

	Cross-compiling the NetBSD source tree from Mac OS X, I
	encountered a latent bug in how we build the native GCC
	for the target.

	When we build GCC, a few small host programs must be build,
	e.g. gengenrtl, genpeep, etc.  These programs include the
	"hconfig.h" header file, which maps to "config.h" for the
	"native" compiler build.  The "config.h" that gets included
	is one appropriate for the target NetBSD system, not the
	host on which the compiler is being compiled.

	Build in src/gnu/dist/usr.bin/gcc/backend on a Mac OS X system:

cc -O -I. ... -o genpeep ...
ld: Undefined symbols:
*** Error code 1

	This is somewhat complicated to untangle.  Solving it "for real"
	may require modifying the GCC host helper programs to use pure
	ANSI C, and skip some of the tricks it plays with which system-
	provided functions are used.