Bug 193974 - Configuring make.conf with CC, CXX, and CPP overrides doesn't respect WITH_CCACHE_BUILD
Summary: Configuring make.conf with CC, CXX, and CPP overrides doesn't respect WITH_CC...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs mailing list
URL:
Keywords: needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2014-09-27 14:52 UTC by Kevin Thompson
Modified: 2017-02-07 22:07 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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
> WITH_CCACHE_BUILD=yes
> 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
> WITH_CCACHE_BUILD=yes
> 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
CXX=clang++35
CPP=clang-cpp35
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.