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]

rebuilding regression


The recent Libtool update in the GCC tree exposed a rebuild regression.
In an up to date build tree (target x86_64-unknown-linux-gnu), do

  cd $target
  rm 32/libstdc++-v3/Makefile 32/libjava/Makefile
  cd -

  touch $top_srcdir/libjava/configure $top_srcdir/libstdc++-v3/configure

(this can happen automatically after 'contrib/gcc_update' when toplevel
causes a changed configuration).  Then, first the toplevel will cause a
configure check; the 'make' inside v3 will trigger another recheck, and
afterwards fail with something like

  make[4]: Entering directory `/opt/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/include'
  mkdir -p ./x86_64-unknown-linux-gnu/bits/stdc++.h.gch
  g++ -x c++-header -g -O2 -D_GNU_SOURCE -I/opt/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu -I/opt/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/include -I/opt/gcc/gcc/libstdc++-v3/libsupc++ -O2 -g -std=gnu++0x /opt/gcc/gcc/libstdc++-v3/include/precompiled/stdc++.h \
          -o x86_64-unknown-linux-gnu/bits/stdc++.h.gch/O2ggnu++0x.gch
  cc1plus: error: unrecognized command line option "-std=gnu++0x"
  make[4]: *** [x86_64-unknown-linux-gnu/bits/stdc++.h.gch/O2ggnu++0x.gch] Error 1
  make[4]: Leaving directory `/opt/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/include'


The reason this is exposed now is that Libtool macros have eliminated a
couple of formerly duplicate checks, esp. calling AC_PROG_CXX again.
The duplicate AC_PROG_CXX caused $CXX to be precious, only its removal
now made this code effective (libstdc++-v3/configure.ac and libjava):

  [...]
  # We must also force CXX to /not/ be a precious variable, otherwise the
  # wrong (non-multilib-adjusted) value will be used in multilibs.  This
  # little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS.  And as a side
  # effect, CXXFLAGS is no longer automagically subst'd, so we have to do
  # that ourselves.  Un-preciousing AC_PROG_CC also affects CC and CFLAGS.
  #
  # -fno-builtin must be present here so that a non-conflicting form of
  # std::exit can be guessed by AC_PROG_CXX, and used in later tests.

  m4_define([ac_cv_prog_CXX],[glibcxx_cv_prog_CXX])
  m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS])
  m4_define([_AC_ARG_VAR_PRECIOUS],[])
  save_CXXFLAGS="$CXXFLAGS"
  CXXFLAGS="$CXXFLAGS -fno-builtin"
  AC_PROG_CC
  AC_PROG_CXX
  CXXFLAGS="$save_CXXFLAGS"
  m4_rename_force([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
  AC_SUBST(CFLAGS)
  AC_SUBST(CXXFLAGS)


The un-preciousing was done in r70167 and in r70319, see
<http://gcc.gnu.org/ml/gcc-patches/2003-08/msg00637.html>, because that
was messing up cache files, that, *at the time*, were still shared
between different directories.  This sharing was only undone later, in
<http://gcc.gnu.org/ml/gcc-patches/2004-01/msg00304.html>, to fix PR's
11932 and 11933.

But now that cache files are not shared any more, the reason for not
preciousing variables is gone, but the recheck issue is there instead:
when `./config.status --recheck' is triggered, the values of $CXX as
exported from the toplevel Makefile is not visible any more, and since
CXX is not precious, it is not saved on the command line for the
configure recheck invocation.

The patch below fixes the issue for me.

At this point, I am not yet asking for inclusion of the patch.  I need a
way, a description to ensure that the patch doesn't reopen bugs that the
removed code was used to avoid.  Would I need to configure with LDFLAGS
set, or -m32 in CC or CXX?  Maybe it would suffice instead to make CC
and CXX precious.

Thanks,
Ralf

libjava/ChangeLog:
2009-12-12  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* configure.ac: Remove code to un-precious-ize CC, CXX,
	CXXFLAGS, CFLAGS, LDFLAGS.
	* configure: Regenerate.

libstdc++-v3/ChangeLog:
2009-12-12  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* configure.ac: Remove code to un-precious-ize CC, CXX,
	CXXFLAGS, CFLAGS, LDFLAGS.
	* configure: Regenerate.

diff --git a/libjava/configure.ac b/libjava/configure.ac
index d8cb610..3721e1c 100644
--- a/libjava/configure.ac
+++ b/libjava/configure.ac
@@ -142,27 +142,14 @@ AM_CONDITIONAL(JAVA_MAINTAINER_MODE, test "$enable_java_maintainer_mode" = yes)
 # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX.
 GCC_NO_EXECUTABLES
 
-# (1) We use an abnormal CXX (without library references), so we
-# must cache it under a different name.
-# (2) CC, CFLAGS, CXX, CXXFLAGS, LDFLAGS must not be 'precious', or
-# the non-multilib-adjusted value will be used in multilibs.
-# (3) As a side effect, we must SUBST CXXFLAGS, CFLAGS, and LDFLAGS ourselves.
-# (4) As another side effect, automake doesn't automatically include them
-# in Makefile.in.
-# (5) For libstdc++-v3, -fno-builtin must be present here so that a
+# For libstdc++-v3, -fno-builtin must be present here so that a
 # non-conflicting form of std::exit can be guessed by AC_PROG_CXX, and
 # used in later tests.  This may not be necessary in libjava; I don't know.
-m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS])
-m4_define([_AC_ARG_VAR_PRECIOUS],[])
 save_CXXFLAGS="$CXXFLAGS"
 CXXFLAGS="$CXXFLAGS -fno-builtin"
 AC_PROG_CC
 AC_PROG_CXX
 CXXFLAGS="$save_CXXFLAGS"
-m4_rename_force([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
-AC_SUBST(CFLAGS)
-AC_SUBST(CXXFLAGS)
-AC_SUBST(LDFLAGS)
 
 AM_INIT_AUTOMAKE([1.9.0])
 
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 1fd8119..2ee2bdb 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -78,34 +78,14 @@ AM_INIT_AUTOMAKE([1.9.3 no-define foreign no-dependencies -Wall -Wno-portability
 AH_TEMPLATE(PACKAGE, [Name of package])
 AH_TEMPLATE(VERSION, [Version number of package])
 
-# We're almost certainly being configured before anything else which uses
-# C++, so all of our AC_PROG_* discoveries will be cached.  It's vital that
-# we not cache the value of CXX that we "discover" here, because it's set
-# to something unique for us and libjava.  Other target libraries need to
-# find CXX for themselves.  We yank the rug out from under the normal AC_*
-# process by sneakily renaming the cache variable.  This also lets us debug
-# the value of "our" CXX in postmortems.
-#
-# We must also force CXX to /not/ be a precious variable, otherwise the
-# wrong (non-multilib-adjusted) value will be used in multilibs.  This
-# little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS.  And as a side
-# effect, CXXFLAGS is no longer automagically subst'd, so we have to do
-# that ourselves.  Un-preciousing AC_PROG_CC also affects CC and CFLAGS.
-#
 # -fno-builtin must be present here so that a non-conflicting form of
 # std::exit can be guessed by AC_PROG_CXX, and used in later tests.
 
-m4_define([ac_cv_prog_CXX],[glibcxx_cv_prog_CXX])
-m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS])
-m4_define([_AC_ARG_VAR_PRECIOUS],[])
 save_CXXFLAGS="$CXXFLAGS"
 CXXFLAGS="$CXXFLAGS -fno-builtin"
 AC_PROG_CC
 AC_PROG_CXX
 CXXFLAGS="$save_CXXFLAGS"
-m4_rename_force([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
-AC_SUBST(CFLAGS)
-AC_SUBST(CXXFLAGS)
 
 # Runs configure.host, and assorted other critical bits.  Sets
 # up critical shell variables.


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