什么是所谓的ccache统计“呼吁链接”。我以为ccache只是包装了编译器,而不是链接器?
[Brian@localhost ~]$ ccache -s
cache directory /home/Brian/.ccache
cache hit (direct) 19813
cache hit (preprocessed) 67
cache miss 11
called for link 498
called for preprocessing 10
unsupported source language 472
no input file 12
files in cache 258568
cache size 33.8 Gbytes
max cache size 100.0 Gbytes发布于 2015-04-23 16:04:35
ccache确实不支持链接。
但是,它确实取代了C编译器(更具体地说,C编译器驱动程序)(看看它是在哪里安装和使用的)。因此,它需要“传递”它接收到的任何命令,并且不处理/修改自己到工具链的各个部分。
发布于 2017-03-04 12:06:49
对我来说,读发布说明也不是很清楚:
现在,当使用单个对象文件链接时,统计计数器“调用链接”将被正确更新。
但这意味着您要在单个操作中进行编译和链接,因此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 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不能
分两个步骤(也是两次):
$ 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希望这能帮上忙!
https://stackoverflow.com/questions/29828430
复制相似问题