# ccache + gcc45 frustration re-visited



## Beeblebrox (Oct 29, 2011)

For some reason my combination of gcc45 + ccache  + bsdadminscripts is not working as it should.  I have tried to find solutions the best I can for some time, but I am reasonably certain the issue remains.

*SYMPTOMS:*
1. Some ports, especially if they call on cmake / gmake break the build at the beginning with below error. cmake & gmake also gave the same problems when I tried building them and I had to disable ccache to build those ports.

```
"Cmake error: your C compiler: "/usr/local/bin/ccache c" was not found"
```
2. ccache is NOT calling on gcc45 and is building everything with base c/c++ (4.2). The pre-compile output on many ports specifies something like:

```
checking your c compiler: /usr/local/bin/ccache c
```
when it should be looking at gcc45. In fact, when I try to build a port depending on cmake (like in #1) with -DNOCCACHE flag, the build again stops, this time with:

```
"Cmake error: your C compiler: "/usr/local/bin/ccache [B]gcc45[/B]" was not found"
```
3. buildworld can stop with ccache; some of the past problems have been documented on the forum.  Disabling ccache in make.conf solves the buildworld break.

*CURRENT SETUP:*
1. My directories: /usr/obj, /asp/src, /asp/ports, /asp/ccache, with /asp on compressed zfs
2. In bsdadminscripts buildflags.conf has for src and ports:

```
/asp/src | /asp/src/*{
/asp/ports | /asp/ports/*{
USE_CCACHE
BUILDFLAGS_GCC=	  45
```
3. make.conf has these. Symptom 1 occurs with or without the ccache selection.

```
#_GCC_SELECTION_START
.if (!empty(.CURDIR:M/asp/ports*) || !empty(.CURDIR:M/usr/obj*)) && (.CURDIR:M/asp/ports*)
.if !defined(NOCCACHE)
CC:=${CC:C,^gcc45,/usr/local/libexec/ccache/world/gcc45,1}
CXX:=${CXX:C,^g\+\+\45,/usr/local/libexec/ccache/world/g++45,1}
.else
CC= gcc45
CXX= g++45
CPP= cpp45
.endif
CFLAGS+= -mssse3
.endif

.if (!empty(.CURDIR:M/asp/src*) || !empty(.CURDIR:M/usr/obj*)) && (.CURDIR:M/asp/src*)
.if !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
.endif

BUILDFLAGS= /usr/local/share/bsdadminscripts/buildflags.mk
.if exists(${BUILDFLAGS})
.include "${BUILDFLAGS}"
.endif
```
4. All necessary symlinks pointing to ccache in /usr/local/libexec/ccache are in place.


----------

