# CCACHE TUTORIAL



## zerospeed8 (Jun 15, 2011)

Anyone have any insight to setting up cchache?


----------



## yarly (Jun 22, 2011)

http://source.android.com/source/initializing.html#ccache


----------



## zerospeed8 (Jun 15, 2011)

I saw that read it just can't find the damn mk file. Guess I look again

Sent from my Galaxy Nexus using RootzWiki


----------



## mbh87 (Jun 14, 2011)

The directory has changed and don't think its been updated on that page.

sudo gedit .bashrc

export CCACHE_DIR=/home/(whatever your name is)/.ccache
export USE_CCACHE=1

save and exit

cd to root of source tree and copy

prebuilts/misc/linux-x86/ccache/ccache -M20


----------



## yarly (Jun 22, 2011)

I linked to the android source tutorial, but I normally just use the ccache that comes with my distro (it's newer as well). Didn't realize they had changed the directory for it. Thanks for telling him.


----------



## zerospeed8 (Jun 15, 2011)

Thank you! Works. Havant had to do that before always had someone do it

Sent from my Galaxy Nexus using RootzWiki


----------



## mbh87 (Jun 14, 2011)

I didn't know it changed either until I couldn't get it to set. Luckily a buddy of mine knew or else I still wouldn't know


----------



## MR H3LLMAN (Oct 20, 2011)

Stupid question, but how much does ccache actually help and what exactly does it do? Still kind of new to Linux haha.


----------



## jellybellys (Apr 3, 2012)

MR H3LLMAN said:


> Stupid question, but how much does ccache actually help and what exactly does it do? Still kind of new to Linux haha.





> Ccache acts as a compiler cache that can be used to speed-up rebuilds. This works very well if you do "make clean" often, or if you frequently switch between different build products.


Not sure how much it actually speeds it up, but I guess it does speed it up.


----------



## yarly (Jun 22, 2011)

MR H3LLMAN said:


> Stupid question, but how much does ccache actually help and what exactly does it do? Still kind of new to Linux haha.


Fast enough the 30 seconds you spend setting it up are worth caring about if you compile a lot. Just add the variables for it to your .bash_config and then you don't have to think about it anymore after initializing.


----------



## mbh87 (Jun 14, 2011)

It speeds things up significantly, at least it did for me. Cut build times in half.


----------



## MR H3LLMAN (Oct 20, 2011)

mbh87 said:


> It speeds things up significantly, at least it did for me. Cut build times in half.


holy hell. I need to get it set up asap then. Anybody know of a good tutorial for this? I remember trying to find one once and giving up because I couldn't figure it out haha.

Sent from my Galaxy Nexus using RootzWiki


----------



## zerospeed8 (Jun 15, 2011)

It speeds up second builds more than the first. Its alwasy good to use. A post on the first page is how I was told.


----------



## skinnyguy (Nov 4, 2011)

you dont need to set the path of the ccache. It defaults to .ccache.

As far as build times, I rebuilt my dev box last week, so resync'd a new JB manifest and set up CCACHE again.
1st build, 32 minutes (due to it having to rebuild the ccache)
2nd build (make clean) 20 minutes.
3rd build (make clobber) 23 minutes.
And this is with in-line kernel building setup.


----------



## doug piston (Jun 10, 2011)

mbh87 said:


> The directory has changed and don't think its been updated on that page.
> 
> sudo gedit .bashrc
> 
> ...


You don't need 'sudo' to modify your ~/.bashrc. Try to do as little as possible with sudo/su. This may seem a bit nit picky but it's the truth.


----------



## mbh87 (Jun 14, 2011)

zerospeed8 said:


> It speeds up second builds more than the first. Its alwasy good to use. A post on the first page is how I was told.


well it cant speed up the initial build after setting it up since there is no cache to use so thats a given.


----------



## MR H3LLMAN (Oct 20, 2011)

I know this is a rookie question but how exactly do I copy that line of code to the root of my source tree? Bit baffled by all the jargon... haha.


----------



## mbh87 (Jun 14, 2011)

you just cd to the root of your source folder in terminal and then copy and past that code and hit enter.


----------

