# problems using ccache and buildworld



## kuyaedz (May 7, 2010)

I find that I am unable to complete a buildworld when using ccache on my amd64 system, while it works fine on my i386 system. I'm beginning to think it might have something to do with my /etc/make.conf settings, but I thought I'd post my setup here.

*/etc/make.conf*

```
NO_PROFILE=true
KERNCONF=GENERIC
DOC_LANG= en_US.UTF-8
WITHOUT_X11=yes

# build flags
CFLAGS= -march=native -O2 -fno-strict-aliasing -pipe
CXXFLAGS= ${CFLAGS}

.if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*)) && !defined(NOCCACHE)
CC=/usr/local/libexec/ccache/world-cc
CXX=/usr/local/libexec/ccache/world-c++
.endif
```

*/etc/profile*


```
export PATH=/usr/local/libexec/ccache:$PATH
export CCACHE_PATH=/usr/bin:/usr/local/bin
export CCACHE_DIR=/usr/.ccache
```

It generally fails right around here:


```
sh /usr/src/tools/install.sh -o root -g wheel -m 444  crtbegin.o /usr/obj/usr/src/lib32/usr/lib32/crtbegin.o
sh /usr/src/tools/install.sh -o root -g wheel -m 444  crtend.o /usr/obj/usr/src/lib32/usr/lib32/crtend.o
sh /usr/src/tools/install.sh -o root -g wheel -m 444  crtbeginT.o /usr/obj/usr/src/lib32/usr/lib32/crtbeginT.o
sh /usr/src/tools/install.sh -o root -g wheel -m 444  crtbegin.So /usr/obj/usr/src/lib32/usr/lib32/crtbeginS.o
sh /usr/src/tools/install.sh -o root -g wheel -m 444  crtend.So /usr/obj/usr/src/lib32/usr/lib32/crtendS.o
1 error
*** Error code 2
1 error
*** Error code 2
1 error
*** Error code 2
1 error
```

This makes me think that it's failing in regards to the lib32 stuff, on my amd64 system. My current theory is that my CFLAGS are building for -march=native, but I'm also trying to build 32bit code, which fails? Does that sound at all reasonable?

My ccache -s output: (this is the first build attempt)

```
cache directory                     /usr/.ccache
cache hit                            438
cache miss                         13906
called for link                      623
multiple source files                  2
compile failed                         1
not a C/C++ file                    1258
no input file                          1
files in cache                     27812
cache size                         163.7 Mbytes
max cache size                     976.6 Mbytes
```

Any ideas?


----------



## graudeejs (May 8, 2010)

remove CFLAGS and CXXFLAGS, and try again.


----------



## kuyaedz (May 8, 2010)

killasmurf86 said:
			
		

> remove CFLAGS and CXXFLAGS, and try again.



I've now tried without CFLAGS and CXXFLAGS. I tried with and without -j options. The only way I've been successful is 'make NOCCACHE=YES buildworld.'


----------

