[ccache] problems with buildworld & gcc45 on ports

Beeblebrox zaphod at berentweb.com
Tue Jun 21 12:29:09 MDT 2011


Hello all,

I am running into a number of confusing issues / problems with ccache, and
before posting a bug or such, I would like some input / opinions on these
issues.  Your help and input is appreciated!  I'll start with the easy and
move to the difficult.

My system is an amd64-athlon running FreeBSD 9-CURRENT, using gcc45 for
port; native (gcc42) for source builds.  The kernel is custom (self-built).
 devel/libtool has been rebuilt with gcc45.

1. My conditional in make.conf is not working and as far as I can tell,
always defaults to standard C for port builds.  I have tried a number of
variations, all with same result (gcc-42).  I can get ccache working only by
hard-coding the target compiler in make.conf. When specified like this:
(CC= /usr/local/libexec/ccache/world/gcc45) results in:
checking for gcc... /usr/local/libexec/ccache/world/gcc45
When specified like this:
-----------------------------------------------------------
.if !empty(.CURDIR:M/usr/ports*) && !defined(NOCCACHE)
CC:=${CC:gcc45,/usr/local/libexec/ccache/world/gcc45,1}
CXX:=${CXX:g\+\+\45,/usr/local/libexec/ccache/world/g++45,1}
CPP:=${CPP:cpp45,/usr/local/libexec/ccache/world/cpp45,1}
CFLAGS+= -mssse3
.endif

.if !empty(.CURDIR:M/usr/src*) && !defined(NOCCACHE)
CC:=${CC:C,^cc,/usr/local/libexec/ccache/world/cc,1}
CXX:=${CXX:C,^c\+\+,/usr/local/libexec/ccache/world/c++,1}
.endif
-------------------------------------------------------------
results in:  checking for gcc...  cc
How can I test whether ccache is calling the correct gcc version and what is
the correct syntax for 1st conditional?

2. Is is necessary to include cpp in the 1st conditional, or does ccache
detect the correct pre-processor on its own from here? (I have created the
 symlinks)
CPP:=${CPP:cpp45,/usr/local/libexec/ccache/world/cpp45,1}

3. Can the statement above be further modified to capture C code from the
bootstrap build for java/openjdk and qt4/kde?

4. Some ports (like graphics/aalib  www/neon29) break with:
libtool: compile: unable to infer tagged configuration specify a tag with
`--tag'
I have found this solution by googleing, but I have not tried / implemented
it nor modified it for gcc45:
LTCC="${CC:-env /usr/local/bin/ccache cc}"

5. If I use in make.conf this setting when doing a buildworld:
------------------------------------------------------------
CC=  /usr/local/libexec/ccache/world/cc
CXX= /usr/local/libexec/ccache/world/c++
------------------------------------------------------------
on amd64 systems, the i386-elf build seems to consistently break - posts
about this issue exist for FreeBSD branch 8x also.  From your own archives:
 "mostly suspected is a compiler problem since it can't compile its own
preprocessed output. A workaround for that is to set CCACHE_CPP2"

This, however, does not work because after buildworld broke, I disabled
ccache in make.conf and cleaned out the i386-elf folder in /obj. I then ran
make in /usr/src/lib/csu/i386-elf. It stopped with same error. I then
deleted obj/src and started the build with disabled ccache to make sure-
this ended with a clean build. My conclusion therefore is that i386-elf with
ccache breaks, not because of the code in i386-elf but because of code
placed in ccache from previous modules being called for the build of
i386-elf.

6. When I use the reccommended settings (as noted in #1) I get the same
problem for buildworld as described in #1 for ports: almost sure system is
not calling ccache.  Buildworld goes about its business with output like:
cc -fpic -DPIC -O2 -pipe -march=native -I/arch/cvsup/src/cddl/lib/libzpool/.
and all the time none of the ccache statistics change (neither # files, hits
or misses)

Thanks & Regards...


More information about the ccache mailing list