public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Two build != host fixes
@ 2013-12-11 11:10 Bernd Edlinger
  2013-12-11 12:42 ` Alan Modra
  0 siblings, 1 reply; 43+ messages in thread
From: Bernd Edlinger @ 2013-12-11 11:10 UTC (permalink / raw)
  To: Alan Modra; +Cc: gcc-patches, Jakub Jelinek, DJ Delorie

[-- Attachment #1: Type: text/plain, Size: 1291 bytes --]

Hi,

I'm having problems with that patch.

I try to start at X86_64-linux-gnu, and I want to get the GCC running on arm-linux-gnueabihf.
I grabbed system headers and libraries from the target and put it in the prefix path.

In the first step I do

../gcc-4.9-20131208/configure --prefix=/home/ed/gnu/arm-linux-gnueabihf-linux64 --target=arm-linux-gnueabihf --enable-languages=c,c++,fortran --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3-d16 --with-float=hard

This GCC runs on PC and generates arm-linux-gnueabihf executables.

Then I try this

../gcc-4.9-20131208/configure --prefix=/home/ed/gnu/arm-linux-gnueabihf-cross --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --enable-languages=c,c++,fortran --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3-d16 --with-float=hard

But It fails because auto-build.h contains nonsense. That is probably because almost every check
has a fatal error #include <gmp.h> not found.

I personally prefer to have gmp, mpfr, mpc in-tree (using contrib/download_prerequisites).

I experimented a bit and at least this attached patch improves the situation for me.

Maybe I never had any problems with GMP before, because the in-tree configuration of GMP does -DNO_ASM ?



Regards
Bernd. 		 	   		  

[-- Attachment #2: patch-configure.diff --]
[-- Type: application/octet-stream, Size: 1038 bytes --]

--- gcc/configure.orig	2013-12-05 08:11:17.000000000 +0100
+++ gcc/configure	2013-12-11 09:36:03.628779968 +0100
@@ -11288,7 +11288,8 @@ else
 	*) realsrcdir=../${srcdir};;
 	esac
 	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
-	LDFLAGS="${LDFLAGS_FOR_BUILD}" GMPINC="" \
+	CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
+	LDFLAGS="${LDFLAGS_FOR_BUILD}" \
 	${realsrcdir}/configure \
 		--enable-languages=${enable_languages-all} \
 		--target=$target_alias --host=$build_alias --build=$build_alias
--- gcc/configure.ac.orig	2013-12-05 08:11:17.000000000 +0100
+++ gcc/configure.ac	2013-12-11 08:59:36.064751311 +0100
@@ -1530,7 +1530,8 @@ else
 	*) realsrcdir=../${srcdir};;
 	esac
 	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
-	LDFLAGS="${LDFLAGS_FOR_BUILD}" GMPINC="" \
+	CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
+	LDFLAGS="${LDFLAGS_FOR_BUILD}" \
 	${realsrcdir}/configure \
 		--enable-languages=${enable_languages-all} \
 		--target=$target_alias --host=$build_alias --build=$build_alias

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-11 11:10 Two build != host fixes Bernd Edlinger
@ 2013-12-11 12:42 ` Alan Modra
  2013-12-11 13:11   ` Bernd Edlinger
  0 siblings, 1 reply; 43+ messages in thread
From: Alan Modra @ 2013-12-11 12:42 UTC (permalink / raw)
  To: Bernd Edlinger; +Cc: gcc-patches, Jakub Jelinek, DJ Delorie

On Wed, Dec 11, 2013 at 12:10:04PM +0100, Bernd Edlinger wrote:
> Hi,
> 
> I'm having problems with that patch.

Sorry to hear that.

> I try to start at X86_64-linux-gnu, and I want to get the GCC running on arm-linux-gnueabihf.
> I grabbed system headers and libraries from the target and put it in the prefix path.
> 
> In the first step I do
> 
> ../gcc-4.9-20131208/configure --prefix=/home/ed/gnu/arm-linux-gnueabihf-linux64 --target=arm-linux-gnueabihf --enable-languages=c,c++,fortran --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3-d16 --with-float=hard
> 
> This GCC runs on PC and generates arm-linux-gnueabihf executables.
> 
> Then I try this
> 
> ../gcc-4.9-20131208/configure --prefix=/home/ed/gnu/arm-linux-gnueabihf-cross --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --enable-languages=c,c++,fortran --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3-d16 --with-float=hard
> 
> But It fails because auto-build.h contains nonsense. That is probably because almost every check
> has a fatal error #include <gmp.h> not found.
> 
> I personally prefer to have gmp, mpfr, mpc in-tree (using contrib/download_prerequisites).
> 
> I experimented a bit and at least this attached patch improves the situation for me.
> 
> Maybe I never had any problems with GMP before, because the in-tree configuration of GMP does -DNO_ASM ?

GMPINC really shouldn't be used to find build headers, since it is used
to find host headers.  See the top level Makefile.in.  When gmp has
been installed, using GMPINC means you pull in a whole lot of host
headers for the build compiler.  Which might work in rare cases, but
it's a lot more likely to fail.  Even with in-tree gmp, how do you get
things like GMP_LIMB_BITS correct if your build machine is 64-bit and
your host is 32-bit?  (Perhaps there is some build magic that allows
this to work, I'll investigate when I get back from vacation.)

Incidentally, we've been using a couple of other patches for
build != host that I haven't posted because I wasn't sure who authored
them.  It's possible the first one might help you.

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index aad927c..7995e64 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -747,7 +747,8 @@ BUILD_LINKERFLAGS = $(BUILD_CXXFLAGS)
 
 # 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 $(CPPINC)
 
 # Actual name to use when installing a native compiler.
 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index 57f9009..e1d3ed6 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -625,7 +625,7 @@ ada.tags: force
 ada/doctools/xgnatugn$(build_exeext): ada/xgnatugn.adb
 	-$(MKDIR) ada/doctools
 	$(CP) $^ ada/doctools
-	cd ada/doctools && $(GNATMAKE) -q xgnatugn
+	cd ada/doctools && gnatmake -q xgnatugn
 
 # Note that doc/gnat_ugn.texi and doc/projects.texi do not depend on
 # xgnatugn being built so we can distribute a pregenerated doc/gnat_ugn.info
diff --git a/gnattools/Makefile.in b/gnattools/Makefile.in
index 794d374..6b0d5e8 100644
--- a/gnattools/Makefile.in
+++ b/gnattools/Makefile.in
@@ -23,6 +23,7 @@ SHELL = @SHELL@
 srcdir = @srcdir@
 libdir = @libdir@
 build = @build@
+host = @host@
 target = @target@
 prefix = @prefix@
 INSTALL = @INSTALL@
@@ -31,6 +32,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 
 # Nonstandard autoconf-set variables.
 LN_S=@LN_S@
+host_alias=@host_alias@
 target_noncanonical=@target_noncanonical@
 
 # Variables for the user (or the top level) to override.
@@ -183,7 +185,11 @@ regnattools: $(GCC_DIR)/stamp-gnatlib-rts
 # put the host RTS dir first in the PATH to hide the default runtime
 # files that are among the sources
 # FIXME: This should be done in configure.
+ifeq ($(host), $(build))
 RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib )))
+else
+RTS_DIR:=$(strip $(subst \,/,$(shell $(host_alias)-gnatls -v | grep adalib )))
+endif
 gnattools-cross: $(GCC_DIR)/stamp-tools
 	# gnattools1-re
 	$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 43+ messages in thread

* RE: Two build != host fixes
  2013-12-11 12:42 ` Alan Modra
@ 2013-12-11 13:11   ` Bernd Edlinger
  2013-12-11 13:32     ` Iain Sandoe
  2013-12-12  1:02     ` Alan Modra
  0 siblings, 2 replies; 43+ messages in thread
From: Bernd Edlinger @ 2013-12-11 13:11 UTC (permalink / raw)
  To: Alan Modra; +Cc: gcc-patches, Jakub Jelinek, DJ Delorie

On Wed, 11 Dec 2013 23:11:46, Alan Modra wrote:
>
> On Wed, Dec 11, 2013 at 12:10:04PM +0100, Bernd Edlinger wrote:
>> Hi,
>>
>> I'm having problems with that patch.
>
> Sorry to hear that.
>

Never mind.

I have similar patches, but I did not 
>> I try to start at X86_64-linux-gnu, and I want to get the GCC running on arm-linux-gnueabihf.
>> I grabbed system headers and libraries from the target and put it in the prefix path.
>>
>> In the first step I do
>>
>> ../gcc-4.9-20131208/configure --prefix=/home/ed/gnu/arm-linux-gnueabihf-linux64 --target=arm-linux-gnueabihf --enable-languages=c,c++,fortran --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3-d16 --with-float=hard
>>
>> This GCC runs on PC and generates arm-linux-gnueabihf executables.
>>
>> Then I try this
>>
>> ../gcc-4.9-20131208/configure --prefix=/home/ed/gnu/arm-linux-gnueabihf-cross --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --enable-languages=c,c++,fortran --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3-d16 --with-float=hard
>>
>> But It fails because auto-build.h contains nonsense. That is probably because almost every check
>> has a fatal error #include <gmp.h> not found.
>>
>> I personally prefer to have gmp, mpfr, mpc in-tree (using contrib/download_prerequisites).
>>
>> I experimented a bit and at least this attached patch improves the situation for me.
>>
>> Maybe I never had any problems with GMP before, because the in-tree configuration of GMP does -DNO_ASM ?
>
> GMPINC really shouldn't be used to find build headers, since it is used
> to find host headers. See the top level Makefile.in. When gmp has
> been installed, using GMPINC means you pull in a whole lot of host
> headers for the build compiler. Which might work in rare cases, but
> it's a lot more likely to fail. Even with in-tree gmp, how do you get
> things like GMP_LIMB_BITS correct if your build machine is 64-bit and
> your host is 32-bit? (Perhaps there is some build magic that allows
> this to work, I'll investigate when I get back from vacation.)
>

I do not know, but until last week the only problem was a missing SSIZE_MAX
in gcc/config/host-linux.c (glimits.h does not define this, and fix-include replaced mine!)

We need the auto-build only to build something that translates .md files to .c,
so I would'nt care about GMP, but some other things, like the right prototype for
printf make a difference.

now the auto-build.h has 
#define HAVE_DECL_SBRK 0

last week that was
#define HAVE_DECL_SBRK 1

I can give you my sys-root files, and you can play with it if you like.


> Incidentally, we've been using a couple of other patches for
> build != host that I haven't posted because I wasn't sure who authored
> them. It's possible the first one might help you.
>
> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> index aad927c..7995e64 100644
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -747,7 +747,8 @@ BUILD_LINKERFLAGS = $(BUILD_CXXFLAGS)
>
> # 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 $(CPPINC)
>

I did not have this one.
What is it good for?

> # Actual name to use when installing a native compiler.
> GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
> diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
> index 57f9009..e1d3ed6 100644
> --- a/gcc/ada/gcc-interface/Make-lang.in
> +++ b/gcc/ada/gcc-interface/Make-lang.in
> @@ -625,7 +625,7 @@ ada.tags: force
> ada/doctools/xgnatugn$(build_exeext): ada/xgnatugn.adb
> -$(MKDIR) ada/doctools
> $(CP) $^ ada/doctools
> - cd ada/doctools && $(GNATMAKE) -q xgnatugn
> + cd ada/doctools && gnatmake -q xgnatugn
>

Yes, I also have that. It's a show-stopper for Ada.

> # Note that doc/gnat_ugn.texi and doc/projects.texi do not depend on
> # xgnatugn being built so we can distribute a pregenerated doc/gnat_ugn.info
> diff --git a/gnattools/Makefile.in b/gnattools/Makefile.in
> index 794d374..6b0d5e8 100644
> --- a/gnattools/Makefile.in
> +++ b/gnattools/Makefile.in
> @@ -23,6 +23,7 @@ SHELL = @SHELL@
> srcdir = @srcdir@
> libdir = @libdir@
> build = @build@
> +host = @host@
> target = @target@
> prefix = @prefix@
> INSTALL = @INSTALL@
> @@ -31,6 +32,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
>
> # Nonstandard autoconf-set variables.
> LN_S=@LN_S@
> +host_alias=@host_alias@
> target_noncanonical=@target_noncanonical@
>
> # Variables for the user (or the top level) to override.
> @@ -183,7 +185,11 @@ regnattools: $(GCC_DIR)/stamp-gnatlib-rts
> # put the host RTS dir first in the PATH to hide the default runtime
> # files that are among the sources
> # FIXME: This should be done in configure.
> +ifeq ($(host), $(build))
> RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib )))
> +else
> +RTS_DIR:=$(strip $(subst \,/,$(shell $(host_alias)-gnatls -v | grep adalib )))
> +endif
> gnattools-cross: $(GCC_DIR)/stamp-tools
> # gnattools1-re
> $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
>
> --
> Alan Modra
> Australia Development Lab, IBM 		 	   		  

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-11 13:11   ` Bernd Edlinger
@ 2013-12-11 13:32     ` Iain Sandoe
  2013-12-11 14:44       ` Eric Botcazou
  2013-12-12  1:02     ` Alan Modra
  1 sibling, 1 reply; 43+ messages in thread
From: Iain Sandoe @ 2013-12-11 13:32 UTC (permalink / raw)
  To: Bernd Edlinger; +Cc: Alan Modra, gcc-patches, Jakub Jelinek, DJ Delorie


On 11 Dec 2013, at 13:11, Bernd Edlinger wrote:
> I did not have this one.
> What is it good for?
> 
>> # Actual name to use when installing a native compiler.
>> GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
>> diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
>> index 57f9009..e1d3ed6 100644
>> --- a/gcc/ada/gcc-interface/Make-lang.in
>> +++ b/gcc/ada/gcc-interface/Make-lang.in
>> @@ -625,7 +625,7 @@ ada.tags: force
>> ada/doctools/xgnatugn$(build_exeext): ada/xgnatugn.adb
>> -$(MKDIR) ada/doctools
>> $(CP) $^ ada/doctools
>> - cd ada/doctools && $(GNATMAKE) -q xgnatugn
>> + cd ada/doctools && gnatmake -q xgnatugn
>> 
> 
> Yes, I also have that. It's a show-stopper for Ada.

I have some more fixes for Ada cross-builds that Eric commented on but need a little more work - will try to re-test this evening and re-post tomorrow.
Iain

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-11 13:32     ` Iain Sandoe
@ 2013-12-11 14:44       ` Eric Botcazou
  2013-12-12 12:11         ` Bernd Edlinger
  0 siblings, 1 reply; 43+ messages in thread
From: Eric Botcazou @ 2013-12-11 14:44 UTC (permalink / raw)
  To: Iain Sandoe
  Cc: gcc-patches, Bernd Edlinger, Alan Modra, Jakub Jelinek, DJ Delorie

[-- Attachment #1: Type: text/plain, Size: 238 bytes --]

> I have some more fixes for Ada cross-builds that Eric commented on but need
> a little more work - will try to re-test this evening and re-post tomorrow.

It's also PR ada/55946.  Would mind trying the attached patch?

-- 
Eric Botcazou

[-- Attachment #2: pr55946.diff --]
[-- Type: text/x-patch, Size: 2785 bytes --]

Index: gnattools/Makefile.in
===================================================================
--- gnattools/Makefile.in	(revision 205881)
+++ gnattools/Makefile.in	(working copy)
@@ -24,6 +24,8 @@ srcdir = @srcdir@
 libdir = @libdir@
 build = @build@
 target = @target@
+host = @host@
+host_alias= @host_alias@
 prefix = @prefix@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
@@ -92,6 +94,7 @@ TOOLS_FLAGS_TO_PASS_RE= \
 	"CC=../../xgcc -B../../" \
 	"CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \
 	"CFLAGS=$(CFLAGS)" \
+	"LDFLAGS=$(LDFLAGS)" \
 	"ADAFLAGS=$(ADAFLAGS)" \
 	"ADA_CFLAGS=$(ADA_CFLAGS)" \
 	"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
@@ -105,6 +108,22 @@ TOOLS_FLAGS_TO_PASS_RE= \
 	"TOOLSCASE=cross"
 
 # Variables for gnattools, cross
+ifeq ($(build), $(host))
+  GNATMAKE_FOR_HOST=gnatmake
+  GNATLINK_FOR_HOST=gnatlink
+  GNATBIND_FOR_HOST=gnatbind
+  GNATLS_FOR_HOST=gnatls
+else
+  GNATMAKE_FOR_HOST=$(host_alias)-gnatmake
+  GNATLINK_FOR_HOST=$(host_alias)-gnatlink
+  GNATBIND_FOR_HOST=$(host_alias)-gnatbind
+  GNATLS_FOR_HOST=$(host_alias)-gnatls
+endif
+
+# Put the host RTS dir first in the PATH to hide the default runtime
+# files that are among the sources
+RTS_DIR:=$(strip $(subst \,/,$(shell $(GNATLS_FOR_HOST) -v | grep adalib )))
+
 TOOLS_FLAGS_TO_PASS_CROSS= \
 	"CC=$(CC)" \
 	"CXX=$(CXX)" \
@@ -117,9 +136,9 @@ TOOLS_FLAGS_TO_PASS_CROSS= \
 	"exeext=$(exeext)" \
 	"fsrcdir=$(fsrcdir)" \
 	"srcdir=$(fsrcdir)" \
-	"GNATMAKE=gnatmake" \
-	"GNATLINK=gnatlink" \
-	"GNATBIND=gnatbind" \
+	"GNATMAKE=$(GNATMAKE_FOR_HOST)" \
+	"GNATLINK=$(GNATLINK_FOR_HOST)" \
+	"GNATBIND=$(GNATBIND_FOR_HOST)" \
 	"TOOLSCASE=cross" \
 	"LIBGNAT="
 
@@ -188,11 +207,6 @@ regnattools: $(GCC_DIR)/stamp-gnatlib-rt
 	$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
 	  $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools
 
-# For cross builds of gnattools,
-# put the host RTS dir first in the PATH to hide the default runtime
-# files that are among the sources
-# FIXME: This should be done in configure.
-RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib )))
 gnattools-cross: $(GCC_DIR)/stamp-tools
 	# gnattools1-re
 	$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
Index: gcc/ada/gcc-interface/Make-lang.in
===================================================================
--- gcc/ada/gcc-interface/Make-lang.in	(revision 205881)
+++ gcc/ada/gcc-interface/Make-lang.in	(working copy)
@@ -658,7 +658,7 @@ ada.tags: force
 ada/doctools/xgnatugn$(build_exeext): ada/xgnatugn.adb
 	-$(MKDIR) ada/doctools
 	$(CP) $^ ada/doctools
-	cd ada/doctools && $(GNATMAKE) -q xgnatugn
+	cd ada/doctools && gnatmake -q xgnatugn
 
 # Note that doc/gnat_ugn.texi and doc/projects.texi do not depend on
 # xgnatugn being built so we can distribute a pregenerated doc/gnat_ugn.info

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-11 13:11   ` Bernd Edlinger
  2013-12-11 13:32     ` Iain Sandoe
@ 2013-12-12  1:02     ` Alan Modra
  2013-12-17 12:14       ` Bernd Edlinger
  1 sibling, 1 reply; 43+ messages in thread
From: Alan Modra @ 2013-12-12  1:02 UTC (permalink / raw)
  To: Bernd Edlinger; +Cc: gcc-patches, Jakub Jelinek, DJ Delorie

On Wed, Dec 11, 2013 at 02:11:49PM +0100, Bernd Edlinger wrote:
> We need the auto-build only to build something that translates .md files to .c,
> so I would'nt care about GMP, but some other things, like the right prototype for
> printf make a difference.

Right, but when you get some of the HAVE_* wrong, libiberty for the
build compiler provides some of the "missing" functions and
declarations.  The declarations can clash with system header
declarations giving you bootstrap failures for no good reason..

> > diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> > index aad927c..7995e64 100644
> > --- a/gcc/Makefile.in
> > +++ b/gcc/Makefile.in
> > @@ -747,7 +747,8 @@ BUILD_LINKERFLAGS = $(BUILD_CXXFLAGS)
> >
> > # 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 $(CPPINC)
> >
> 
> I did not have this one.
> What is it good for?

It fixes another case of host header directories being searched for
the build compiler.  Important when GMPINC and other *INC point at
installed locations for the host compiler.  Trouble is, you don't just
get the headers you want (eg. gmp.h) but all the other host headers
too.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 43+ messages in thread

* RE: Two build != host fixes
  2013-12-11 14:44       ` Eric Botcazou
@ 2013-12-12 12:11         ` Bernd Edlinger
  2013-12-12 12:27           ` Eric Botcazou
  2013-12-12 12:28           ` Iain Sandoe
  0 siblings, 2 replies; 43+ messages in thread
From: Bernd Edlinger @ 2013-12-12 12:11 UTC (permalink / raw)
  To: Eric Botcazou, Iain Sandoe
  Cc: gcc-patches, Alan Modra, Jakub Jelinek, DJ Delorie

[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]

>
>> I have some more fixes for Ada cross-builds that Eric commented on but need
>> a little more work - will try to re-test this evening and re-post tomorrow.
>
> It's also PR ada/55946. Would mind trying the attached patch?
>
> --
> Eric Botcazou

Hi Eric,


your patch looks quite nice, (maybe s/host_alias= @host_alias@/host_alias = @host_alias@/)
but I have to make a few more patches, to get it working:


error: "system.ads" has restriction No_Implicit_Dynamic_Code
error: but the following files violate this restriction:
error:   "make.adb"
error:   "makeutl.adb"
error:   "prj.adb"
error:   "prj-env.adb"
error:   "prj-conf.adb"
error:   "prj-proc.adb"
error:   "prj-nmsc.adb"


that's the most weird point. If I get rid of that pragma, and re-build everything I get something that looks
like a working gcc/gnat.

The problem with SSIZE_MAX is this: it is not defined in gcc/glimits.h, and in the host!=build cross-compiler
fix-includes replaces the working limits.h with that one, so my build fails.

Bernd. 		 	   		  

[-- Attachment #2: patch-cross-build.diff --]
[-- Type: application/octet-stream, Size: 2034 bytes --]

--- gcc/config/host-linux.c	2013-01-10 21:38:27.000000000 +0100
+++ gcc/config/host-linux.c	2013-12-09 09:36:14.566516055 +0100
@@ -212,7 +212,7 @@ linux_gt_pch_use_address (void *base, si
     {
       ssize_t nbytes;
 
-      nbytes = read (fd, base, MIN (size, SSIZE_MAX));
+      nbytes = read (fd, base, MIN (size, (size_t)-1 >> 1));
       if (nbytes <= 0)
         return -1;
       base = (char *) base + nbytes;
--- gcc/configure	2013-12-05 08:11:17.000000000 +0100
+++ gcc/configure	2013-12-11 09:36:03.628779968 +0100
@@ -11288,7 +11288,8 @@ else
 	*) realsrcdir=../${srcdir};;
 	esac
 	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
-	LDFLAGS="${LDFLAGS_FOR_BUILD}" GMPINC="" \
+	CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
+	LDFLAGS="${LDFLAGS_FOR_BUILD}" \
 	${realsrcdir}/configure \
 		--enable-languages=${enable_languages-all} \
 		--target=$target_alias --host=$build_alias --build=$build_alias
--- gcc/configure.ac	2013-12-05 08:11:17.000000000 +0100
+++ gcc/configure.ac	2013-12-11 08:59:36.064751311 +0100
@@ -1530,7 +1530,8 @@ else
 	*) realsrcdir=../${srcdir};;
 	esac
 	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
-	LDFLAGS="${LDFLAGS_FOR_BUILD}" GMPINC="" \
+	CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
+	LDFLAGS="${LDFLAGS_FOR_BUILD}" \
 	${realsrcdir}/configure \
 		--enable-languages=${enable_languages-all} \
 		--target=$target_alias --host=$build_alias --build=$build_alias
--- gcc/ada/system.ads	2011-08-29 12:14:45.000000000 +0200
+++ gcc/ada/system.ads	2013-12-11 10:13:51.496809683 +0100
@@ -39,7 +39,7 @@
 --  "proper" System, and since the compiler itself does not care about most
 --  System parameters, this generic version works fine.
 
-pragma Restrictions (No_Implicit_Dynamic_Code);
+--  pragma Restrictions (No_Implicit_Dynamic_Code);
 --  We want to avoid trampolines in the compiler, so it can be used in systems
 --  which prevent execution of code on the stack, e.g. in windows environments
 --  with DEP (Data Execution Protection) enabled.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-12 12:11         ` Bernd Edlinger
@ 2013-12-12 12:27           ` Eric Botcazou
  2013-12-12 13:19             ` Bernd Edlinger
  2013-12-12 12:28           ` Iain Sandoe
  1 sibling, 1 reply; 43+ messages in thread
From: Eric Botcazou @ 2013-12-12 12:27 UTC (permalink / raw)
  To: Bernd Edlinger
  Cc: gcc-patches, Iain Sandoe, Alan Modra, Jakub Jelinek, DJ Delorie

> your patch looks quite nice, (maybe s/host_alias= @host_alias@/host_alias =
> @host_alias@/)

Thanks for spotting it, now fixed.

> but I have to make a few more patches, to get it working:
> 
> 
> error: "system.ads" has restriction No_Implicit_Dynamic_Code
> error: but the following files violate this restriction:
> error:   "make.adb"
> error:   "makeutl.adb"
> error:   "prj.adb"
> error:   "prj-env.adb"
> error:   "prj-conf.adb"
> error:   "prj-proc.adb"
> error:   "prj-nmsc.adb"
> 
> 
> that's the most weird point. If I get rid of that pragma, and re-build
> everything I get something that looks like a working gcc/gnat.

Nice progress!  To be fair, the violation of No_Implicit_Dynamic_Code was also 
reported under PR ada/55946, but the fix isn't to remove the pragma, as this 
particular version of system.ads should be used only to build the compiler and 
not the tools.  This issue is supposed to be addressed by the RTS_DIR thing:

# Put the host RTS dir first in the PATH to hide the default runtime
# files that are among the sources
RTS_DIR:=$(strip $(subst \,/,$(shell $(GNATLS_FOR_HOST) -v | grep adalib )))

TOOLS_FLAGS_TO_PASS_CROSS= \
	"CC=$(CC)" \
	"CXX=$(CXX)" \
	"CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
	"LDFLAGS=$(LDFLAGS)" \
	"ADAFLAGS=$(ADAFLAGS)"	\
	"ADA_CFLAGS=$(ADA_CFLAGS)" \
	"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
	"ADA_INCLUDES=-I$(RTS_DIR)../adainclude -I$(RTS_DIR)

Could you post the command line for the compilation of one of the problematic 
units for the gnattools?

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-12 12:11         ` Bernd Edlinger
  2013-12-12 12:27           ` Eric Botcazou
@ 2013-12-12 12:28           ` Iain Sandoe
  2013-12-12 12:35             ` Eric Botcazou
  1 sibling, 1 reply; 43+ messages in thread
From: Iain Sandoe @ 2013-12-12 12:28 UTC (permalink / raw)
  To: Eric Botcazou, Bernd Edlinger
  Cc: gcc-patches@gcc.gnu.org patches, Alan Modra, Jakub Jelinek, DJ Delorie

Hi Eric,

On 12 Dec 2013, at 12:11, Bernd Edlinger wrote:

>> 
>>> I have some more fixes for Ada cross-builds that Eric commented on but need
>>> a little more work - will try to re-test this evening and re-post tomorrow.
>> 
>> It's also PR ada/55946. Would mind trying the attached patch?
>> 
>> --
>> Eric Botcazou
> 
> Hi Eric,
> 
> 
> your patch looks quite nice, (maybe s/host_alias= @host_alias@/host_alias = @host_alias@/)
> but I have to make a few more patches, to get it working:
> 
> 
> error: "system.ads" has restriction No_Implicit_Dynamic_Code
> error: but the following files violate this restriction:
> error:   "make.adb"
> error:   "makeutl.adb"
> error:   "prj.adb"
> error:   "prj-env.adb"
> error:   "prj-conf.adb"
> error:   "prj-proc.adb"
> error:   "prj-nmsc.adb"


using your patch + the mod I made for LDFLAGS.

I built x86_64-darwin12 X powerpc-darwin9 [build = x86_64-darwin12]
and then a native X powerpc-darwin9  [build = x86_64-darwin12]

Ada built and I can do "gnatmake hello.adb" on the powerpc system and produce a working exe, 
gcc and g++ seem to produce similar test output from recent runs.

Do you have a way to run acats for an out-of-tree test?

Iain

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-12 12:28           ` Iain Sandoe
@ 2013-12-12 12:35             ` Eric Botcazou
  2013-12-12 12:45               ` Iain Sandoe
  0 siblings, 1 reply; 43+ messages in thread
From: Eric Botcazou @ 2013-12-12 12:35 UTC (permalink / raw)
  To: Iain Sandoe
  Cc: gcc-patches, Bernd Edlinger, Alan Modra, Jakub Jelinek, DJ Delorie

> using your patch + the mod I made for LDFLAGS.

In gcc-interface/Makefile.in?  I wasn't sure if it was really needed.

Out of curiosity, what do you set LDFLAGS to exactly?

> I built x86_64-darwin12 X powerpc-darwin9 [build = x86_64-darwin12]
> and then a native X powerpc-darwin9  [build = x86_64-darwin12]
> 
> Ada built and I can do "gnatmake hello.adb" on the powerpc system and
> produce a working exe, gcc and g++ seem to produce similar test output from
> recent runs.

That's nice.

> Do you have a way to run acats for an out-of-tree test?

Presumably not, but you could try to run gnat.dg instead.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-12 12:35             ` Eric Botcazou
@ 2013-12-12 12:45               ` Iain Sandoe
  2013-12-12 15:23                 ` Eric Botcazou
  0 siblings, 1 reply; 43+ messages in thread
From: Iain Sandoe @ 2013-12-12 12:45 UTC (permalink / raw)
  To: Eric Botcazou
  Cc: gcc-patches, Bernd Edlinger, Alan Modra, Jakub Jelinek, DJ Delorie

Hi Eric,

On 12 Dec 2013, at 12:34, Eric Botcazou wrote:

>> using your patch + the mod I made for LDFLAGS.
> 
> In gcc-interface/Makefile.in?  I wasn't sure if it was really needed.
> 
> Out of curiosity, what do you set LDFLAGS to exactly?

Darwin doesn't have gettext in libSystem, I build it as a convenience library, but it still needs to refer to a system framework. For this to link the gnattools I need:

LDFLAGS="-L/path/to/my/convenience/lib -framework CoreFoundation" 

I suppose that, one day, the make machinery should do something like
LDFLAGS = @LDFLAGS@ 
to save me putting this on every GCC build line ...

>> I built x86_64-darwin12 X powerpc-darwin9 [build = x86_64-darwin12]
>> and then a native X powerpc-darwin9  [build = x86_64-darwin12]
>> 
>> Ada built and I can do "gnatmake hello.adb" on the powerpc system and
>> produce a working exe, gcc and g++ seem to produce similar test output from
>> recent runs.
> 
> That's nice.
> 
>> Do you have a way to run acats for an out-of-tree test?
> 
> Presumably not, but you could try to run gnat.dg instead.

OK - will give that a whirl next time i am in front of that machine..

It would be a useful thing to make an acats script variant to work with installed/out-of-tree testing.
Iain

^ permalink raw reply	[flat|nested] 43+ messages in thread

* RE: Two build != host fixes
  2013-12-12 12:27           ` Eric Botcazou
@ 2013-12-12 13:19             ` Bernd Edlinger
  2013-12-12 15:23               ` Eric Botcazou
  0 siblings, 1 reply; 43+ messages in thread
From: Bernd Edlinger @ 2013-12-12 13:19 UTC (permalink / raw)
  To: Eric Botcazou
  Cc: gcc-patches, Iain Sandoe, Alan Modra, Jakub Jelinek, DJ Delorie

>
>> your patch looks quite nice, (maybe s/host_alias= @host_alias@/host_alias =
>> @host_alias@/)
>
> Thanks for spotting it, now fixed.
>
>> but I have to make a few more patches, to get it working:
>>
>>
>> error: "system.ads" has restriction No_Implicit_Dynamic_Code
>> error: but the following files violate this restriction:
>> error: "make.adb"
>> error: "makeutl.adb"
>> error: "prj.adb"
>> error: "prj-env.adb"
>> error: "prj-conf.adb"
>> error: "prj-proc.adb"
>> error: "prj-nmsc.adb"
>>
>>
>> that's the most weird point. If I get rid of that pragma, and re-build
>> everything I get something that looks like a working gcc/gnat.
>
> Nice progress! To be fair, the violation of No_Implicit_Dynamic_Code was also
> reported under PR ada/55946, but the fix isn't to remove the pragma, as this
> particular version of system.ads should be used only to build the compiler and
> not the tools. This issue is supposed to be addressed by the RTS_DIR thing:
>
> # Put the host RTS dir first in the PATH to hide the default runtime
> # files that are among the sources
> RTS_DIR:=$(strip $(subst \,/,$(shell $(GNATLS_FOR_HOST) -v | grep adalib )))
>
> TOOLS_FLAGS_TO_PASS_CROSS= \
> "CC=$(CC)" \
> "CXX=$(CXX)" \
> "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
> "LDFLAGS=$(LDFLAGS)" \
> "ADAFLAGS=$(ADAFLAGS)" \
> "ADA_CFLAGS=$(ADA_CFLAGS)" \
> "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
> "ADA_INCLUDES=-I$(RTS_DIR)../adainclude -I$(RTS_DIR)
>
> Could you post the command line for the compilation of one of the problematic
> units for the gnattools?
>
> --
> Eric Botcazou

arm-linux-gnueabihf-gcc -c -I./ -I/home/ed/gnu/x/arm-linux-gnueabihf-linux64/lib/gcc/arm-linux-gnueabihf/4.9.0/adalib/../adainclude -I/home/ed/gnu/x/arm-linux-gnueabihf-linux64/lib/gcc/arm-linux-gnueabihf/4.9.0/adalib/ -I. -I/home/ed/gnu/x/gcc-4.9-20131208/gcc/ada -g -O2 -W -Wall -gnatpg -gnata -I- /home/ed/gnu/x/gcc-4.9-20131208/gcc/ada/makeutl.adb


arm-linux-gnueabihf-gcc -c -I./ -I/home/ed/gnu/x/arm-linux-gnueabihf-linux64/lib/gcc/arm-linux-gnueabihf/4.9.0/adalib/../adainclude -I/home/ed/gnu/x/arm-linux-gnueabihf-linux64/lib/gcc/arm-linux-gnueabihf/4.9.0/adalib/ -I. -I/home/ed/gnu/x/gcc-4.9-20131208/gcc/ada -g -O2 -W -Wall -gnatpg -gnata -I- /home/ed/gnu/x/gcc-4.9-20131208/gcc/ada/prj-env.adb



/home/ed/gnu/x/arm-linux-gnueabihf-linux64: where the build=host target=arm-linux-gnueabihf compiler is installed.


Bernd. 		 	   		  

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-12 13:19             ` Bernd Edlinger
@ 2013-12-12 15:23               ` Eric Botcazou
  2013-12-13  8:08                 ` Bernd Edlinger
  0 siblings, 1 reply; 43+ messages in thread
From: Eric Botcazou @ 2013-12-12 15:23 UTC (permalink / raw)
  To: Bernd Edlinger
  Cc: gcc-patches, Iain Sandoe, Alan Modra, Jakub Jelinek, DJ Delorie

> arm-linux-gnueabihf-gcc -c -I./
> -I/home/ed/gnu/x/arm-linux-gnueabihf-linux64/lib/gcc/arm-linux-gnueabihf/4.
> 9.0/adalib/../adainclude
> -I/home/ed/gnu/x/arm-linux-gnueabihf-linux64/lib/gcc/arm-linux-gnueabihf/4.
> 9.0/adalib/ -I. -I/home/ed/gnu/x/gcc-4.9-20131208/gcc/ada -g -O2 -W -Wall
> -gnatpg -gnata -I- /home/ed/gnu/x/gcc-4.9-20131208/gcc/ada/makeutl.adb
> 
> 
> arm-linux-gnueabihf-gcc -c -I./
> -I/home/ed/gnu/x/arm-linux-gnueabihf-linux64/lib/gcc/arm-linux-gnueabihf/4.
> 9.0/adalib/../adainclude
> -I/home/ed/gnu/x/arm-linux-gnueabihf-linux64/lib/gcc/arm-linux-gnueabihf/4.
> 9.0/adalib/ -I. -I/home/ed/gnu/x/gcc-4.9-20131208/gcc/ada -g -O2 -W -Wall
> -gnatpg -gnata -I- /home/ed/gnu/x/gcc-4.9-20131208/gcc/ada/prj-env.adb
> 
> 
> 
> /home/ed/gnu/x/arm-linux-gnueabihf-linux64: where the build=host
> target=arm-linux-gnueabihf compiler is installed.

OK, I think that this compiler is misconfigured, could you try this

Index: gcc-interface/Makefile.in
===================================================================
--- gcc-interface/Makefile.in   (revision 205918)
+++ gcc-interface/Makefile.in   (working copy)
@@ -1903,7 +1903,7 @@ ifeq ($(strip $(filter-out powerpc% linu
 endif
 
 # ARM linux, GNU eabi
-ifeq ($(strip $(filter-out arm% linux-gnueabi,$(target_cpu) $(target_os))),)
+ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-linux.ads \
   s-inmaop.adb<s-inmaop-posix.adb \

and rebuild this compiler?

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-12 12:45               ` Iain Sandoe
@ 2013-12-12 15:23                 ` Eric Botcazou
  2013-12-12 17:05                   ` Iain Sandoe
  0 siblings, 1 reply; 43+ messages in thread
From: Eric Botcazou @ 2013-12-12 15:23 UTC (permalink / raw)
  To: Iain Sandoe
  Cc: gcc-patches, Bernd Edlinger, Alan Modra, Jakub Jelinek, DJ Delorie

> Darwin doesn't have gettext in libSystem, I build it as a convenience
> library, but it still needs to refer to a system framework. For this to
> link the gnattools I need:
> 
> LDFLAGS="-L/path/to/my/convenience/lib -framework CoreFoundation"

OK, I'll add $(LDFLAGS).  It was actually already passed in the native case...

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-12 15:23                 ` Eric Botcazou
@ 2013-12-12 17:05                   ` Iain Sandoe
  2013-12-12 17:22                     ` Eric Botcazou
  0 siblings, 1 reply; 43+ messages in thread
From: Iain Sandoe @ 2013-12-12 17:05 UTC (permalink / raw)
  To: Eric Botcazou
  Cc: gcc-patches, Bernd Edlinger, Alan Modra, Jakub Jelinek, DJ Delorie


On 12 Dec 2013, at 15:23, Eric Botcazou wrote:

>> Darwin doesn't have gettext in libSystem, I build it as a convenience
>> library, but it still needs to refer to a system framework. For this to
>> link the gnattools I need:
>> 
>> LDFLAGS="-L/path/to/my/convenience/lib -framework CoreFoundation"
> 
> OK, I'll add $(LDFLAGS).  It was actually already passed in the native case…

I ran the gnat testsuite (it didn't quite work 'out of the box' for installed - but of fiddling symlinks was enough)
results as per normal (m32 only tested)

With your blanket change to gnattools/Makefile, isn't it also reasonable to apply the following?
Iain

diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index cd3676f..241571d 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -152,12 +152,6 @@ ifeq ($(build), $(host))
     # This is a regular cross compiler. Use the native compiler to compile
     # the tools.
 
-    # put the host RTS dir first in the PATH to hide the default runtime
-    # files that are among the sources
-    ifneq ($(findstring ada,$(LANGUAGES)),)
-      RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib )))
-    endif
-
     ADA_TOOLS_FLAGS_TO_PASS=\
         CC="$(CC)" \
         CXX="$(CXX)" \
@@ -193,9 +187,6 @@ else
   else
     # This is a canadian cross. We should use a toolchain running on the
     # build platform and targeting the host platform.
-    ifneq ($(findstring ada,$(LANGUAGES)),)
-      RTS_DIR:=$(strip $(subst \,/,$(shell $(GNATLS_FOR_HOST) -v | grep adalib )))
-    endif
     ADA_TOOLS_FLAGS_TO_PASS=\
         CC="$(CC)" \
         CXX="$(CXX)" \



^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-12 17:05                   ` Iain Sandoe
@ 2013-12-12 17:22                     ` Eric Botcazou
  2013-12-12 17:31                       ` Iain Sandoe
  0 siblings, 1 reply; 43+ messages in thread
From: Eric Botcazou @ 2013-12-12 17:22 UTC (permalink / raw)
  To: Iain Sandoe
  Cc: gcc-patches, Bernd Edlinger, Alan Modra, Jakub Jelinek, DJ Delorie

> With your blanket change to gnattools/Makefile, isn't it also reasonable to
> apply the following?
> 
> diff --git a/gcc/ada/gcc-interface/Make-lang.in
> b/gcc/ada/gcc-interface/Make-lang.in index cd3676f..241571d 100644
> --- a/gcc/ada/gcc-interface/Make-lang.in
> +++ b/gcc/ada/gcc-interface/Make-lang.in
> @@ -152,12 +152,6 @@ ifeq ($(build), $(host))
>      # This is a regular cross compiler. Use the native compiler to compile
>      # the tools.
> 
> -    # put the host RTS dir first in the PATH to hide the default runtime
> -    # files that are among the sources
> -    ifneq ($(findstring ada,$(LANGUAGES)),)
> -      RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib )))
> -    endif
> -
>      ADA_TOOLS_FLAGS_TO_PASS=\
>          CC="$(CC)" \
>          CXX="$(CXX)" \
> @@ -193,9 +187,6 @@ else
>    else
>      # This is a canadian cross. We should use a toolchain running on the
>      # build platform and targeting the host platform.
> -    ifneq ($(findstring ada,$(LANGUAGES)),)
> -      RTS_DIR:=$(strip $(subst \,/,$(shell $(GNATLS_FOR_HOST) -v | grep
> adalib ))) -    endif
>      ADA_TOOLS_FLAGS_TO_PASS=\
>          CC="$(CC)" \
>          CXX="$(CXX)" \

That's tempting indeed, but we still support the old --disable-libada and 
these bits are required to make it work.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-12 17:22                     ` Eric Botcazou
@ 2013-12-12 17:31                       ` Iain Sandoe
  2013-12-12 20:07                         ` Eric Botcazou
  0 siblings, 1 reply; 43+ messages in thread
From: Iain Sandoe @ 2013-12-12 17:31 UTC (permalink / raw)
  To: Eric Botcazou
  Cc: gcc-patches, Bernd Edlinger, Alan Modra, Jakub Jelinek, DJ Delorie


On 12 Dec 2013, at 17:21, Eric Botcazou wrote:

>> With your blanket change to gnattools/Makefile, isn't it also reasonable to
>> apply the following?
>> 
>> diff --git a/gcc/ada/gcc-interface/Make-lang.in
>> b/gcc/ada/gcc-interface/Make-lang.in index cd3676f..241571d 100644
>> --- a/gcc/ada/gcc-interface/Make-lang.in
>> +++ b/gcc/ada/gcc-interface/Make-lang.in
>> @@ -152,12 +152,6 @@ ifeq ($(build), $(host))
>>     # This is a regular cross compiler. Use the native compiler to compile
>>     # the tools.
>> 
>> -    # put the host RTS dir first in the PATH to hide the default runtime
>> -    # files that are among the sources
>> -    ifneq ($(findstring ada,$(LANGUAGES)),)
>> -      RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib )))
>> -    endif
>> -
>>     ADA_TOOLS_FLAGS_TO_PASS=\
>>         CC="$(CC)" \
>>         CXX="$(CXX)" \
>> @@ -193,9 +187,6 @@ else
>>   else
>>     # This is a canadian cross. We should use a toolchain running on the
>>     # build platform and targeting the host platform.
>> -    ifneq ($(findstring ada,$(LANGUAGES)),)
>> -      RTS_DIR:=$(strip $(subst \,/,$(shell $(GNATLS_FOR_HOST) -v | grep
>> adalib ))) -    endif
>>     ADA_TOOLS_FLAGS_TO_PASS=\
>>         CC="$(CC)" \
>>         CXX="$(CXX)" \
> 
> That's tempting indeed, but we still support the old --disable-libada and 
> these bits are required to make it work.

