WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: ccache  (Read 4793 times)

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
ccache
« on: May 20, 2009, 05:17:49 AM »
Thanks to robc for ccache:

Code: [Select]
Title:          ccache.tce
Description:    Compiler Cache (TESTING)
Version:        2.4
Author:         Andrew Tridgell
Original-site:  http://ccache.samba.org/
Copying-policy: GPLv2
Size: 16.8k
Extension_by:   robc
Comments:       This package requires compiletc

Change CC="gcc" to CC="ccache gcc" in the
Makefile or with ./configure.

----------------------------------------------

Please see the man page for additional
information.

Also see http://ccache.samba.org/
for more information.

----------------------------------------------

This extension is PPI compatible.

Change-log:     2009/5/19 Original
Current: 2009/5/19 Original


Code: [Select]
Title:          ccache.tce
Description:    Compiler Cache (TESTING)
Version:        2.4
Author:         Andrew Tridgell
Original-site:  http://ccache.samba.org/
Copying-policy: GPLv2
Size: 16.8k
Extension_by:   robc
Comments:       This package requires compiletc

Change CC="gcc" to CC="ccache gcc" in the
Makefile or with ./configure.

----------------------------------------------

Please see the man page for additional
information.

Also see http://ccache.samba.org/
for more information.

----------------------------------------------

This extension is PPI compatible.

Change-log:     2009/5/19 Original
Current: 2009/5/19 Original


Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: ccache
« Reply #1 on: May 20, 2009, 12:46:35 PM »
Thanks for uploading this.  Ccache saves a lot of time on recompiles, I used to use it all the time on another distro but I set it aside and haven't used it on TC until this extension .    Another way to make it universal in TC is to first symlink a gcc and g++ to ccache:

Code: [Select]
mkdir /usr/local/ccache/bin
ln -s /usr/local/bin/ccache /usr/local/ccache/bin/gcc
ln -s /usr/local/bin/ccache /usr/local/ccache/bin/g++

Then at the command line before compiling, or enter in your bashrc this:

Code: [Select]
export CCACHE_DIR=/mnt/hda2/ccache
export PATH="/usr/local/ccache/bin:${PATH}"


Exporting PATH makes use of the gcc and g++ symlinks in preference to the real gcc and g++ in /usr/local/bin, and the CCACHE_DIR you may want to set somewhere on permenant storage if your /home/tc or /root directories reside in RAM and will be lost on reboot, but that is personal preference.

By the way, this works well on TC 2.x, would it be OK if I copy it over?

Offline robc

  • Sr. Member
  • ****
  • Posts: 447
Re: ccache
« Reply #2 on: May 20, 2009, 12:50:31 PM »
Quote
Thanks for uploading this.
You're welcome. I actually need this for OpenEmbedded (http://wiki.openembedded.net/index.php/Main_Page)...that is if I can get OE to work with TC.

It may be a good idea to include this with the compiletc extension since it is so small.
"Never give up! Never surrender!" - Commander Peter Quincy Taggart

"Make it so." - Captain Picard

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: ccache
« Reply #3 on: May 20, 2009, 12:58:49 PM »
I'll go ahead and copy it over to 2.x since it is working well there.

Offline robc

  • Sr. Member
  • ****
  • Posts: 447
Re: ccache
« Reply #4 on: May 20, 2009, 01:01:25 PM »
Quote
I'll go ahead and copy it over to 2.x since it is working well there.
The dep/info file will need to be changed from compiletc to gcc-binutils
"Never give up! Never surrender!" - Commander Peter Quincy Taggart

"Make it so." - Captain Picard

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: ccache
« Reply #5 on: May 20, 2009, 05:30:21 PM »
Thanks, it is done.  For those not familiar with ccache here is a comparison between a fresh compile, or second compile without ccache, and a recompile with ccache:

First run - time ./configure --prefix=/usr/local && time make:

Code: [Select]
(this is time ./configure --prefix=/usr/local first time)
CMake has bootstrapped.  Now run make.

real    16m5.336s
user    11m48.634s
sys     0m54.403s
root@box:/mnt/hda2/cmake/cmake-2.6.4#

(this is amke first time)
[100%] Built target documentation

real    26m33.680s
user    20m56.428s
sys     1m11.649s
root@box:/mnt/hda2/cmake/cmake-2.6.4#     


Recompiling with same options using ccache:

Code: [Select]
(./configure --prefix=/usr/local)
CMake has bootstrapped.  Now run make.

real    2m16.557s
user    1m36.454s
sys     0m25.858s

(make)
[100%] Built target documentation

real    2m28.569s
user    1m45.390s
sys     0m21.255s
root@box:/mnt/hda2/cmake/cmake-2.6.4#


The reason I mention this comparison is that ccache is a way to make better use of older pentium 2 and 3 for compiling, as we know tweaking and recompiling is a common procedure with extension builds and this extension can save a lot of time.