安卓系统源码编译系列(四)——LOCAL_WHOLE_STATIC_LIBRARIES和LOCAL_STATIC_LIBRARIES的区别浅析

本文分析了Android.mk中LOCAL_WHOLE_STATIC_LIBRARIES和LOCAL_STATIC_LIBRARIES的区别,通过静态编译libchromium_net库依赖libicuuc和libicui18n的示例,解释了当静态库嵌套编译时,如何避免函数缺失问题。四种解决方案中,第四种能在保证最小库大小的同时确保编译成功。
摘要由CSDN通过智能技术生成

当我们需要单独编译安卓系统的某个模块供应用使用时,就需要自己编写或修改Android.mk文件,下面就对Android.mk中两个容易混淆的概念(LOCAL_WHOLE_STATIC_LIBRARIES和LOCAL_STATIC_LIBRARIES)进行分析。

先看看谷歌的官方文档:

LOCAL_STATIC_LIBRARIES

These are the static libraries that you want to include in your module. Mostly, we use shared libraries, but there are a couple of places, like executables in sbin and host executables where we use static libraries instead.

LOCAL_WHOLE_STATIC_LIBRARIES

These are the static libraries that you want to include in your module without allowing the linker to remove dead code from them. This is mostly useful if you want to add a static library to a shared library and have the static library's content exposed from the shared library.

从以上内容可知,LOCAL_WHOLE_STATIC_LIBRARIES会加载整个静态库,LOCAL_STATIC_LIBRARIES只是加载静态库中用到的函数。看起来它们作用只是使最终生成的库文件大小不一样而已,但是
  • 3
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值