[dpdk-dev] FYI: Using ccache a linux compiler caching tool with DPDK

Wiles, Keith keith.wiles at intel.com
Mon Jun 27 20:10:02 CEST 2016

FYI, Just to help document the issue here.

Using ccache on Linux can improve your compile time from a few minutes to a few seconds depending the use case.

On my machine Ubuntu 16.04 up to date as of 06/26/2016 using:
sudo apt-get install ccache

System Information:
   Model Name : Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz
   sysname    : Linux
   release    : 4.4.0-24-generic
   version    : #43-Ubuntu SMP Wed Jun 8 19:27:37 UTC 2016
   machine    : x86_64

CPU Information:
   nthreads   :   2
   ncores     :  18
   nsockets   :   2
   nbooks     :   1
   nlcores    :  72

72 lcores, 2 socket(s), 18 cores per socket, 2 hyper-thread(s) per core

Note: I have added the environment variable ‘CCACHE_CPP2=yes

Builds using DPDK 16.07-rc0 on 06/27/2016
Build with ‘time CCACHE_DISABLE=true make install T=x86_64-native-linuxapp-clang’ gives:

real	2m52.844s
user	2m32.220s
sys	0m15.548s

Rebuild with no changes, just issue the above line again:

real	0m9.929s
user	0m5.056s
sys	0m3.036s

If you issue the above line with –j appended give:

real	0m4.292s
user	0m5.304s
sys	0m4.348s

remove x86_64-native-linuxapp-clang build directory.
Build with ‘time CCACHE_DISABLE=true make install T=x86_64-native-linuxapp-clang -j’ gives:

real	0m29.681s
user	3m18.104s
sys	0m34.876s

cd x86_64-native-linuxapp-clang directory
make clean
time CCACHE_DISABLE=true make

real	3m13.992s
user	2m45.044s
sys	0m21.784s

make clean
make          # just to fill the ccache
make clean
time make

real	0m15.066s
user	0m6.776s
sys	0m3.684s

make clean
time make –j

real	0m4.527s
user	0m7.060s
sys	0m5.428s

As you can see the performance gain is very nice and I ccache does seem to work correctly except in a few cases.

It appears the ccache and clang have a few problems without the global having the environment variable set:
export CCACHE_CPP2=yes

Without this environment variable clang starts to complain about a number of issues. If you see a compile problem please rebuild with ccache disabled using ‘sudo CCACHE_DISABLE=true …’ or uninstall ccache ‘sudo apt-get remove ccache’

It is possible that GCC will also have compiler issues, but I do not seem to see any, just try without ccache to verify.

Here is a link to help explain more details:
See e.g. http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html

If the build works then I have not found any issues with using ccache except a faster build time ☺  YMMV 


More information about the dev mailing list