g++, colorgcc and ccache

后端 未结 7 2015
庸人自扰
庸人自扰 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:09

    Here is how to patch colorgcc. The problem is with

    exec $compiler, @ARGV
    

    and

    $compiler_pid = open3('<&STDIN', \*GCCOUT, '', $compiler, @ARGV);
    

    $compiler is in your case "ccache /usr/bin/g++". We need to change it so that $compiler is ccache and /usr/bin/g++ is prepended to @ARGV

    After the line

    $progName = $1 || $0;
    

    do following modifications:

    $shell_command = $compilerPaths{$progName} || $compilerPaths{"gcc"};
    @shell_array = split(' ',$shell_command);
    $compiler = shift @shell_array;
    if ( scalar (@shell_array) > 0 ) {
      unshift (@ARGV, @shell_array);
    }
    

    replacing the line

    $compiler = $compilerPaths{$progName} || $compilerPaths{"gcc"};
    

    Jirka

提交回复
热议问题