Solved ccache not being hit by libreOffice compile...

Hi all,

Need some advice please, as I suspect I am missing something obvious with ccache and a few ports.

I am compiling editors/libraoffice-en_GB and have devel/ccache installed.

/etc/make.conf:
Code:
WITH_CCACHE_BUILD=yes

.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

.if ${CC:T} == "clang"
CFLAGS+=        -Qunused-arguments
.endif

If I issue make -V CC in the editors/libreoffice-en_GB it reports
Code:
/usr/local/libexec/ccache/world/cc

However, ccache does not show any hits or misses during complile. The same is for graphics/libopenraw, but devel/libtool causes ccache to cache the relevant output sucessfully.

The output of ccache -s is
Code:
cache directory                     /root/.ccache
primary config                      /root/.ccache/ccache.conf
secondary config      (readonly)    /usr/local/etc/ccache.conf
cache hit (direct)                    66
cache hit (preprocessed)               8
cache miss                            54
called for link                        3
called for preprocessing              15
compile failed                         3
preprocessor error                    19
bad compiler arguments                 6
unsupported source language            9
autoconf compile/link                 69
unsupported compiler option            2
no input file                        374
files in cache                       136
cache size                         630.8 kB
max cache size                       5.0 GB


uname -a
Code:
FreeBSD argon 10.1-RELEASE FreeBSD 10.1-RELEASE #0: Sat Jan 31 10:53:36 GMT 2015     root@argon:/usr/obj/usr/src/sys/ARGON  i386
Any ideas as to why Libreoffice or libopenraw are not using ccache but libtool is OK?

Thanks,

James
 
Hi all,

Just an update, I have solved this for myself, have found on FreeBSD 10.1 that all is needed is as following when compiling from ports:

1) Install devel/ccache with CLANGLINK and LLVMLINK in the configured port options
cd /usr/ports/devel/ccache
make config && make config-recursive
make clean && make install clean
Note: Clang linkage is not default in the config as at 8th Feb 2105.

2) Make sure that the cache folder we are going to use exists
mkdir /var/tmp/ccache
Note: This can be anywhere in the r/w file system space.

3) Setup just the ccache environmental settings as per the HowTo guide on this forum (https://forums.freebsd.org/threads/howto-freebsd-with-ccache.174/):
Add the following to /.cshrc (or shell resource file for relevant shell you are using)
Code:
setenv PATH /usr/local/libexec/ccache:$PATH
setenv CCACHE_PATH /usr/bin:/usr/local/bin
setenv CCACHE_DIR /var/tmp/ccache
setenv CCACHE_LOGFILE /var/log/ccache.log

Note about using symlinks: all compilations with be via the ccache wrapper, so an option to allow port ccache usage is not needed in /etc/make.conf.

4) Close any existing sessions and start a new xterm or session
Note: As ccache is inserted into the beginning of the path, you need need to ensure that the ccache symlink folder is at the beginning of the path before assuming it will work or that you re-install libtools in the next step. This ensures that the environmental settings are correct.

5) Recompile the devel/libtool ports:
make clean && make reinstall clean for devel/libtool

Note: in the above, I have not altered my /etc/make.conf to allow for exceptions, and in fact in my system I don't have a need for one. Your individual mileage may vary with this approach and throw this open to community for a better approach?

You can monitor progress during and after a compile using ccache -s.

My issues were around tinkering with /etc/make.conf, failing to configure the ccache option for Clang and reusing sessions with the wrong PATH environmental variable present.

Happy for comments from others on this, but have it working for my needs now.

Kind regards,

James.
 
Last edited:
Back
Top