3

I am completely noob at this. I don't know what the make file is, and I don't know what bashrc is.

But I do know where to download source code and use source somebash.sh then make file (as was told by someone to run those commands).

I did some research and found out ccache can speed up sequential build speed, but I have no idea what am I supposed to do when reading those online instructions (include ccache in path, what path, where and how, and gcc, colorgcc, and bashrc. What are these?)

What is a step-by-step instruction?

3
  • 1
    If you don't know what you are doing, why are you concerned with increasing efficiency? Shouldn't you be more focused on figuring out the very basics? You should figure out what your end goal is, then figure out how to get there. Ask questions here about specific things you are trying to figure out that get you to that goal. If you don't know what a path is, then forget about ccache.
    – Paul
    May 15, 2014 at 1:26
  • so what's a PATH (in Linux definition, I know what path is in windows environment)
    – user97662
    May 15, 2014 at 1:32
  • See askubuntu.com/questions/141718/…
    – Seth
    May 15, 2014 at 1:40

3 Answers 3

7

I would read this documentation, and then

  1. sudo apt-get install ccache
  2. Assuming you're build a "standard" source package,
export CC="ccache gcc"
export CXX="ccache g++"
./configure

If you really want to "override" the standard gcc and g++ you could then

ln -s $(which ccache) /usr/local/bin/gcc
ln -s $(which ccache) /usr/local/bin/g++
ln -s $(which ccache) /usr/local/bin/cc
5

You can look into this documentation, for example. Briefly:

  1. Install the ccache package -- you know, sudo apt-get install ccache
  2. Put the following line into your ~/.bashrc:

export PATH="/usr/lib/ccache/bin/:$PATH"

Of course, please check if /usr/lib/ccache/bin really exists, it might be installed elsewhere.

3
  • 1
    nope, ccache doesnot exisst in /usr/lib, if not, how can i find out where the program is installed?
    – user97662
    May 15, 2014 at 15:38
  • 1
    Try dpkg-query -L ccache
    – thiagowfx
    May 15, 2014 at 17:08
  • @user97662 On Ubuntu 22.04 it seems to exist, although the binaries are now just in /usr/lib/ccache/, not in /usr/lib/ccache/bin.
    – Lena
    Feb 4, 2023 at 23:13
1

Make install from source. It's working for me.

Download:

wget https://www.samba.org/ftp/ccache/ccache-3.3.3.tar.gz

Uncompress:

tar -zxvf ccache-3.3.3.tar.gz

Enter folder:

cd ccache-3.3.3

To compile and install ccache, run these commands:

./configure
make
make install

Create a symbolic link for ccache:

cp ccache /usr/local/bin/
cd /usr/local/bin/
ln -s ccache /usr/local/bin/gcc
ln -s ccache /usr/local/bin/g++
ln -s ccache /usr/local/bin/cc
ln -s ccache /usr/local/bin/c++

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .