Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
“ccache”是什么意思;呼吁链接“;_C_Caching_Ccache - Fatal编程技术网

“ccache”是什么意思;呼吁链接“;

“ccache”是什么意思;呼吁链接“;,c,caching,ccache,C,Caching,Ccache,ccache统计数据“呼叫链接”的含义是什么。我以为ccache只包装了编译器,而不是链接器 [Brian@localhost~]$ccache-s 缓存目录/home/Brian/.ccache 缓存命中(直接)19813 缓存命中(预处理)67 缓存未命中11 呼叫链接498 要求进行预处理10 不支持的源语言472 没有输入文件12 缓存258568中的文件 缓存大小33.8 GB 最大缓存大小为100.0 GB ccache确实不支持链接 不过,它确实取代了C编译器(更具体地说,是C编译

ccache统计数据“呼叫链接”的含义是什么。我以为ccache只包装了编译器,而不是链接器

[Brian@localhost~]$ccache-s
缓存目录/home/Brian/.ccache
缓存命中(直接)19813
缓存命中(预处理)67
缓存未命中11
呼叫链接498
要求进行预处理10
不支持的源语言472
没有输入文件12
缓存258568中的文件
缓存大小33.8 GB
最大缓存大小为100.0 GB

ccache
确实不支持链接

不过,它确实取代了C编译器(更具体地说,是C编译器驱动程序)(看看它安装和使用的位置和方式)。因此,它需要“传递”它接收到的任何命令,而不会将自己处理/修改到工具链的各个部分。

阅读该命令对我来说也不是很清楚:

统计计数器“调用链接”现在在 与单个对象文件链接

但这意味着您在单个操作中进行编译和链接,因此ccache无法透明地提供结果

演示一个基本的hello.c程序。首先,让我们澄清一切:

$ ccache -Czs
Cleared cache
Statistics cleared
cache directory                     /home/jdg/.ccache
cache hit (direct)                     0
cache hit (preprocessed)               0
cache miss                             0
files in cache                         0
在一个步骤中进行编译和链接(两次,只是为了确保):

没有缓存任何内容,因为ccache无法

分两个单独的步骤进行(也是两次):

现在它成功了:

  • 第一次编译导致缓存丢失,并存储结果(两个) 文件:manifest plus.o)
  • 第二次命中缓存
  • 链接总共调用了4次g++,其中2次没有源代码,只有.o
还有那个要求预处理的东西?很简单,您只需使用编译器扩展所有包含/定义内容(例如,在查找依赖项时)


希望这有帮助

在“分两步执行”部分中,您是否故意在没有
ccache的情况下运行
g++
$ ccache g++ hello.c
$ ccache g++ hello.c
$ ccache -s
cache hit (direct)                     0
cache hit (preprocessed)               0
cache miss                             0
called for link                        2
files in cache                         0
$ ccache g++ -c hello.c ; g++ hello.o
$ ccache g++ -c hello.c ; g++ hello.o
$ ccache -s
cache hit (direct)                     1
cache hit (preprocessed)               0
cache miss                             1
called for link                        4
no input file                          2
files in cache                         2
$ g++ -E hello.c
$ g++ -M hello.c
$ ccache -s
cache hit (direct)                     1
cache hit (preprocessed)               0
cache miss                             1
called for link                        4
called for preprocessing               2
unsupported compiler option            1
no input file                          2
files in cache                         2