Page 1 of 1

faster compiling using gcc

Posted: Sat Aug 04, 2007 9:42 am
by shirish
Hi all,
Just came to know there is a tool called ccache which helps in faster compilation. All the tutorial is courtesy eternalswd.

First that tool needs to be downloaded & installed :-

Code: Select all

sudo aptitude install ccache
Now one has to set the environment up for it. There are two ways, one doing stuff in .bashrc or better yet, doing it in /etc/enviroment (globally) guessing the second is so if its a multi-user environment then everybody else also benefits. If you do the same in .bashrc then only you benefit. I went the /etc/environment way :-

The first thing is to make sure to backup your /etc/environment

Code: Select all

 sudo cp /etc/environment /etc/environment_backup
Then make the changes, the path atleast in my /etc/environment was :-

Code: Select all

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
changed it so now it reads :-

Code: Select all

PATH="/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
This should make compile times faster for sure.

Re: faster compiling using gcc

Posted: Sat Aug 04, 2007 9:49 am
by eternalsword
not all distros use /etc/environment in fact, so check with your distro to see where PATH is sourced if you want to go globally. You can also export in your shell's configure on per user basis. eg, I added this to my .zshrc file. (bash would use .bashrc)

Code: Select all

export PATH=/usr/lib/ccache:$PATH
Per user is safe no matter what distro.