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]

error building gcc with CCACHE_HARDLINK=1


The comments in the patch is hopefully enough of a description of the
problem, so I'll spare you from a duplicate.  I'm checking this in.
Although the exact situation I ran into should be quite rare (although
100% reproducible if you hit it), if someone touches fixincl.o and
then runs make -C gcc, bad things happen.  The patch will get us to
use the outdated fixincl binary, which is probably what one would
expect in the absence of a single global Makefile.  If you delete the
fixincl binary, you'll get an error when attempting to run it, which
might be a bit unexpected since there's an explicit dep on it, but
it feels way better than trying to figure out why make was trying to
build fixincl out of fixincl.o alone at that point.

Patch tested on x86_64-linux-gnu-x-frv-linux-gnu.

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* Makefile.in (../$(build_subdir)/fixincludes/fixincl): Add dummy
	rule to avoid matching inappropriate suffix rule.

Index: gcc/Makefile.in
===================================================================
RCS file: /cvs/uberbaum/gcc/Makefile.in,v
retrieving revision 1.1443
diff -u -p -r1.1443 Makefile.in
--- gcc/Makefile.in 19 Jan 2005 09:31:04 -0000 1.1443
+++ gcc/Makefile.in 26 Jan 2005 09:06:59 -0000
@@ -2814,6 +2814,20 @@ s-macro_list : $(GCC_PASSES) 
 	$(SHELL) $(srcdir)/../move-if-change tmp-macro_list macro_list
 	$(STAMP) s-macro_list
 
+# The line below is supposed to avoid accidentally matching the
+# built-in suffix rule `.o:' to build fixincl out of fixincl.o.  You'd
+# expect fixincl to be newer than fixincl.o, such that this situation
+# would never come up.  As it turns out, if you use ccache with
+# CCACHE_HARDLINK enabled, the compiler doesn't embed the current
+# working directory in object files (-g absent, or -fno-working-dir
+# present), and build and host are the same, fixincl for the host will
+# build after fixincl for the build machine, getting a cache hit,
+# thereby updating the timestamp of fixincl.o in the the host tree.
+# Because of CCACHE_HARDLINK, this will also update the timestamp in
+# the build tree, and so fixincl in the build tree will appear to be
+# out of date.  Yuck.
+../$(build_subdir)/fixincludes/fixincl: ; @ :
+
 # Build fixed copies of system files.
 stmp-fixinc: gsyslimits.h macro_list \
   ../$(build_subdir)/fixincludes/fixincl \
-- 
Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

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