ah.
.. then does the second block need hoisting to bracket the two cases with host!=build?
Iain

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-12 17:31                       ` Iain Sandoe
@ 2013-12-12 20:07                         ` Eric Botcazou
  0 siblings, 0 replies; 43+ messages in thread
From: Eric Botcazou @ 2013-12-12 20:07 UTC (permalink / raw)
  To: Iain Sandoe
  Cc: gcc-patches, Bernd Edlinger, Alan Modra, Jakub Jelinek, DJ Delorie

> .. then does the second block need hoisting to bracket the two cases with
> host!=build?

This code works fine so I don't think that we really need to do anything.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 43+ messages in thread

* RE: Two build != host fixes
  2013-12-12 15:23               ` Eric Botcazou
@ 2013-12-13  8:08                 ` Bernd Edlinger
  2013-12-13  8:21                   ` Eric Botcazou
  0 siblings, 1 reply; 43+ messages in thread
From: Bernd Edlinger @ 2013-12-13  8:08 UTC (permalink / raw)
  To: Eric Botcazou
  Cc: gcc-patches, Iain Sandoe, Alan Modra, Jakub Jelinek, DJ Delorie

Hi Eric,


>
> OK, I think that this compiler is misconfigured, could you try this
>
> Index: gcc-interface/Makefile.in
> ===================================================================
> --- gcc-interface/Makefile.in (revision 205918)
> +++ gcc-interface/Makefile.in (working copy)
> @@ -1903,7 +1903,7 @@ ifeq ($(strip $(filter-out powerpc% linu
> endif
>
> # ARM linux, GNU eabi
> -ifeq ($(strip $(filter-out arm% linux-gnueabi,$(target_cpu) $(target_os))),)
> +ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),)
> LIBGNAT_TARGET_PAIRS = \
> a-intnam.ads<a-intnam-linux.ads \
> s-inmaop.adb<s-inmaop-posix.adb \
>
> and rebuild this compiler?
>
> --
> Eric Botcazou

OK, now it works. Thanks.


I wonder if you could add some really good comments in the system.ads
what's the problem and how to fix it if the No_Implicit_Dynamic_Code
makes problems like these?


Bernd. 		 	   		  

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-13  8:08                 ` Bernd Edlinger
@ 2013-12-13  8:21                   ` Eric Botcazou
  0 siblings, 0 replies; 43+ messages in thread
From: Eric Botcazou @ 2013-12-13  8:21 UTC (permalink / raw)
  To: Bernd Edlinger
  Cc: gcc-patches, Iain Sandoe, Alan Modra, Jakub Jelinek, DJ Delorie

> OK, now it works.

Thanks for confirming, I've installed the patch.

> I wonder if you could add some really good comments in the system.ads
> what's the problem and how to fix it if the No_Implicit_Dynamic_Code
> makes problems like these?

I think that we need to catch the problem earlier, that is to say stop the 
build of the Ada library if no configuration is selected in the Makefile.

I'll try to come up with something along these lines.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 43+ messages in thread

* RE: Two build != host fixes
  2013-12-12  1:02     ` Alan Modra
@ 2013-12-17 12:14       ` Bernd Edlinger
  2013-12-17 23:28         ` Alan Modra
  0 siblings, 1 reply; 43+ messages in thread
From: Bernd Edlinger @ 2013-12-17 12:14 UTC (permalink / raw)
  To: Alan Modra; +Cc: gcc-patches, Jakub Jelinek, DJ Delorie, Eric Botcazou

Hi Alan,


just for the records, this is how my cross-build fails:

../gcc-4.9-20131215/configure --prefix=/home/ed/gnu/x/arm-linux-gnueabihf-cross --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --enable-languages=c,c++ --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3-d16 --with-float=hard



