Patchwork Two build != host fixes

login
register
mail settings
Submitter Alan Modra
Date March 27, 2014, 4:18 a.m.
Message ID <20140327041812.GT18201@bubble.grove.modra.org>
Download mbox | patch
Permalink /patch/334196/
State New
Headers show

Comments

Alan Modra - March 27, 2014, 4:18 a.m.
On Wed, Mar 26, 2014 at 09:43:08PM +0000, Maciej W. Rozycki wrote:
> Alan,
> 
> On Tue, 17 Dec 2013, Alan Modra wrote:
> 
> > On Tue, Dec 17, 2013 at 01:14:23PM +0100, Bernd Edlinger wrote:
> > > the reason for this is overwriting GMPINC for the auto-build generation, because
> > > many test scripts include <gmp.h> which fails now completely (it is not installed,
> > > I have it in-tree).
> > 
> > Yes, I understand the reason why your setup is failing.  Please try
> > this patch.
> > 
> > Index: gcc/configure.ac
> > ===================================================================
> > --- gcc/configure.ac	(revision 206009)
> > +++ gcc/configure.ac	(working copy)
> > @@ -1529,8 +1529,13 @@
> >  	/* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
> >  	*) realsrcdir=../${srcdir};;
> >  	esac
> > +	# Clearing GMPINC is necessary to prevent host headers being
> > +	# used by the build compiler.  Defining GENERATOR_FILE stops
> > +	# system.h from including gmp.h.
> >  	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
> > -	LDFLAGS="${LDFLAGS_FOR_BUILD}" GMPINC="" \
> > +	CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
> > +	LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
> > +	GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
> >  	${realsrcdir}/configure \
> >  		--enable-languages=${enable_languages-all} \
> >  		--target=$target_alias --host=$build_alias --build=$build_alias
> 
>  Can you please backport this change to 4.8 too, to fix the build 
> regression discussed here introduced by the previous change that did get 
> backported?

Oops, I'd forgotten that the first patch had gone on the branch..
Backported and regression tested.  OK to apply?

2014-03-27  Alan Modra  <amodra@gmail.com>

	Apply from mainline
	2014-01-28  Alan Modra  <amodra@gmail.com>
	* Makefile.in (BUILD_CPPFLAGS): Do not use ALL_CPPFLAGS.
	* configure.ac <recursive call for build != host>: Define
	GENERATOR_FILE.  Comment.  Use CXX_FOR_BUILD, CXXFLAGS_FOR_BUILD
	and LD_FOR_BUILD too.
	* configure: Regenerate.
Jeff Law - April 4, 2014, 3:47 p.m.
On 03/26/14 22:18, Alan Modra wrote:
> On Wed, Mar 26, 2014 at 09:43:08PM +0000, Maciej W. Rozycki wrote:
>> Alan,
>>
>> On Tue, 17 Dec 2013, Alan Modra wrote:
>>
>>> On Tue, Dec 17, 2013 at 01:14:23PM +0100, Bernd Edlinger wrote:
>>>> the reason for this is overwriting GMPINC for the auto-build generation, because
>>>> many test scripts include <gmp.h> which fails now completely (it is not installed,
>>>> I have it in-tree).
>>>
>>> Yes, I understand the reason why your setup is failing.  Please try
>>> this patch.
>>>
>>> Index: gcc/configure.ac
>>> ===================================================================
>>> --- gcc/configure.ac	(revision 206009)
>>> +++ gcc/configure.ac	(working copy)
>>> @@ -1529,8 +1529,13 @@
>>>   	/* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
>>>   	*) realsrcdir=../${srcdir};;
>>>   	esac
>>> +	# Clearing GMPINC is necessary to prevent host headers being
>>> +	# used by the build compiler.  Defining GENERATOR_FILE stops
>>> +	# system.h from including gmp.h.
>>>   	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
>>> -	LDFLAGS="${LDFLAGS_FOR_BUILD}" GMPINC="" \
>>> +	CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
>>> +	LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
>>> +	GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
>>>   	${realsrcdir}/configure \
>>>   		--enable-languages=${enable_languages-all} \
>>>   		--target=$target_alias --host=$build_alias --build=$build_alias
>>
>>   Can you please backport this change to 4.8 too, to fix the build
>> regression discussed here introduced by the previous change that did get
>> backported?
>
> Oops, I'd forgotten that the first patch had gone on the branch..
> Backported and regression tested.  OK to apply?
>
> 2014-03-27  Alan Modra  <amodra@gmail.com>
>
> 	Apply from mainline
> 	2014-01-28  Alan Modra  <amodra@gmail.com>
> 	* Makefile.in (BUILD_CPPFLAGS): Do not use ALL_CPPFLAGS.
> 	* configure.ac <recursive call for build != host>: Define
> 	GENERATOR_FILE.  Comment.  Use CXX_FOR_BUILD, CXXFLAGS_FOR_BUILD
> 	and LD_FOR_BUILD too.
> 	* configure: Regenerate.
Yes, this is fine.

jeff
>

Patch

Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 208856)
+++ gcc/Makefile.in	(working copy)
@@ -747,7 +747,8 @@ 
 
 # Native linker and preprocessor flags.  For x-fragment overrides.
 BUILD_LDFLAGS=@BUILD_LDFLAGS@
-BUILD_CPPFLAGS=$(ALL_CPPFLAGS)
+BUILD_CPPFLAGS= -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
+		-I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS)
 
 # Actual name to use when installing a native compiler.
 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 208856)
+++ gcc/configure.ac	(working copy)
@@ -1516,8 +1516,13 @@ 
 	/* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
 	*) realsrcdir=../${srcdir};;
 	esac
+	# Clearing GMPINC is necessary to prevent host headers being
+	# used by the build compiler.  Defining GENERATOR_FILE stops
+	# system.h from including gmp.h.
 	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
-	LDFLAGS="${LDFLAGS_FOR_BUILD}" GMPINC="" \
+	CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
+	LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
+	GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
 	${realsrcdir}/configure \
 		--enable-languages=${enable_languages-all} \
 		--target=$target_alias --host=$build_alias --build=$build_alias