This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Configure problem


On Thu, May 13, 2004 at 07:43:46PM -0700, Jim Wilson wrote:
> Zdenek Dvorak wrote:
> >pwd: /abuild/gcc-test/gcc/objdir/x86_64-unknown-linux-gnu/libobjc
> >Running configure in multilib subdir 32
> >pwd: /abuild/gcc-test/gcc/objdir/x86_64-unknown-linux-gnu
> >configure: loading cache ./config.cache
> >configure: error: `target_alias' was not set in the previous run
> 
> I can reproduce this even without multilibs on x86-linux
>   cvs update
>   mkdir objdir
>   cd objdir
>   ../configure
>   make
>   touch ../gcc/libobjc/Makefile.in
>   make

How?  When I do this, config.status is rerun, but configure isn't. 
Both rules which change or rerun configure remove config.cache, and
have since the first import of libobjc.  So I can't reproduce this in
libobjc by touching configure either.

I can reproduce it by touching libiberty/configure, though.

> The problem here is that the original sub configure happened from the 
> toplevel Makefile, and a small number of variables are set in the 
> environment before we call the sub configure.  The second configure 
> happens from a sub-make, and a large number of variables 
> (BASE_FLAGS_TO_PASS) are set in the environment when we call a sub-make. 
>  configure notices when the value of precious variables differs on 
> reconfigure, and gives an error.
> 
> We can fix the problem by adding the missing variables to the 
> environment before calling sub configures.  See my April 15 change to 
> the toplevel Makefile.tpl.

It appears that one of the many problems here is that in the first
configuration, we export some variables explicitly from the top-level
Makefile and invoke configure.  Then if we have to reconfigure, it gets
invoked from the second-level Makefile.  The top level uses .NOEXPORT;
the second level Makefiles vary in whether they do or not.  All but
libiberty, libobjc, and libada do use it.

I believe all the target libraries should, but that's a separate
problem.

This patch fixes the only ways I could reliably reproduce this error.
The definitions of host_alias and target_alias are a little strange
looking, but match what is done by configure.in: host=target=build for
build modules, host=host, target=target for host modules, host=target
for target modules.  OK?

-- 
Daniel Jacobowitz

2004-05-18  Daniel Jacobowitz  <drow@false.org>

	* Makefile.tpl (configure-build-[+module+]): Export aliases
	for build targets.
	(configure-target-[+module+]): Likewise for target modules.
	(configure-[+module+], configure-gcc, configure-stage1-gcc)
	(configure-stage2-gcc, configure-stage3-gcc): Likewise for host
	modules.
	* Makefile.in: Regenerated.

Index: Makefile.tpl
===================================================================
RCS file: /big/fsf/rsync/gcc-cvs/gcc/Makefile.tpl,v
retrieving revision 1.96
diff -u -p -r1.96 Makefile.tpl
--- a/Makefile.tpl	18 May 2004 01:25:58 -0000	1.96
+++ b/Makefile.tpl	18 May 2004 20:58:50 -0000
@@ -702,6 +702,9 @@ configure-build-[+module+]:
 	$(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/[+module+] ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	build_alias="$(build_alias)"; export build_alias; \
+	host_alias="$(build_alias)"; export host_alias; \
+	target_alias="$(build_alias)"; export target_alias; \
 	AR="$(AR_FOR_BUILD)"; export AR; \
 	AS="$(AS_FOR_BUILD)"; export AS; \
 	CC="$(CC_FOR_BUILD)"; export CC; \
@@ -777,6 +780,9 @@ configure-[+module+]:
 	[ -d [+module+] ] || mkdir [+module+]; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	build_alias="$(build_alias)"; export build_alias; \
+	host_alias="$(host_alias)"; export host_alias; \
+	target_alias="$(target_alias)"; export target_alias; \
 	CC="$(CC)"; export CC; \
 	CFLAGS="$(CFLAGS)"; export CFLAGS; \
 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
@@ -913,6 +919,9 @@ configure-target-[+module+]: $(TARGET_SU
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(SET_LIB_PATH) \
+	build_alias="$(build_alias)"; export build_alias; \
+	host_alias="$(target_alias)"; export host_alias; \
+	target_alias="$(target_alias)"; export target_alias; \
 	AR="$(AR_FOR_TARGET)"; export AR; \
 	AS="$(AS_FOR_TARGET)"; export AS; \
 	CC="$(CC_FOR_TARGET)"; export CC; \
@@ -1073,6 +1082,9 @@ configure-gcc:
 	[ -d gcc ] || mkdir gcc; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	build_alias="$(build_alias)"; export build_alias; \
+	host_alias="$(host_alias)"; export host_alias; \
+	target_alias="$(target_alias)"; export target_alias; \
 	CC="$(CC)"; export CC; \
 	CFLAGS="$(CFLAGS)"; export CFLAGS; \
 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
@@ -1335,6 +1347,9 @@ configure-stage1-gcc:
 	mv stage1-gcc gcc ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	build_alias="$(build_alias)"; export build_alias; \
+	host_alias="$(host_alias)"; export host_alias; \
+	target_alias="$(target_alias)"; export target_alias; \
 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
 	TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
 	CC="$(CC)"; export CC; \
@@ -1408,6 +1423,9 @@ configure-stage2-gcc: all-stage1-gcc
 	mv stage1-gcc prev-gcc ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	build_alias="$(build_alias)"; export build_alias; \
+	host_alias="$(host_alias)"; export host_alias; \
+	target_alias="$(target_alias)"; export target_alias; \
 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
 	TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
 	CFLAGS="$(CFLAGS)"; export CFLAGS; \
@@ -1482,6 +1500,9 @@ configure-stage3-gcc: all-stage2-gcc
 	mv stage2-gcc prev-gcc ; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	build_alias="$(build_alias)"; export build_alias; \
+	host_alias="$(host_alias)"; export host_alias; \
+	target_alias="$(target_alias)"; export target_alias; \
 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
 	TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
 	CFLAGS="$(CFLAGS)"; export CFLAGS; \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]