...
make[2]: Entering directory `/home/ed/gnu/x/gcc-build-arm-linux-gnueabihf-cross/gcc'
g++ -c -DIN_GCC     -DGENERATOR_FILE -I. -Ibuild -I../../gcc-4.9-20131215/gcc -I../../gcc-4.9-20131215/gcc/build -I../../gcc-4.9-20131215/gcc/../include -I../../gcc-4.9-20131215/gcc/../libcpp/include -I/home/ed/gnu/x/gcc-build-arm-linux-gnueabihf-cross/./gmp -I/home/ed/gnu/x/gcc-4.9-20131215/gmp -I/home/ed/gnu/x/gcc-build-arm-linux-gnueabihf-cross/./mpfr -I/home/ed/gnu/x/gcc-4.9-20131215/mpfr -I/home/ed/gnu/x/gcc-4.9-20131215/mpc/src  -I../../gcc-4.9-20131215/gcc/../libdecnumber -I../../gcc-4.9-20131215/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc-4.9-20131215/gcc/../libbacktrace    \
        -o build/genmddeps.o ../../gcc-4.9-20131215/gcc/genmddeps.c
In file included from ./bconfig.h:3:0,
                 from ../../gcc-4.9-20131215/gcc/genmddeps.c:18:
./auto-build.h:2037:16: error: declaration does not declare anything [-fpermissive]
 #define rlim_t long
                ^
In file included from ../../gcc-4.9-20131215/gcc/genmddeps.c:19:0:
../../gcc-4.9-20131215/gcc/system.h:450:23: error: conflicting declaration of C function 'void* sbrk(int)'
 extern void *sbrk (int);
                       ^
In file included from ../../gcc-4.9-20131215/gcc/system.h:262:0,
                 from ../../gcc-4.9-20131215/gcc/genmddeps.c:19:
/usr/include/unistd.h:1067:14: note: previous declaration 'void* sbrk(intptr_t)'
 extern void *sbrk (intptr_t __delta) __THROW;
              ^
In file included from ../../gcc-4.9-20131215/gcc/genmddeps.c:19:0:
../../gcc-4.9-20131215/gcc/system.h:454:48: error: ambiguating new declaration of 'char* strstr(const char*, const char*)'
 extern char *strstr (const char *, const char *);
                                                ^
In file included from /home/ed/gnu/install/include/c++/4.9.0/cstring:42:0,
                 from ../../gcc-4.9-20131215/gcc/system.h:205,
                 from ../../gcc-4.9-20131215/gcc/genmddeps.c:19:
/usr/include/string.h:323:22: note: old declaration 'const char* strstr(const char*, const char*)'
 extern __const char *strstr (__const char *__haystack,
                      ^
In file included from /usr/include/features.h:357:0,
                 from /usr/include/stdio.h:28,
                 from ../../gcc-4.9-20131215/gcc/system.h:40,
                 from ../../gcc-4.9-20131215/gcc/genmddeps.c:19:
/usr/include/malloc.h:76:32: error: declaration of 'void free(void*) throw ()' has a different exception specifier
 extern void free (void *__ptr) __THROW;
                                ^
In file included from ../../gcc-4.9-20131215/gcc/genmddeps.c:19:0:
../../gcc-4.9-20131215/gcc/system.h:426:13: error: from previous declaration 'void free(void*)'
 extern void free (void *);
             ^
In file included from ../../gcc-4.9-20131215/gcc/genmddeps.c:19:0:
../../gcc-4.9-20131215/gcc/system.h:506:34: error: conflicting declaration of C function 'const char* strsignal(int)'
 extern const char *strsignal (int);
                                  ^
In file included from /home/ed/gnu/install/include/c++/4.9.0/cstring:42:0,
                 from ../../gcc-4.9-20131215/gcc/system.h:205,
                 from ../../gcc-4.9-20131215/gcc/genmddeps.c:19:
/usr/include/string.h:566:14: note: previous declaration 'char* strsignal(int)'
 extern char *strsignal (int __sig) __THROW;
              ^
In file included from ./bconfig.h:5:0,
                 from ../../gcc-4.9-20131215/gcc/genmddeps.c:18:
../../gcc-4.9-20131215/gcc/../include/ansidecl.h:308:64: error: ambiguating new declaration of 'char* basename(const char*)'
 #  define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))
                                                                ^
../../gcc-4.9-20131215/gcc/../include/libiberty.h:110:64: note: in expansion of macro 'ATTRIBUTE_NONNULL'
 extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
                                                                ^
In file included from /home/ed/gnu/install/include/c++/4.9.0/cstring:42:0,
                 from ../../gcc-4.9-20131215/gcc/system.h:205,
                 from ../../gcc-4.9-20131215/gcc/genmddeps.c:19:
/usr/include/string.h:603:28: note: old declaration 'const char* basename(const char*)'
 extern "C++" __const char *basename (__const char *__filename)
                            ^
In file included from ./bconfig.h:5:0,
                 from ../../gcc-4.9-20131215/gcc/genmddeps.c:18:
../../gcc-4.9-20131215/gcc/../include/ansidecl.h:308:64: error: declaration of 'int snprintf(char*, size_t, const char*, ...)' has a different exception specifier
 #  define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))
                                                                ^
../../gcc-4.9-20131215/gcc/../include/ansidecl.h:337:80: note: in expansion of macro 'ATTRIBUTE_NONNULL'
 #define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m)
                                                                                ^
../../gcc-4.9-20131215/gcc/../include/ansidecl.h:340:28: note: in expansion of macro 'ATTRIBUTE_PRINTF'
 #define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
                            ^
../../gcc-4.9-20131215/gcc/../include/libiberty.h:628:57: note: in expansion of macro 'ATTRIBUTE_PRINTF_3'
 extern int snprintf (char *, size_t, const char *, ...) ATTRIBUTE_PRINTF_3;
                                                         ^
In file included from ../../gcc-4.9-20131215/gcc/genmddeps.c:19:0:
../../gcc-4.9-20131215/gcc/system.h:533:12: error: from previous declaration 'int snprintf(char*, size_t, const char*, ...) throw ()'
 extern int snprintf (char *, size_t, const char *, ...);
            ^
In file included from ./bconfig.h:5:0,
                 from ../../gcc-4.9-20131215/gcc/genmddeps.c:18:
../../gcc-4.9-20131215/gcc/../include/ansidecl.h:308:64: error: declaration of 'int vsnprintf(char*, size_t, const char*, __va_list_tag*)' has a different exception specifier
 #  define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))
                                                                ^
../../gcc-4.9-20131215/gcc/../include/ansidecl.h:337:80: note: in expansion of macro 'ATTRIBUTE_NONNULL'
 #define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m)
                                                                                ^
../../gcc-4.9-20131215/gcc/../include/libiberty.h:633:62: note: in expansion of macro 'ATTRIBUTE_PRINTF'
 extern int vsnprintf (char *, size_t, const char *, va_list) ATTRIBUTE_PRINTF(3,0);
                                                              ^
In file included from ../../gcc-4.9-20131215/gcc/genmddeps.c:19:0:
../../gcc-4.9-20131215/gcc/system.h:537:12: error: from previous declaration 'int vsnprintf(char*, size_t, const char*, __va_list_tag*) throw ()'
 extern int vsnprintf (char *, size_t, const char *, va_list);
            ^
make[2]: *** [build/genmddeps.o] Error 1
make[2]: Leaving directory `/home/ed/gnu/x/gcc-build-arm-linux-gnueabihf-cross/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/home/ed/gnu/x/gcc-build-arm-linux-gnueabihf-cross'
make: *** [all] Error 2



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). But as you can see the actual invocation of the Build-compiler
has still GMPINC set.




diff -u gcc-build-arm-linux-gnueabihf-cross/gcc/auto-build.h x/gcc-build-arm-linux-gnueabihf-cross/gcc/auto-build.h 
--- gcc-build-arm-linux-gnueabihf-cross/gcc/auto-build.h    2013-12-16 13:55:19.008464424 +0100
+++ x/gcc-build-arm-linux-gnueabihf-cross/gcc/auto-build.h    2013-12-17 13:00:21.342234317 +0100
@@ -572,7 +572,7 @@
 
 /* Define if <time.h> defines clock_t. */
 #ifndef USED_FOR_TARGET
-#define HAVE_CLOCK_T 1
+/* #undef HAVE_CLOCK_T */
 #endif
 
 
@@ -585,109 +585,109 @@
 /* Define to 1 if we found a declaration for 'abort', otherwise define to 0.
    */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_ABORT 1
+#define HAVE_DECL_ABORT 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'asprintf', otherwise define to
    0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_ASPRINTF 1
+#define HAVE_DECL_ASPRINTF 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'atof', otherwise define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_ATOF 1
+#define HAVE_DECL_ATOF 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'atol', otherwise define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_ATOL 1
+#define HAVE_DECL_ATOL 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'basename', otherwise define to
    0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_BASENAME 1
+#define HAVE_DECL_BASENAME 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'calloc', otherwise define to 0.
    */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_CALLOC 1
+#define HAVE_DECL_CALLOC 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'clearerr_unlocked', otherwise
    define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_CLEARERR_UNLOCKED 1
+#define HAVE_DECL_CLEARERR_UNLOCKED 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'clock', otherwise define to 0.
    */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_CLOCK 1
+#define HAVE_DECL_CLOCK 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'errno', otherwise define to 0.
    */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_ERRNO 1
+#define HAVE_DECL_ERRNO 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'feof_unlocked', otherwise define
    to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_FEOF_UNLOCKED 1
+#define HAVE_DECL_FEOF_UNLOCKED 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'ferror_unlocked', otherwise
    define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_FERROR_UNLOCKED 1
+#define HAVE_DECL_FERROR_UNLOCKED 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'fflush_unlocked', otherwise
    define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_FFLUSH_UNLOCKED 1
+#define HAVE_DECL_FFLUSH_UNLOCKED 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'ffs', otherwise define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_FFS 1
+#define HAVE_DECL_FFS 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'fgetc_unlocked', otherwise
    define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_FGETC_UNLOCKED 1
+#define HAVE_DECL_FGETC_UNLOCKED 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'fgets_unlocked', otherwise
    define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_FGETS_UNLOCKED 1
+#define HAVE_DECL_FGETS_UNLOCKED 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'fileno_unlocked', otherwise
    define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_FILENO_UNLOCKED 1
+#define HAVE_DECL_FILENO_UNLOCKED 0
 #endif
 
 
@@ -701,62 +701,62 @@
 /* Define to 1 if we found a declaration for 'fputc_unlocked', otherwise
    define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_FPUTC_UNLOCKED 1
+#define HAVE_DECL_FPUTC_UNLOCKED 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'fputs_unlocked', otherwise
    define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_FPUTS_UNLOCKED 1
+#define HAVE_DECL_FPUTS_UNLOCKED 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'fread_unlocked', otherwise
    define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_FREAD_UNLOCKED 1
+#define HAVE_DECL_FREAD_UNLOCKED 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'free', otherwise define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_FREE 1
+#define HAVE_DECL_FREE 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'fwrite_unlocked', otherwise
    define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_FWRITE_UNLOCKED 1
+#define HAVE_DECL_FWRITE_UNLOCKED 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'getchar_unlocked', otherwise
    define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_GETCHAR_UNLOCKED 1
+#define HAVE_DECL_GETCHAR_UNLOCKED 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'getcwd', otherwise define to 0.
    */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_GETCWD 1
+#define HAVE_DECL_GETCWD 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'getc_unlocked', otherwise define
    to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_GETC_UNLOCKED 1
+#define HAVE_DECL_GETC_UNLOCKED 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'getenv', otherwise define to 0.
    */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_GETENV 1
+#define HAVE_DECL_GETENV 0
 #endif
 
 
@@ -770,28 +770,28 @@
 /* Define to 1 if we found a declaration for 'getpagesize', otherwise define
    to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_GETPAGESIZE 1
+#define HAVE_DECL_GETPAGESIZE 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'getrlimit', otherwise define to
    0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_GETRLIMIT 1
+#define HAVE_DECL_GETRLIMIT 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'getrusage', otherwise define to
    0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_GETRUSAGE 1
+#define HAVE_DECL_GETRUSAGE 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'getwd', otherwise define to 0.
    */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_GETWD 1
+#define HAVE_DECL_GETWD 0
 #endif
 
 
@@ -805,111 +805,111 @@
 /* Define to 1 if we found a declaration for 'madvise', otherwise define to 0.
    */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_MADVISE 1
+#define HAVE_DECL_MADVISE 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'malloc', otherwise define to 0.
    */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_MALLOC 1
+#define HAVE_DECL_MALLOC 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'putchar_unlocked', otherwise
    define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_PUTCHAR_UNLOCKED 1
+#define HAVE_DECL_PUTCHAR_UNLOCKED 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'putc_unlocked', otherwise define
    to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_PUTC_UNLOCKED 1
+#define HAVE_DECL_PUTC_UNLOCKED 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'realloc', otherwise define to 0.
    */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_REALLOC 1
+#define HAVE_DECL_REALLOC 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'sbrk', otherwise define to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_SBRK 1
+#define HAVE_DECL_SBRK 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'setrlimit', otherwise define to
    0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_SETRLIMIT 1
+#define HAVE_DECL_SETRLIMIT 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'sigaltstack', otherwise define
    to 0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_SIGALTSTACK 1
+#define HAVE_DECL_SIGALTSTACK 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'snprintf', otherwise define to
    0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_SNPRINTF 1
+#define HAVE_DECL_SNPRINTF 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'stpcpy', otherwise define to 0.
    */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_STPCPY 1
+#define HAVE_DECL_STPCPY 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'strsignal', otherwise define to
    0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_STRSIGNAL 1
+#define HAVE_DECL_STRSIGNAL 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'strstr', otherwise define to 0.
    */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_STRSTR 1
+#define HAVE_DECL_STRSTR 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'strverscmp', otherwise define to
    0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_STRVERSCMP 1
+#define HAVE_DECL_STRVERSCMP 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'times', otherwise define to 0.
    */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_TIMES 1
+#define HAVE_DECL_TIMES 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'vasprintf', otherwise define to
    0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_VASPRINTF 1
+#define HAVE_DECL_VASPRINTF 0
 #endif
 
 
 /* Define to 1 if we found a declaration for 'vsnprintf', otherwise define to
    0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_VSNPRINTF 1
+#define HAVE_DECL_VSNPRINTF 0
 #endif
 
 
@@ -1474,7 +1474,7 @@
 
 /* Define if <sys/times.h> defines struct tms. */
 #ifndef USED_FOR_TARGET
-#define HAVE_STRUCT_TMS 1
+/* #undef HAVE_STRUCT_TMS */
 #endif
 
 
@@ -2034,7 +2034,7 @@
 
 /* Define to `long' if <sys/resource.h> doesn't define. */
 #ifndef USED_FOR_TARGET
