g++, colorgcc and ccache

dimba picture dimba · Jan 3, 2010 · Viewed 11.3k times · Source

Trying to combine ccache and colorgcc. Following link text:

  • my g++ is soft link to colorgcc
  • ~/.colorgccrc contains line: "g++: ccache /usr/bin/g++"

When running g++ --version receive:

Can't exec "ccache  /usr/bin/gcc": No such file or directory at /usr/lib/perl5/5.8.8/IPC/Open3.pm line 246.
open3: exec of ccache  /usr/bin/gcc --version failed at /usr/local/bin/colorgcc/gcc line 208

Any ideas how to solve it?

Answer

Malvineous picture Malvineous · May 2, 2011

Just came across this same issue. For me, the problem could be solved by carefully setting environment variables:

# Make "g++" command call colorgcc
export PATH="/usr/lib/colorgcc/bin:$PATH"

# Tell ccache to invoke compilers in /usr/bin
export CCACHE_PATH="/usr/bin"

Then all I had to do was edit colorgcc's config file (/etc/colorgcc/colorgcc or ~/.colorgcc) and tell it to call ccache instead:

g++: /usr/lib/ccache/bin/g++
gcc: /usr/lib/ccache/bin/gcc
c++: /usr/lib/ccache/bin/g++
cc:  /usr/lib/ccache/bin/gcc
g77: /usr/lib/ccache/bin/g77
f77: /usr/lib/ccache/bin/g77
gcj: /usr/lib/ccache/bin/gcj

This of course only works if you have colorgcc's symlinks installed in /usr/lib/colorgcc/bin and ccache's symlinks in /usr/lib/ccache/bin - adjust accordingly.