g++, colorgcc and ccache

后端 未结 7 2017
庸人自扰
庸人自扰 2021-02-04 01:45

Trying to combine ccache and colorgcc. Following link text:

  • my g++ is soft link to colorgcc
  • ~/.colorgccrc contains line: \"g++: ccache /usr/bin/g++\"
7条回答
  •  独厮守ぢ
    2021-02-04 02:13

    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.

提交回复
热议问题