-/* #undef rlim_t */
+#define rlim_t long
 #endif



Regards
Bernd. 		 	   		  

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-17 12:14       ` Bernd Edlinger
@ 2013-12-17 23:28         ` Alan Modra
  2013-12-18 13:32           ` Bernd Edlinger
  2014-03-26 21:54           ` Maciej W. Rozycki
  0 siblings, 2 replies; 43+ messages in thread
From: Alan Modra @ 2013-12-17 23:28 UTC (permalink / raw)
  To: Bernd Edlinger; +Cc: gcc-patches, Jakub Jelinek, DJ Delorie, Eric Botcazou

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

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 43+ messages in thread

* RE: Two build != host fixes
  2013-12-17 23:28         ` Alan Modra
@ 2013-12-18 13:32           ` Bernd Edlinger
  2013-12-19 10:11             ` Alan Modra
  2014-03-26 21:54           ` Maciej W. Rozycki
  1 sibling, 1 reply; 43+ messages in thread
From: Bernd Edlinger @ 2013-12-18 13:32 UTC (permalink / raw)
  To: Alan Modra; +Cc: gcc-patches, Jakub Jelinek, DJ Delorie, Eric Botcazou

Hi,

On Wed, 18 Dec 2013 09:58:39, 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
>
> --
> Alan Modra
> Australia Development Lab, IBM

Yes. It works. Thanks!


g++ -c -DIN_GCC     -DGENERATOR_FILE -I. -Ibuild -I../../gcc-4.9-20131215/gcc -I../../gcc-4.9-20131215/gcc/build -I../../gcc-4.9-20131215/gcc/../include -I../../gcc-4.9-20131215/gcc/../libcpp/include -I/home/ed/gnu/x/gcc-build-arm-linux-gnueabihf-cross/./gmp -I/home/ed/gnu/x/gcc-4.9-20131215/gmp -I/home/ed/gnu/x/gcc-build-arm-linux-gnueabihf-cross/./mpfr -I/home/ed/gnu/x/gcc-4.9-20131215/mpfr -I/home/ed/gnu/x/gcc-4.9-20131215/mpc/src  -I../../gcc-4.9-20131215/gcc/../libdecnumber -I../../gcc-4.9-20131215/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc-4.9-20131215/gcc/../libbacktrace    \
                -o build/gengtype.o ../../gcc-4.9-20131215/gcc/gengtype.c


I wonder if the GMPINC="" is still necessary, as the actual host g++ invocation also has GMP-directories
but does not use them because of the -DGENERATOR_FILE.


Bernd. 		 	   		  

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-18 13:32           ` Bernd Edlinger
@ 2013-12-19 10:11             ` Alan Modra
  2013-12-19 10:50               ` Bernd Edlinger
  0 siblings, 1 reply; 43+ messages in thread
From: Alan Modra @ 2013-12-19 10:11 UTC (permalink / raw)
  To: Bernd Edlinger; +Cc: gcc-patches, Jakub Jelinek, DJ Delorie, Eric Botcazou

On Wed, Dec 18, 2013 at 02:32:01PM +0100, Bernd Edlinger wrote:
> I wonder if the GMPINC="" is still necessary, as the actual host g++ invocation also has GMP-directories
> but does not use them because of the -DGENERATOR_FILE.

The issue isn't finding gmp.h, it's finding other host headers you
don't want.  Clearly, --with-gmp and similar options are for finding
host libraries and headers.  install.texi even says so!

To give an example of what can go wrong, suppose someone specifies
--with-gmp=/sysroot_for_host for an installed gmp.  Now I know that
it's unnecessary to specify --with-gmp if it's at the default install
location, but many people blindly follow recipes.  What's more,
specifying --with-gmp to the default works fine when build == host.
So it doesn't seem wrong to me to specify --with-gmp (even needlessly
to the default) when build != host.

The trouble is that GMPINC is then /sysroot_for_host/include, which is
where you find all the other host headers, not just gmp.h..

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 43+ messages in thread

* RE: Two build != host fixes
  2013-12-19 10:11             ` Alan Modra
@ 2013-12-19 10:50               ` Bernd Edlinger
  2013-12-19 21:27                 ` Alan Modra
  0 siblings, 1 reply; 43+ messages in thread
From: Bernd Edlinger @ 2013-12-19 10:50 UTC (permalink / raw)
  To: Alan Modra; +Cc: gcc-patches, Jakub Jelinek, DJ Delorie, Eric Botcazou

On Thu, 19 Dec 2013 20:41:43, Alan Modra wrote:
>
> On Wed, Dec 18, 2013 at 02:32:01PM +0100, Bernd Edlinger wrote:
>> I wonder if the GMPINC="" is still necessary, as the actual host g++ invocation also has GMP-directories
>> but does not use them because of the -DGENERATOR_FILE.
>
> The issue isn't finding gmp.h, it's finding other host headers you
> don't want. Clearly, --with-gmp and similar options are for finding
> host libraries and headers. install.texi even says so!
>
> To give an example of what can go wrong, suppose someone specifies
> --with-gmp=/sysroot_for_host for an installed gmp. Now I know that
> it's unnecessary to specify --with-gmp if it's at the default install
> location, but many people blindly follow recipes. What's more,
> specifying --with-gmp to the default works fine when build == host.
> So it doesn't seem wrong to me to specify --with-gmp (even needlessly
> to the default) when build != host.
>
> The trouble is that GMPINC is then /sysroot_for_host/include, which is
> where you find all the other host headers, not just gmp.h..
>

OK, thanks, I understand. I'm just curious...

Isn't the actual invocation of the build-g++ also including /sysroot_for_host/include
in that case? Why doesn't this cause problems then?


Bernd.

> --
> Alan Modra
> Australia Development Lab, IBM 		 	   		  

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-19 10:50               ` Bernd Edlinger
@ 2013-12-19 21:27                 ` Alan Modra
  2013-12-20 12:07                   ` Bernd Edlinger
  0 siblings, 1 reply; 43+ messages in thread
From: Alan Modra @ 2013-12-19 21:27 UTC (permalink / raw)
  To: Bernd Edlinger; +Cc: gcc-patches, Jakub Jelinek, DJ Delorie, Eric Botcazou

On Thu, Dec 19, 2013 at 11:50:02AM +0100, Bernd Edlinger wrote:
> Isn't the actual invocation of the build-g++ also including /sysroot_for_host/include
> in that case? Why doesn't this cause problems then?

Yes, and that causes failures too.  BUILD_CPPFLAGS is the culprit.
See http://gcc.gnu.org/ml/gcc-patches/2013-12/msg01149.html

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 43+ messages in thread

* RE: Two build != host fixes
  2013-12-19 21:27                 ` Alan Modra
@ 2013-12-20 12:07                   ` Bernd Edlinger
  2014-01-07 15:45                     ` Bernd Edlinger
  0 siblings, 1 reply; 43+ messages in thread
From: Bernd Edlinger @ 2013-12-20 12:07 UTC (permalink / raw)
  To: Alan Modra; +Cc: gcc-patches, Jakub Jelinek, DJ Delorie, Eric Botcazou

----------------------------------------
> Date: Fri, 20 Dec 2013 07:57:02 +1030
> From: amodra@gmail.com
> To: bernd.edlinger@hotmail.de
> CC: gcc-patches@gcc.gnu.org; jakub@redhat.com; dj@redhat.com; ebotcazou@adacore.com
> Subject: Re: Two build != host fixes
>
> On Thu, Dec 19, 2013 at 11:50:02AM +0100, Bernd Edlinger wrote:
>> Isn't the actual invocation of the build-g++ also including /sysroot_for_host/include
>> in that case? Why doesn't this cause problems then?
>
> Yes, and that causes failures too. BUILD_CPPFLAGS is the culprit.
> See http://gcc.gnu.org/ml/gcc-patches/2013-12/msg01149.html
>
> --
> Alan Modra
> Australia Development Lab, IBM

Ok, now I understand:
The change with  GMPINC="" is just incomplete, without the other patch.

When I apply the other patch too, I get this (obviously cleaner) build-g++ invocations:
g++ -c -DIN_GCC     -DGENERATOR_FILE -I. -Ibuild -I../../gcc-4.9-20131215/gcc -I../../gcc-4.9-20131215/gcc/build -I../../gcc-4.9-20131215/gcc/../include -I../../gcc-4.9-20131215/gcc/../libcpp/include \
                -o build/gengtype.o ../../gcc-4.9-20131215/gcc/gengtype.c
flex  -ogengtype-lex.c ../../gcc-4.9-20131215/gcc/gengtype-lex.l && { \
          echo '#include "bconfig.h"'> gengtype-lex.c.tmp; \
          cat gengtype-lex.c>> gengtype-lex.c.tmp; \
          mv gengtype-lex.c.tmp gengtype-lex.c; \
        }
g++ -c -DIN_GCC     -DGENERATOR_FILE -I. -Ibuild -I../../gcc-4.9-20131215/gcc -I../../gcc-4.9-20131215/gcc/build -I../../gcc-4.9-20131215/gcc/../include -I../../gcc-4.9-20131215/gcc/../libcpp/include \
                -o build/gengtype-lex.o gengtype-lex.c
g++ -c -DIN_GCC     -DGENERATOR_FILE -I. -Ibuild -I../../gcc-4.9-20131215/gcc -I../../gcc-4.9-20131215/gcc/build -I../../gcc-4.9-20131215/gcc/../include -I../../gcc-4.9-20131215/gcc/../libcpp/include \
                -o build/gengtype-parse.o ../../gcc-4.9-20131215/gcc/gengtype-parse.c
g++ -c -DIN_GCC     -DGENERATOR_FILE -I. -Ibuild -I../../gcc-4.9-20131215/gcc -I../../gcc-4.9-20131215/gcc/build -I../../gcc-4.9-20131215/gcc/../include -I../../gcc-4.9-20131215/gcc/../libcpp/include \
                -o build/gengtype-state.o ../../gcc-4.9-20131215/gcc/gengtype-state.c


Regards
Bernd. 		 	   		  

^ permalink raw reply	[flat|nested] 43+ messages in thread

* RE: Two build != host fixes
  2013-12-20 12:07                   ` Bernd Edlinger
@ 2014-01-07 15:45                     ` Bernd Edlinger
  2014-01-22 14:16                       ` Bernd Edlinger
  0 siblings, 1 reply; 43+ messages in thread
From: Bernd Edlinger @ 2014-01-07 15:45 UTC (permalink / raw)
  To: Alan Modra; +Cc: gcc-patches, Jakub Jelinek, DJ Delorie, Eric Botcazou

Hi Alan,


This issue is not yet resolved, in the moment this cross-compiler issue looks like a regression.

But I have tried your follow-up patches, and they make sense for me:

 http://gcc.gnu.org/ml/gcc-patches/2013-12/msg01149.html
http://gcc.gnu.org/ml/gcc-patches/2013-12/msg01544.html

How can we proceed?

Regards
Bernd.


>>
>> On Thu, Dec 19, 2013 at 11:50:02AM +0100, Bernd Edlinger wrote:
>>> Isn't the actual invocation of the build-g++ also including /sysroot_for_host/include
>>> in that case? Why doesn't this cause problems then?
>>
>> Yes, and that causes failures too. BUILD_CPPFLAGS is the culprit.
>> See http://gcc.gnu.org/ml/gcc-patches/2013-12/msg01149.html
>>
>> --
>> Alan Modra
>> Australia Development Lab, IBM
>
> Ok, now I understand:
> The change with  GMPINC="" is just incomplete, without the other patch.
>
> When I apply the other patch too, I get this (obviously cleaner) build-g++ invocations:
> g++ -c -DIN_GCC     -DGENERATOR_FILE -I. -Ibuild -I../../gcc-4.9-20131215/gcc -I../../gcc-4.9-20131215/gcc/build -I../../gcc-4.9-20131215/gcc/../include -I../../gcc-4.9-20131215/gcc/../libcpp/include \
>                 -o build/gengtype.o ../../gcc-4.9-20131215/gcc/gengtype.c
> flex  -ogengtype-lex.c ../../gcc-4.9-20131215/gcc/gengtype-lex.l && { \
>           echo '#include "bconfig.h"'> gengtype-lex.c.tmp; \
>           cat gengtype-lex.c>> gengtype-lex.c.tmp; \
>           mv gengtype-lex.c.tmp gengtype-lex.c; \
>         }
> g++ -c -DIN_GCC     -DGENERATOR_FILE -I. -Ibuild -I../../gcc-4.9-20131215/gcc -I../../gcc-4.9-20131215/gcc/build -I../../gcc-4.9-20131215/gcc/../include -I../../gcc-4.9-20131215/gcc/../libcpp/include \
>                 -o build/gengtype-lex.o gengtype-lex.c
> g++ -c -DIN_GCC     -DGENERATOR_FILE -I. -Ibuild -I../../gcc-4.9-20131215/gcc -I../../gcc-4.9-20131215/gcc/build -I../../gcc-4.9-20131215/gcc/../include -I../../gcc-4.9-20131215/gcc/../libcpp/include \
>                 -o build/gengtype-parse.o ../../gcc-4.9-20131215/gcc/gengtype-parse.c
> g++ -c -DIN_GCC     -DGENERATOR_FILE -I. -Ibuild -I../../gcc-4.9-20131215/gcc -I../../gcc-4.9-20131215/gcc/build -I../../gcc-4.9-20131215/gcc/../include -I../../gcc-4.9-20131215/gcc/../libcpp/include \
>                 -o build/gengtype-state.o ../../gcc-4.9-20131215/gcc/gengtype-state.c
>
>
> Regards
> Bernd. 		 	   		  

^ permalink raw reply	[flat|nested] 43+ messages in thread

* RE: Two build != host fixes
  2014-01-07 15:45                     ` Bernd Edlinger
