在某些项目扫描,存在ccache,缓存了问题,导致在解析编译指令时出错,无法正常输出结果,报错(No .i/.ii files generated)。
策略一:配置cmake文件,不启用ccache,这个需要对整个工程熟悉
a、必须要有其他可选编译工具
策略二:卸载ccache,无法匹配到ccache;存在隐患:
a、无其他编译器,导致无法编译
b、makefile未写备用方案,导致无法编译
策略三:关闭cache
本文的重点,为此而生。
查看帮助
@ubuntu[00:37:39]:~/ceph/ceph/build$ ccache -h
Usage:
ccache [options]
ccache compiler [compiler options]
compiler [compiler options] (via symbolic link)
Options:
-c, --cleanup delete old files and recalculate size counters
(normally not needed as this is done automatically)
-C, --clear clear the cache completely (except configuration)
-F, --max-files=N set maximum number of files in cache to N (use 0 for
no limit)
-M, --max-size=SIZE set maximum size of cache to SIZE (use 0 for no
limit); available suffixes: k, M, G, T (decimal) and
Ki, Mi, Gi, Ti (binary); default suffix: G
-o, --set-config=K=V set configuration key K to value V
-p, --print-config print current configuration options
-s, --show-stats show statistics summary
-z, --zero-stats zero statistics counters
-h, --help print this help text
-V, --version print version and copyright information
See also <https://ccache.samba.org>.
没有直接的办法,那就间接吧。把阈值设置得特别小,一直无法缓存,同样可以达到目的。
清空之前的缓存文件:ccache -C
@ubuntu:~/project/ceph/build$ ccache -C
Cleared cache
设置文件数量: ccache --max-files=1
@ubuntu:~/project/ceph/build$ ccache --max-files=1
Set cache file limit to 1
设置缓存大小:ccache --max-size=1k
@ubuntu:~/project/ceph/build$ ccache --max-size=1k
Set cache size limit to 1.0 kB
查看状态:ccache -s
@ubuntu:~/project/ceph/build$ ccache -s
cache directory /home/shaw/.ccache
primary config /home/shaw/.ccache/ccache.conf
secondary config (readonly) /etc/ccache.conf
stats zero time Mon Mar 1 17:54:16 2021
cache hit (direct) 619
cache hit (preprocessed) 2
cache miss 953
cache hit rate 39.45 %
called for link 178
unsupported source language 320
cleanups performed 64
files in cache 0
cache size 0.0 kB
max files 1
max cache size 1.0 kB
可以看出来:cache size、max files、max cache size;这三项已经时最低值了。
清理项目
@ubuntu:~/project/ceph/build$ make clean
目录不同,自己把握
重新开始扫描
@ubuntu:~/agent_new/xcalclient_filter_0127/tools$ ./xcal-scanner -sc ../workdir/run.conf -uc ../workdir/user.conf ../../conf/ceph-mon.conf
安装和配置文件目录,需要自己按实际配置
扫描成功,错误(No .i/.ii files generated)已经消失。