I am running FreeBSD 10-Current. I recently switched from 9-Stable, where I had the same problem (so the bug is persistent across branches). World is/was built purely with clang and I also have lang/gcc (gcc46) installed for ports building. When I try to build a port however, ccache does not use gcc46 but instead calls clang. I can tell what is going on by: 1. Output during build or 2. By disabling ccache In 1: clang output is color coded, so it is possible to tell which compiler is being used. In2: If I disable ccache and enable gcc46 in /etc/make.conf by: CC=gcc46 \ CXX=g++46 \ CPP=cpp46 #CC:=${CC:C,^gcc46,/usr/local/libexec/ccache/world/gcc46,1} #CXX:=${CXX:C,^g\+\+\46,/usr/local/libexec/ccache/world/g++46,1} Then try to build a port (for example sysutils/e2fsprogs) the compiler output is not colorised. Other examples exist, and can be provided on request. During debug I have already re-built devel/ccache devel/libtool lang/gcc, to no avail. Is the problem here with how ccache is calling cpp? Is it possible to place a cpp call for ccache+gcc46? CLANG BUILD OUTPUT - I do not appear to have any problems with clang with ccache, so does not appera to be an issue for me: You've chosen to create symlinks to the clang compiler binaries if they exist. While it's known to be safe to build world with clang/ccache, it is not fully supported yet. You have been warned.
I know next to nothing about FreeBSD and how it uses ccache. However, I'm fairly certain that the problem you are seeing has nothing to do with ccache per se but rather with how FreeBSD uses ccache. Therefore, I recommend you to report the problem to the FreeBSD port maintainer (or whatever it's called) for ccache. To discuss how to enable ccache in different scenarios, I recommend using the ccache mailing list. I'm closing this because I can't help you. Please reopen if you have a ccache problem not specific to FreeBSD. (Hope this doesn't sound unreasonable!)