@ 2014-01-22 14:16                       ` Bernd Edlinger
  2014-01-23  3:46                         ` Alan Modra
  0 siblings, 1 reply; 43+ messages in thread
From: Bernd Edlinger @ 2014-01-22 14:16 UTC (permalink / raw)
  To: Alan Modra; +Cc: gcc-patches, Jakub Jelinek, DJ Delorie, Eric Botcazou

[-- Attachment #1: Type: text/plain, Size: 600 bytes --]

Hi,


it is quite late in P3 now, so how about the attached patch?

This would return to the status quo before your patch, where $GMPINC must be != sysroot.


Bernd.

> Date: Tue, 7 Jan 2014 16:45:15 +0100
>
> Hi Alan,
>
>
> This issue is not yet resolved, in the moment this cross-compiler issue looks like a regression.
>
> But I have tried your follow-up patches, and they make sense for me:
>
> http://gcc.gnu.org/ml/gcc-patches/2013-12/msg01149.html
> http://gcc.gnu.org/ml/gcc-patches/2013-12/msg01544.html
>
> How can we proceed?
>
> Regards
> Bernd.
>
> 		 	   		  

[-- Attachment #2: patch-cross-build.diff --]
[-- Type: application/octet-stream, Size: 1028 bytes --]

--- gcc/configure	2013-12-05 08:11:17.000000000 +0100
+++ gcc/configure	2013-12-11 09:36:03.628779968 +0100
@@ -11288,7 +11288,8 @@ else
 	*) realsrcdir=../${srcdir};;
 	esac
 	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
-	LDFLAGS="${LDFLAGS_FOR_BUILD}" GMPINC="" \
+	CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
+	LDFLAGS="${LDFLAGS_FOR_BUILD}" \
 	${realsrcdir}/configure \
 		--enable-languages=${enable_languages-all} \
 		--target=$target_alias --host=$build_alias --build=$build_alias
--- gcc/configure.ac	2013-12-05 08:11:17.000000000 +0100
+++ gcc/configure.ac	2013-12-11 08:59:36.064751311 +0100
@@ -1530,7 +1530,8 @@ else
 	*) realsrcdir=../${srcdir};;
 	esac
 	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
-	LDFLAGS="${LDFLAGS_FOR_BUILD}" GMPINC="" \
+	CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
+	LDFLAGS="${LDFLAGS_FOR_BUILD}" \
 	${realsrcdir}/configure \
 		--enable-languages=${enable_languages-all} \
 		--target=$target_alias --host=$build_alias --build=$build_alias

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2014-01-22 14:16                       ` Bernd Edlinger
@ 2014-01-23  3:46                         ` Alan Modra
  2014-01-23  4:21                           ` Jeff Law
  0 siblings, 1 reply; 43+ messages in thread
From: Alan Modra @ 2014-01-23  3:46 UTC (permalink / raw)
  To: Bernd Edlinger; +Cc: gcc-patches, DJ Delorie

I was hoping for a reply from someone who could OK the previous patches
submitted.  Admittedly, I didn't tick all the boxes (no changelog entry),
so here they are again.

The Makefile.in BUILD_CPPFLAGS change is for exactly the same reason
as my 2013-12-05 change.  When GMPINC points at an installed host gmp,
it results in picking up other host headers, which might be wrong for
the build machine.  We found this to be true even for very similar
build and host machines, in our case a powerpc64-linux build,
powerpc64le-linux host and target configuration, where differences in
glibc version between the build and host were enough to cause errors.

The configure.ac change is to fix a bug Bernd found when gmp is
in-tree but not installed.  In that case the recursive configure fails
due to system.h wanting to include gmp.h and not finding it:

/* Do not introduce a gmp.h dependency on the build system.  */
#ifndef GENERATOR_FILE
#include <gmp.h>
#endif

So, define GENERATOR_FILE for configure as we do when actually running
the build compiler.  The other changes are for consistency, but are
not strictly necessary.  I left them in this patch because they make
sense to me, and that's the way both Bernd and I tested this patch.

OK for mainline?

Bernd, if this isn't approved then I'll revert my previous change.
I believe I can do that without approval.

	* 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.

Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 206915)
+++ gcc/Makefile.in	(working copy)
@@ -761,7 +761,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 $(CPPINC)
 
 # 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 206915)
+++ 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


-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2014-01-23  3:46                         ` Alan Modra
@ 2014-01-23  4:21                           ` Jeff Law
  2014-01-23 23:02                             ` Alan Modra
  0 siblings, 1 reply; 43+ messages in thread
From: Jeff Law @ 2014-01-23  4:21 UTC (permalink / raw)
  To: Bernd Edlinger, gcc-patches, DJ Delorie

On 01/22/14 20:46, Alan Modra wrote:
> I was hoping for a reply from someone who could OK the previous patches
> submitted.  Admittedly, I didn't tick all the boxes (no changelog entry),
> so here they are again.
It's been in my stack of patches, others may be shying away from the 
insanity that is our build system.


>
> The Makefile.in BUILD_CPPFLAGS change is for exactly the same reason
> as my 2013-12-05 change.  When GMPINC points at an installed host gmp,
> it results in picking up other host headers, which might be wrong for
> the build machine.  We found this to be true even for very similar
> build and host machines, in our case a powerpc64-linux build,
> powerpc64le-linux host and target configuration, where differences in
> glibc version between the build and host were enough to cause errors.
>
> The configure.ac change is to fix a bug Bernd found when gmp is
> in-tree but not installed.  In that case the recursive configure fails
> due to system.h wanting to include gmp.h and not finding it:
>
> /* Do not introduce a gmp.h dependency on the build system.  */
> #ifndef GENERATOR_FILE
> #include <gmp.h>
> #endif
>
> So, define GENERATOR_FILE for configure as we do when actually running
> the build compiler.  The other changes are for consistency, but are
> not strictly necessary.  I left them in this patch because they make
> sense to me, and that's the way both Bernd and I tested this patch.
>
> OK for mainline?
>
> Bernd, if this isn't approved then I'll revert my previous change.
> I believe I can do that without approval.
>
> 	* 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.
The configure.ac changes look fine to me.

Not sure about the Makefile.in changes, probably because I simply don't 
understand this mess anymore.  Is it the $INCLUDES or $CPPFLAGS from 
ALL_CPPFLAGS that causes the problem?  I'm guessing the latter since 
it's substituted via @CPPFLAGS@.

If so, shouldn't we use BUILD_CPPFLAGS=$INCLUDES $(CPPINC)?

Jeff

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2014-01-23  4:21                           ` Jeff Law
@ 2014-01-23 23:02                             ` Alan Modra
  2014-01-24 17:34                               ` Jeff Law
  0 siblings, 1 reply; 43+ messages in thread
From: Alan Modra @ 2014-01-23 23:02 UTC (permalink / raw)
  To: Jeff Law; +Cc: Bernd Edlinger, gcc-patches, DJ Delorie

On Wed, Jan 22, 2014 at 09:21:46PM -0700, Jeff Law wrote:
> >	* 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.
> The configure.ac changes look fine to me.

Thanks!  That part alone ought to fix the in-tree gmp breakage.

> Not sure about the Makefile.in changes, probably because I simply
> don't understand this mess anymore.  Is it the $INCLUDES or
> $CPPFLAGS from ALL_CPPFLAGS that causes the problem?  I'm guessing
> the latter since it's substituted via @CPPFLAGS@.
> 
> If so, shouldn't we use BUILD_CPPFLAGS=$INCLUDES $(CPPINC)?

INCLUDES is the problem.

INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
	   -I$(srcdir)/../include @INCINTL@ \
	   $(CPPINC) $(GMPINC) $(DECNUMINC) $(BACKTRACEINC) \
	   $(CLOOGINC) $(ISLINC)

That's where we potentially have GMPINC fouling the build compile with
host headers, ditto for GLOOGINC and ISLINC.  DECNUMINC and
BACKTRACEINC are in-tree so don't cause any problem, but we don't need
either of those when running COMPILER_FOR_BUILD for any of gen*.

Of course, then your question becomes, why exclude CPPFLAGS?  (And if
CPPFLAGS needs to be excluded here, then I should have just used
CPPFLAGS=-DGENERATOR_FILE for the recursive configure call..)  I'm not
sure now, I'll have to do some digging.  Also as to why @INCINTL@ was
removed, when gettext is potentially needed for the gen programs.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2014-01-23 23:02                             ` Alan Modra
@ 2014-01-24 17:34                               ` Jeff Law
  2014-01-28  7:27                                 ` Alan Modra
  0 siblings, 1 reply; 43+ messages in thread
From: Jeff Law @ 2014-01-24 17:34 UTC (permalink / raw)
  To: Bernd Edlinger, gcc-patches, DJ Delorie

On 01/23/14 16:02, Alan Modra wrote:
> On Wed, Jan 22, 2014 at 09:21:46PM -0700, Jeff Law wrote:
>>> 	* 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.
>> The configure.ac changes look fine to me.
>
> Thanks!  That part alone ought to fix the in-tree gmp breakage.
Feel free to push that one through now since it seems like a bit of a 
no-brainer.


>
>> Not sure about the Makefile.in changes, probably because I simply
>> don't understand this mess anymore.  Is it the $INCLUDES or
>> $CPPFLAGS from ALL_CPPFLAGS that causes the problem?  I'm guessing
>> the latter since it's substituted via @CPPFLAGS@.
>>
>> If so, shouldn't we use BUILD_CPPFLAGS=$INCLUDES $(CPPINC)?
>
> INCLUDES is the problem.
>
> INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
> 	   -I$(srcdir)/../include @INCINTL@ \
> 	   $(CPPINC) $(GMPINC) $(DECNUMINC) $(BACKTRACEINC) \
> 	   $(CLOOGINC) $(ISLINC)
?!?  Not sure how I missed that.  Yea, and thanks for touching on ISLINC 
and CLOOGINC since those were my first thoughts when I looked at this again.

> Of course, then your question becomes, why exclude CPPFLAGS?  (And if
> CPPFLAGS needs to be excluded here, then I should have just used
> CPPFLAGS=-DGENERATOR_FILE for the recursive configure call..)  I'm not
> sure now, I'll have to do some digging.  Also as to why @INCINTL@ was
> removed, when gettext is potentially needed for the gen programs.
Thanks.  My inclination is to go forward with this hunk as well, with 
any tweaks you find after investigating the situation around CPPFLAGS.

Jeff


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2014-01-24 17:34                               ` Jeff Law
@ 2014-01-28  7:27                                 ` Alan Modra
  0 siblings, 0 replies; 43+ messages in thread
From: Alan Modra @ 2014-01-28  7:27 UTC (permalink / raw)
  To: Jeff Law; +Cc: Bernd Edlinger, gcc-patches, DJ Delorie

On Fri, Jan 24, 2014 at 10:34:10AM -0700, Jeff Law wrote:
> >Of course, then your question becomes, why exclude CPPFLAGS?  (And if
> >CPPFLAGS needs to be excluded here, then I should have just used
> >CPPFLAGS=-DGENERATOR_FILE for the recursive configure call..)  I'm not
> >sure now, I'll have to do some digging.  Also as to why @INCINTL@ was
> >removed, when gettext is potentially needed for the gen programs.
> Thanks.  My inclination is to go forward with this hunk as well,
> with any tweaks you find after investigating the situation around
> CPPFLAGS.

I committed the configure.ac change as is and restored CPPFLAGS
and @INCINTL@ to the Makefile.in BUILD_CPPFLAGS.

CPPFLAGS is set from the top level makefile CPPFLAGS_FOR_TARGET.  It's
questionable whether using CPPFLAGS_FOR_TARGET is really correct for
BUILD_CPPFLAGS but leaving it in is probably safer.  Who knows what
weird use is being made of CPPFLAGS_FOR_TARGET?

@INCINTL@ is set to -I${top_builddir}/../intl when someone configures
using --with-included-gettext.  It seems reasonable to me that
-with-included-gettext affect both build and host.

Thanks everyone for your patience.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-17 23:28         ` Alan Modra
  2013-12-18 13:32           ` Bernd Edlinger
@ 2014-03-26 21:54           ` Maciej W. Rozycki
  2014-03-27  5:56             ` Alan Modra
  1 sibling, 1 reply; 43+ messages in thread
From: Maciej W. Rozycki @ 2014-03-26 21:54 UTC (permalink / raw)
  To: Alan Modra
  Cc: Bernd Edlinger, gcc-patches, Jakub Jelinek, DJ Delorie, Eric Botcazou

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?

 Thanks,

  Maciej

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2014-03-26 21:54           ` Maciej W. Rozycki
@ 2014-03-27  5:56             ` Alan Modra
  2014-04-04 15:47               ` Jeff Law
  0 siblings, 1 reply; 43+ messages in thread
From: Alan Modra @ 2014-03-27  5:56 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: Bernd Edlinger, gcc-patches, Jakub Jelinek, DJ Delorie, Eric Botcazou

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.

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

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2014-03-27  5:56             ` Alan Modra
@ 2014-04-04 15:47               ` Jeff Law
  0 siblings, 0 replies; 43+ messages in thread
From: Jeff Law @ 2014-04-04 15:47 UTC (permalink / raw)
  To: Maciej W. Rozycki, Bernd Edlinger, gcc-patches, Jakub Jelinek,
	DJ Delorie, Eric Botcazou

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
>

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-09  4:34   ` Alan Modra
@ 2013-12-09  7:06     ` Jakub Jelinek
  0 siblings, 0 replies; 43+ messages in thread
From: Jakub Jelinek @ 2013-12-09  7:06 UTC (permalink / raw)
  To: gcc-patches

On Mon, Dec 09, 2013 at 03:04:44PM +1030, Alan Modra wrote:
> On Tue, Dec 03, 2013 at 11:44:46PM -0500, DJ Delorie wrote:
> > Alan Modra <amodra@gmail.com> writes:
> > > Bootstrapped etc. powerpc64-linux.  OK mainline and 4.8 branch?
> > >
> > > 	* configure.ac (BUILD_CXXFLAGS) Don't use ALL_CXXFLAGS for
> > > 	build != host.
> > > 	<recursive call for build != host>: Clear GMPINC.  Don't bother
> > > 	saving CFLAGS.
> > > 	* configure: Regenerate.
> > 
> > Ok for mainline, up to the 4.8 release manager if it's OK there but it
> > looks OK to me.
> 
> http://gcc.gnu.org/ml/gcc-patches/2013-12/msg00304.html
> Ping for 4.8?

Okay.

	Jakub

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-04  4:44 ` DJ Delorie
  2013-12-04  6:07   ` Alan Modra
@ 2013-12-09  4:34   ` Alan Modra
  2013-12-09  7:06     ` Jakub Jelinek
  1 sibling, 1 reply; 43+ messages in thread
From: Alan Modra @ 2013-12-09  4:34 UTC (permalink / raw)
  To: jakub; +Cc: gcc-patches

On Tue, Dec 03, 2013 at 11:44:46PM -0500, DJ Delorie wrote:
> Alan Modra <amodra@gmail.com> writes:
> > Bootstrapped etc. powerpc64-linux.  OK mainline and 4.8 branch?
> >
> > 	* configure.ac (BUILD_CXXFLAGS) Don't use ALL_CXXFLAGS for
> > 	build != host.
> > 	<recursive call for build != host>: Clear GMPINC.  Don't bother
> > 	saving CFLAGS.
> > 	* configure: Regenerate.
> 
> Ok for mainline, up to the 4.8 release manager if it's OK there but it
> looks OK to me.

http://gcc.gnu.org/ml/gcc-patches/2013-12/msg00304.html
Ping for 4.8?

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-04  6:07   ` Alan Modra
@ 2013-12-05  7:28     ` Alan Modra
  0 siblings, 0 replies; 43+ messages in thread
From: Alan Modra @ 2013-12-05  7:28 UTC (permalink / raw)
  To: DJ Delorie, gcc-patches

On Wed, Dec 04, 2013 at 04:36:58PM +1030, Alan Modra wrote:
> Maybe we should use most of BUILD_EXPORTS in the top level
> Makefile.in?  What can go wrong with that? :)

I had a look at this, as it's easy to do, but I didn't find any
significant bug to justify such a change in stage3.  So I've committed
the original patch as posted, rev 205690.

I did run into other problems in the process:  Running configure in
the gcc directory rather than at the top level is apparently a bad
idea nowadays for a canadian cross.  For example, absent an
AS_FOR_TARGET or DEFAULT_ASSEMBLER definition, configure doesn't find
an assembler..

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-04  4:44 ` DJ Delorie
@ 2013-12-04  6:07   ` Alan Modra
  2013-12-05  7:28     ` Alan Modra
  2013-12-09  4:34   ` Alan Modra
  1 sibling, 1 reply; 43+ messages in thread
From: Alan Modra @ 2013-12-04  6:07 UTC (permalink / raw)
  To: DJ Delorie; +Cc: gcc-patches

On Tue, Dec 03, 2013 at 11:44:46PM -0500, DJ Delorie wrote:
> Alan Modra <amodra@gmail.com> writes:
> > Bootstrapped etc. powerpc64-linux.  OK mainline and 4.8 branch?
> >
> > 	* configure.ac (BUILD_CXXFLAGS) Don't use ALL_CXXFLAGS for
> > 	build != host.
> > 	<recursive call for build != host>: Clear GMPINC.  Don't bother
> > 	saving CFLAGS.
> > 	* configure: Regenerate.
> 
> Ok for mainline, up to the 4.8 release manager if it's OK there but it
> looks OK to me.
> 
> Do we need to add a CXXFLAGS= to that configure too?

We basically need whatever is used to make decisions for auto-host.h
(auto-build.h) contents.  I hadn't found CXXFLAGS necessary, but that
might just be similarity of build to host in my case or simply lack of
noticing a configury error..  I guess adding CXXFLAGS might be a good
idea for future-proofing.

Hmm, this is opening up a whole can of worms.  auto-host.h definitely
contains info about assembler capabilities, so to get a "good"
auto-build.h we really ought to set AS=$AS_FOR_BUILD too.  Similar
reasoning applies to LD= for all the HAVE_LD_* macros.  Whether a
"good" auto-build.h makes any difference over a "bad" one is another
question.

Maybe we should use most of BUILD_EXPORTS in the top level
Makefile.in?  What can go wrong with that? :)

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: Two build != host fixes
  2013-12-04  1:14 Alan Modra
@ 2013-12-04  4:44 ` DJ Delorie
  2013-12-04  6:07   ` Alan Modra
  2013-12-09  4:34   ` Alan Modra
  0 siblings, 2 replies; 43+ messages in thread
From: DJ Delorie @ 2013-12-04  4:44 UTC (permalink / raw)
  To: Alan Modra; +Cc: gcc-patches

Alan Modra <amodra@gmail.com> writes:
> Bootstrapped etc. powerpc64-linux.  OK mainline and 4.8 branch?
>
> 	* configure.ac (BUILD_CXXFLAGS) Don't use ALL_CXXFLAGS for
> 	build != host.
> 	<recursive call for build != host>: Clear GMPINC.  Don't bother
> 	saving CFLAGS.
> 	* configure: Regenerate.

Ok for mainline, up to the 4.8 release manager if it's OK there but it
looks OK to me.

Do we need to add a CXXFLAGS= to that configure too?

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Two build != host fixes
@ 2013-12-04  1:14 Alan Modra
  2013-12-04  4:44 ` DJ Delorie
  0 siblings, 1 reply; 43+ messages in thread
From: Alan Modra @ 2013-12-04  1:14 UTC (permalink / raw)
  To: gcc-patches

When build != host, the build compiler obviously isn't the same as the
host compiler, but BUILD_CXXFLAGS is currently ALL_CXXFLAGS.
ALL_CXXFLAGS contains flags for which we run configure tests on the
host compiler, which may not work on the build compiler.  I ran into
this with -Wno-narrowing.  It looks like this problem has been hit
before when we used to build gcc with a C compiler and solved, but the
solution needs extending now that we build with a C++ compiler.

The second problem is that GMPINC (specifying a host include path) may
not be correct for the build compiler.  I found this caused a lot of
build configure failures when attempting a build=powerpc64-linux,
host=powerpc64le-linux, target=powerpc64le-linux toolchain due to
mismatches in various function declarations between build and host.
The configure problems caused later build failure.  (Hint for anyone
trying to debug canadian crosses: comment out "rm -rf $tempdir" just a
few lines below the first hunk in the patch below to see the build
config.log.)

The other little tweak here is to omit saving CFLAGS.  CFLAGS is set
here only in the environment of the called command, not the caller
shell.  So there is no need to save and restore.

Bootstrapped etc. powerpc64-linux.  OK mainline and 4.8 branch?

	* configure.ac (BUILD_CXXFLAGS) Don't use ALL_CXXFLAGS for
	build != host.
	<recursive call for build != host>: Clear GMPINC.  Don't bother
	saving CFLAGS.
	* configure: Regenerate.

Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 205341)
+++ gcc/configure.ac	(working copy)
@@ -1529,13 +1529,11 @@
 	/* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
 	*) realsrcdir=../${srcdir};;
 	esac
-	saved_CFLAGS="${CFLAGS}"
 	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
-	LDFLAGS="${LDFLAGS_FOR_BUILD}" \
+	LDFLAGS="${LDFLAGS_FOR_BUILD}" GMPINC="" \
 	${realsrcdir}/configure \
 		--enable-languages=${enable_languages-all} \
 		--target=$target_alias --host=$build_alias --build=$build_alias
-	CFLAGS="${saved_CFLAGS}"
 
 	# We just finished tests for the build machine, so rename
 	# the file auto-build.h in the gcc directory.
@@ -1900,6 +1898,7 @@
 if test x$build != x$host || test "x$coverage_flags" != x
 then
     BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
+    BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CXXFLAGS_FOR_BUILD)'
     BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
 fi
 

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2014-04-04 15:47 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-11 11:10 Two build != host fixes Bernd Edlinger
2013-12-11 12:42 ` Alan Modra
2013-12-11 13:11   ` Bernd Edlinger
2013-12-11 13:32     ` Iain Sandoe
2013-12-11 14:44       ` Eric Botcazou
2013-12-12 12:11         ` Bernd Edlinger
2013-12-12 12:27           ` Eric Botcazou
2013-12-12 13:19             ` Bernd Edlinger
2013-12-12 15:23               ` Eric Botcazou
2013-12-13  8:08                 ` Bernd Edlinger
2013-12-13  8:21                   ` Eric Botcazou
2013-12-12 12:28           ` Iain Sandoe
2013-12-12 12:35             ` Eric Botcazou
2013-12-12 12:45               ` Iain Sandoe
2013-12-12 15:23                 ` Eric Botcazou
2013-12-12 17:05                   ` Iain Sandoe
2013-12-12 17:22                     ` Eric Botcazou
2013-12-12 17:31                       ` Iain Sandoe
2013-12-12 20:07                         ` Eric Botcazou
2013-12-12  1:02     ` Alan Modra
2013-12-17 12:14       ` Bernd Edlinger
2013-12-17 23:28         ` Alan Modra
2013-12-18 13:32           ` Bernd Edlinger
2013-12-19 10:11             ` Alan Modra
2013-12-19 10:50               ` Bernd Edlinger
2013-12-19 21:27                 ` Alan Modra
2013-12-20 12:07                   ` Bernd Edlinger
2014-01-07 15:45                     ` Bernd Edlinger
2014-01-22 14:16                       ` Bernd Edlinger
2014-01-23  3:46                         ` Alan Modra
2014-01-23  4:21                           ` Jeff Law
2014-01-23 23:02                             ` Alan Modra
2014-01-24 17:34                               ` Jeff Law
2014-01-28  7:27                                 ` Alan Modra
2014-03-26 21:54           ` Maciej W. Rozycki
2014-03-27  5:56             ` Alan Modra
2014-04-04 15:47               ` Jeff Law
  -- strict thread matches above, loose matches on Subject: below --
2013-12-04  1:14 Alan Modra
2013-12-04  4:44 ` DJ Delorie
2013-12-04  6:07   ` Alan Modra
2013-12-05  7:28     ` Alan Modra
2013-12-09  4:34   ` Alan Modra
2013-12-09  7:06     ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).