(ubuntu)在andorid andk工程中使用ccache加速编译速度
环境
系统:Linux luogw-pc 3.5.0-36-generic #57~precise1-Ubuntu SMP Thu Jun 20 18:21:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
ndk: ndk-r8d
cache: ccache version 3.1.6
第一步:安装ccache
sudo apt-get install ccache
第二步:配置ccache
添加环境变量 export NDK_CCACHE=ccache
第三步:修改 android-ndk-r8e/build/core/default-build-commands.mk
注:红色部份为修改的内容,原内容被注释掉
#
# IMPORTANT: The following definitions must use lazy assignment because
# the value of TOOLCHAIN_PREFIX or TARGET_CFLAGS can be changed later by
# the toolchain's setup.mk script.
#
ifneq ($(findstring ccc-analyzer,$(CC)),)
TARGET_CC = $(CC)
else
#TARGET_CC = $(TOOLCHAIN_PREFIX)gcc
TARGET_CC = ccache $(TOOLCHAIN_PREFIX)gcc
endif
TARGET_CFLAGS =
ifneq ($(findstring c++-analyzer,$(CXX)),)
TARGET_CXX = $(CXX)
else
#TARGET_CXX = $(TOOLCHAIN_PREFIX)g++
TARGET_CXX = ccache $(TOOLCHAIN_PREFIX)g++
endif
TARGET_CXXFLAGS = $(TARGET_CFLAGS) -fno-exceptions -fno-rtti
实践对比:
使用ccache前后情况对比如下
luogw@luogw-pc:~/study/bitmap-plasma$ ccache -s
cache directory /home/luogw/.ccache
cache hit (direct) 0
cache hit (preprocessed) 0
cache miss 0
files in cache 0
cache size 0 Kbytes
max cache size 1.0 Gbytes
luogw@luogw-pc:~/study/bitmap-plasma$ time ndk-build
Gdbserver : [arm-linux-androideabi-4.7] libs/armeabi/gdbserver
Gdbsetup : libs/armeabi/gdb.setup
Gdbserver : [arm-linux-androideabi-4.7] libs/armeabi-v7a/gdbserver
Gdbsetup : libs/armeabi-v7a/gdb.setup
Compile thumb : plasma <= plasma.c
SharedLibrary : libplasma.so
Install : libplasma.so => libs/armeabi/libplasma.so
Compile thumb : plasma <= plasma.c
SharedLibrary : libplasma.so
Install : libplasma.so => libs/armeabi-v7a/libplasma.so real 0m0.226s
user 0m0.128s
sys 0m0.032s
luogw@luogw-pc:~/study/bitmap-plasma$ ccache -s
cache directory /home/luogw/.ccache
cache hit (direct) 0
cache hit (preprocessed) 0
cache miss 2
called for link 2
multiple source files 2
files in cache 6
cache size 108 Kbytes
max cache size 1.0 Gbytes
luogw@luogw-pc:~/study/bitmap-plasma$ rm -r libs/ obj/
luogw@luogw-pc:~/study/bitmap-plasma$ time ndk-build
Gdbserver : [arm-linux-androideabi-4.7] libs/armeabi/gdbserver
Gdbsetup : libs/armeabi/gdb.setup
Gdbserver : [arm-linux-androideabi-4.7] libs/armeabi-v7a/gdbserver
Gdbsetup : libs/armeabi-v7a/gdb.setup
Compile thumb : plasma <= plasma.c
SharedLibrary : libplasma.so
Install : libplasma.so => libs/armeabi/libplasma.so
Compile thumb : plasma <= plasma.c
SharedLibrary : libplasma.so
Install : libplasma.so => libs/armeabi-v7a/libplasma.so real 0m0.114s
user 0m0.052s
sys 0m0.008s
luogw@luogw-pc:~/study/bitmap-plasma$ ccache -s
cache directory /home/luogw/.ccache
cache hit (direct) 2
cache hit (preprocessed) 0
cache miss 2
called for link 4
multiple source files 4
files in cache 6
cache size 108 Kbytes
max cache size 1.0 Gbytes
参考文章:
1)http://www.41post.com/4509/programming/android-use-ccache-with-android-ndk-in-cygwin
2)http://www.mirwing.com/2011/11/android-android-ndk-revision-7.html
(ubuntu)在andorid andk工程中使用ccache加速编译速度的更多相关文章
- codec engine工程中使用ccs下编译的lib库
原文地址:codec engine工程中使用ccs下编译的lib库--转作者:木子小白 这两天将dsp的算法程序放到ccs下,生成lib库文件 这样的好处就是: 1. 算法封装成lib库以后,看不到源 ...
- 一个工程中cpp文件的编译顺序
做了一个实验. 最后build失败,失败的原因是变量i被重定义了.原本按照我的思路,是不应该失败的.因为我用了条件编译,若先编译Source.cpp,则会#define __HEADER_H__并且定 ...
- weblogic自带的jdk是在工程的包部署后编译使用
weblogic自带的jdk是在工程的包部署后编译使用的.当用户把项目打包部署到weblogic上面,运行该项目的java环境jdk就是用的weblogic自带的jdk了,工程中的jdk和编译时的jd ...
- 【Qt开发】【VS开发】【Linux开发】OpenCV、Qt-MinGw、Qt-msvc、VS2010、VS2015、Ubuntu Linux、ARM Linux中几个特别容易混淆的内容
[Qt开发][VS开发][Linux开发]OpenCV.Qt-MinGw.Qt-msvc.VS2010.VS2015.Ubuntu Linux.ARM Linux中几个特别容易混淆的内容 标签:[Qt ...
- 清除Android工程中没用到的资源
项目需求一改再改,UI一调再调,结果就是项目中一堆已经用不到但却没有清理的垃圾资源,不说工程大小问题,对新进入项目的人或看其他模块的代码的人来说,这些没清理的资源可能也可能会带来困扰,所以最好还是清理 ...
- 【DDD/CQRS/微服务架构案例】在Ubuntu 14.04.4 LTS中运行WeText项目的服务端
在<WeText项目:一个基于.NET实现的DDD.CQRS与微服务架构的演示案例>文章中,我介绍了自己用Visual Studio 2015(C# 6.0 with .NET Frame ...
- unity导出工程导入到iOS原生工程中详细步骤
一直想抽空整理一下unity原生工程导入iOS原生工程中的详细步骤.做iOS+vuforia+unity开发这么长时间了.从最初的小小白到现在的小白.中间趟过了好多的坑.也有一些的小小收货.做一个喜欢 ...
- CEGUI0.8.4引入到自己工程中
首先要确定你的CEGUI已经完全编译好,若未进行这一步请参照http://www.cnblogs.com/wenguang1996/p/5027522.html 打开VS2012新建C++工程,然后添 ...
- 关于在工程中添加新文件时的LNK2019错误的一个解决办法
我这几天一直在研究Qt的串口程序,在读懂了官方给出的实例程序后我决定把其多线程的串口监视程序加入到我自己的工程中,便直接把问价复制到自己的工程下面,在Qt中加入到自己的工程中,但是总是出现LNK201 ...
随机推荐
- css基础回顾-定位:position
w3school 对position定义和说明是: 定义和用法: position 属性规定元素的定位类型. 说明: 这个属性定义建立元素布局所用的定位机制.任何元素都可以定位,不过绝对或固定元素会生 ...
- 深入理解 CSS变形 transform(3d)
坐标轴 在了解透视之前,首先要先了解坐标轴.3D变形与2D变形最大的不同就在于其参考的坐标轴不同.2D变形的坐标轴是平面的,只存在x轴和y轴,而3D变形的坐标轴则是x.y.z三条轴组成的立体空间,x轴 ...
- php获取某个目录下面文件的内容
if(!defined('PATH'))define('PATH', dirname(dirname(__FILE__)).'/');ini_set ( 'include_path', '.:' . ...
- 在Oracle中查询表的大小、表的占用情况和表空间的大小
转载自http://blog.csdn.net/cuker919/article/details/8514253 select segment_name, bytes as 大小 from user_ ...
- String在JAVA里是固定长度的吗?为什么可用“+”连接
所谓长度固定不是你理解的意思而是说String类中存储的char[]是final的,不能修改,你对String的操作实际上是产生了一个新的String,对于某一个String来说,长度就是固定的了 S ...
- PL/SQL中的变量
1.标量: ag1: declare v_ename emp.ename%type;--自己称为单变量 begin select ename into v_ename from emp where e ...
- ORACLE外键和锁
在oracle中,如果外键未加索引,对父表的修改,会导致子表被加上全表锁.这包括两种情况: 1.删除父表中的行,如果外键上没有索引,会导致子表被加上全表锁 2.更新父表的主键(根据关系数据库的原则,更 ...
- (五)Angularjs - 依赖注入
如何找到API? AngularJS提供了一些功能的封装,但是当你试图通过全局对象angular去 访问这些功能时,却发现与以往遇到的库大不相同. 比如,AngularJS暴露了一个全局对象:angu ...
- Eclipse读取xml中文乱码问题解决
解决eclipse读取xml时中文乱码报错问题 在eclipse.ini中加入下而一行 -Dfile.encoding=UTF-8
- 遍历std::list过程中删除元素后继续遍历过程
std::list::erase Erase elements Removes from the list container either a single element (position) o ...