Subject: Re: macos X cross compile broken with HAVE_GCC3=yes
To: None <tech-toolchain@netbsd.org>
From: Darrin B. Jewell <dbj@netbsd.org>
List: tech-toolchain
Date: 10/06/2003 01:15:34
Well, I've found that if I set HOST_CFLAGS=-no-cpp-precomp in
Makefile.gnuhost, netbsd-current will cross compile on netbsd-current.
I have included a proposed patch below, although I'm not sure that
this is the correct fix.
I first tried to include ${COMPATOBJ}/defs.mk in Makefile.gnuhost,
similar to Makefile.host, but ran into problems with the compat
library colliding with native support for similar features such as
readline. I then tried to set HOST_CPPFLAGS, as is done inside
defs.mk, but discovered that the gnu tools do not always pay attention
to the CPPFLAGS environment variable being set when configure was run.
This patch sets HOST_CFLAGS, which does appear to be correctly
incorporated by configure, and which allows build.sh tools to work
correctly when HAVE_GCC3 is either yes or no. Unfortunately, I
did notice from the debugging logs that setting HOST_CFLAGS
with this patch causes the -O option to be lost from the CFLAGS
variable when configure is invoked. I am not sure that this is
the optimal fix to my problem.
Does anyone have a better fix to suggest?
Darrin
Index: src/tools/Makefile.gnuhost
===================================================================
RCS file: /cvsroot/src/tools/Makefile.gnuhost,v retrieving revision
1.19 diff -u -u -r1.19 Makefile.gnuhost --- src/tools/Makefile.gnuhost
18 Jul 2003 08:26:12 -0000 1.19 +++ src/tools/Makefile.gnuhost 6 Oct
2003 05:06:13 -0000 @@ -17,6 +17,12 @@
.include <bsd.own.mk>
+# Disable use of pre-compiled headers on Darwin.
+BUILD_OSTYPE!= uname -s
+.if ${BUILD_OSTYPE} == "Darwin"
+HOST_CFLAGS+= -no-cpp-precomp
+.endif
+
GNUHOSTDIST?= ${.CURDIR}/../../gnu/dist/${MODULE}
FIND_ARGS+= \! \( -type d \( \
"Darrin B. Jewell" <dbj@netbsd.org> writes:
> The recent switch to HAVE_GCC3=yes for i386 has broken
> cross compiling when hosted on macos X.
>
> The same tree compiles fine if I put HAVE_GCC3=no in mk.conf
>
> The problem appears to be that -no-cpp-precomp is not being included
> on the command line when compiling gcc. It does appear to be used
> correctly when HAVE_GCC3=no. I have uploaded build logs to ftp.netbsd.org
>
> A log of the failed compile is at:
> ftp://ftp.netbsd.org/pub/NetBSD/misc/dbj/build.gcc3yes
>
> A log of the successful compile with HAVE_GCC3=no is at:
> ftp://ftp.netbsd.org/pub/NetBSD/misc/dbj/build.gcc3no
>
> I am using the Dec 2002 developer tools on MacOS X 10.2.6
> This is a clean netbsd-current source tree updated via CVS
> on approximately 20030929T2022Z
>
> I could use some help in unraveling the build system enough
> to understand what is wrong and getting it fixed.
>
> Thanks,
> Darrin