0

Current latest version of ccache is 3.1.9, but that one doesn't have proper support for clang.

How should I go about installing ccache 3.2.x?

Note: I'd prefer using package management if possible, so I can later remove the package with it if needed.

I have a previous version, 3.1.9, in /usr/bin/ccache and its symlinks at /usr/lib/ccache. These paths need to continue to work.

eis
  • 156
  • I noticed there is no 'ccache' tag, and I don't have enough rep to create it. I think it would be useful, I could find similar questions like this one then. – eis Jan 27 '16 at 13:22

2 Answers2

1

Download the latest version of ccache from cache.samba.org for better performance.

After downloading, follow the steps as mentioned below:

  1. Extract the files using tar command:

    tar -xvf ccache-3.2.4.tar.bz2
    
  2. Go inside ccache-3.2.4 folder and run the following commands:

    ./configure
    ./make
    sudo make install
    
  3. Open ~/.bashrc file in your editor and insert the following lines at the end of it:

    export CCACHE_DIR=/home/user_name/.ccache
    export CCACHE_TEMPDIR=/home/user_name/.ccache
    

    Note : fill user_name with your User name.

  4. Save your .bashrc and source it as follows:

    source ~/.bashrc
    
  5. To check ccache is working or not type : ccache -s to see the statistics

dadexix86
  • 6,616
  • apt-get can only find the old version. there doesn't seem to be 3.2 on ubuntu 14.04. – eis Jan 27 '16 at 13:27
  • please check update comment :) – mohit singh Jan 27 '16 at 13:32
  • thank you for the update! Is there a way for me to make a .deb package or similar when installing? I would much prefer something that would show up in package management. – eis Jan 27 '16 at 13:35
  • also, this seems to never establish the symlinks at /usr/lib/ccache – eis Jan 27 '16 at 15:45
0

Installing it from the source seems to have following drawbacks:

  • you cannot remove it later using a package manager (checkinstall can be used to circumvent this up to a point)
  • without specifying a path to ./configure, it won't go to where the previous version was
  • the most important one: links in /usr/lib/ccache will not get created

At least for me, the most working solution was to use updated package from a newer version of ubuntu, Wily. Doing like this:

  1. Download the package from http://packages.ubuntu.com/wily/amd64/ccache/download (assuming you're on amd64 architecture)
  2. Installing it: sudo dpkg -i ccache_3.2.3-1_amd64.deb

Will have everything working like I wanted to:

$ ccache -V
ccache version 3.2.3

Copyright (C) 2002-2007 Andrew Tridgell
Copyright (C) 2009-2015 Joel Rosdahl

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later
version.
$ ls -trla /usr/lib/ccache
total 16
drwxr-xr-x 86 root root 12288 Jan 27 17:55 ..
lrwxrwxrwx  1 root root    16 Jan 27 17:55 x86_64-linux-gnu-gcc-4.8 -> ../../bin/ccache
lrwxrwxrwx  1 root root    16 Jan 27 17:55 x86_64-linux-gnu-gcc -> ../../bin/ccache
lrwxrwxrwx  1 root root    16 Jan 27 17:55 x86_64-linux-gnu-g++-4.8 -> ../../bin/ccache
lrwxrwxrwx  1 root root    16 Jan 27 17:55 x86_64-linux-gnu-g++ -> ../../bin/ccache
lrwxrwxrwx  1 root root    16 Jan 27 17:55 gcc-4.8 -> ../../bin/ccache
lrwxrwxrwx  1 root root    16 Jan 27 17:55 gcc -> ../../bin/ccache
lrwxrwxrwx  1 root root    16 Jan 27 17:55 g++-4.8 -> ../../bin/ccache
lrwxrwxrwx  1 root root    16 Jan 27 17:55 g++ -> ../../bin/ccache
lrwxrwxrwx  1 root root    16 Jan 27 17:55 cc -> ../../bin/ccache
lrwxrwxrwx  1 root root    16 Jan 27 17:55 c99-gcc -> ../../bin/ccache
lrwxrwxrwx  1 root root    16 Jan 27 17:55 c89-gcc -> ../../bin/ccache
lrwxrwxrwx  1 root root    16 Jan 27 17:55 c++ -> ../../bin/ccache
lrwxrwxrwx  1 root root    16 Jan 27 17:55 arm-none-eabi-gcc-4.8.2 -> ../../bin/ccache
lrwxrwxrwx  1 root root    16 Jan 27 17:55 arm-none-eabi-gcc -> ../../bin/ccache
lrwxrwxrwx  1 root root    16 Jan 27 17:55 arm-none-eabi-g++ -> ../../bin/ccache
drwxr-xr-x  2 root root  4096 Jan 27 17:55 .
$ which ccache
/usr/bin/ccache
$ apt-cache policy ccache
ccache:
  Installed: 3.2.3-1
  Candidate: 3.2.3-1
  Version table:
 *** 3.2.3-1 0
        100 /var/lib/dpkg/status
     3.1.9-1 0
        500 http://fi.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
$
eis
  • 156