Bug 193974

Summary: Configuring make.conf with CC, CXX, and CPP overrides doesn't respect WITH_CCACHE_BUILD
Product: Ports & Packages Reporter: Kevin Thompson <antiduh>
Component: Ports FrameworkAssignee: Port Management Team <portmgr>
Status: Closed Feedback Timeout    
Severity: Affects Some People CC: bdrewery, portmgr, vsasjason
Priority: --- Keywords: needs-qa
Version: LatestFlags: koobs: maintainer-feedback? (portmgr)
Hardware: Any   
OS: Any   

Description Kevin Thompson 2014-09-27 14:52:51 UTC
I've enabled ccache for ports by adding the following to my /etc/make.conf file:

> # Use ccache to reduce compilation times
> CCACHE_DIR=/space/ccache

Recently, I decided to switch to clang35 for the sake of seeing how well it would work, so my /etc/make.conf file became this:

> # Use ccache to reduce compilation times
> CCACHE_DIR=/space/ccache

> # Use ports clang35 as the default compiler
> CC=/usr/local/bin/clang35
> CXX=/usr/local/bin/clang++35
> CPP=/usr/local/bin/clang-cpp35

I noticed that after adding the CC.. lines to use clang35, ccache stopped getting used - none of the stats were incrementing.

Everything keeps compiling all the same, but I'd be great if I could configure both and have it work as expected.
Comment 1 Bryan Drewery freebsd_committer 2015-11-06 20:06:08 UTC
The WITH_CCACHE_BUILD prepends PATH to /usr/local/libexec/ccache/ to use ccache. This allows using the symlinks in there to use the desired compiler. We don't modify CC, such as CC="/usr/local/bin/ccache /usr/local/bin/clang35", because many ports refuse to work with the embedded space.

You can make this work by enabling the CLANGLINK option in devel/ccache and using:
CC= clang35
CCACHE_PATH= /usr/local/bin
.export CCACHE_PATH # Export only works with FreeBSD 10+
Comment 2 Bryan Drewery freebsd_committer 2015-11-06 21:24:55 UTC
We could potentially auto handle this in bsd.ccache.mk.
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2021-07-11 02:20:55 UTC
(In reply to Bryan Drewery from comment #2)

Is this still an issue? If so let's create a dependent issue. If not, close OBE or relevent resolution