- 浏览: 576836 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (338)
- 已过时文章(留念用) (39)
- Android学习笔记 (30)
- Android开发指引自译 (100)
- Android NDK文档自译 (23)
- Android设计指引自译 (2)
- xp(ペケピー)&linux(理奈、铃)酱~ (4)
- ui酱&歌词自译~ (9)
- lua酱~ (9)
- 自我反省 (1)
- 羽game计划 (1)
- XSL酱 (2)
- java酱 (3)
- 设计的领悟 (58)
- 涂鸦作品(pixiv) (1)
- ruby酱 (2)
- Objective-C编程语言自译 (2)
- Android开发月报 (6)
- objc酱 (2)
- photoshop (3)
- js酱 (6)
- cpp酱 (8)
- antlr酱 (7)
- Lua 5.1参考手册自译 (11)
- 收藏品 (3)
- 待宵草计划 (4)
- 体验版截图 (1)
最新评论
-
naruto60:
太给力了!!!!我这网打不开Intel官网,多亏楼主贴了连接, ...
使用HAXM加速的Android x86模拟器(和一些问题) -
yangyile2011:
谢谢博主,翻译得很好哦
【翻译】(4)片段 -
ggwang:
牙痛的彼岸:痹!
牙痛的彼岸 -
ggwang:
总结得很简练清晰啊,学习了!
ANTLR学习笔记一:概念理解 -
leisurelife1990:
mk sdd
用git下载Android自带app的源代码
-----------------
英文文档见android-ndk-r5b的documentation.html
属于Android Native Development Kit (NDK)的一部分
见http://developer.android.com/sdk/ndk/(需要代理)
翻译仅个人见解
-----------------
NDK Prebuilt library support:
NDK 预构建库支持:
-----------------------------
Android NDK r5 introduced support for prebuilt libraries (shared and static), i.e. the ability to include and use, in your applications, prebuilt version of libraries.
Android NDK r5引入预构建库(动态和静态)的支持,即在你的应用程序中包含和使用库的预构建版本。
This feature can be useful for two things:
这个特性可能在两方面有用:
1/ You want to distribute your own libraries to third-party NDK developers without distributing your sources.
1、你想发布你自己的库给第三方NDK开发者而不分发你的源代码。
2/ You want to use a prebuilt version of your own libraries to speed up your build.
2、你想使用你自己的库的预构建版本以加速你的构建。
This document explains how this support works.
这个文档解释这种支持是如何工作的。
I. Declaring a prebuilt library module:
一、声明一个预构建库模块:
---------------------------------------
Each prebuilt library must be declared as a *single* independent module to the build system. Here is a trivial example where we assume that the file "libfoo.so" is located in the same directory than the Android.mk below:
每个预构建库必须向构建系统声明为一个单一独立模块。这里有个小示例,我们假设文件libfoo.so位于以下Android.mk相同的目录中。
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := foo-prebuilt
LOCAL_SRC_FILES := libfoo.so
include $(PREBUILT_SHARED_LIBRARY)
Notice that, to declare such a module, you really only need the following:
注意,要声明这个模块,你实际上只需要以下东西:
1. Give the module a name (here 'foo-prebuilt'). This does not need to correspond to the name of the prebuilt library itself.
1. 给模块一个名称(这里是foo-prebuilt)。不需要对应预构建库本身的名称。
2. Assign to LOCAL_SRC_FILES the path to the prebuilt library you are providing. As usual, the path is relative to your LOCAL_PATH.
2. 把你提供的预构建库的路径赋给LOCAL_SRC_FILES。通常路径相对于你的LOCAL_PATH
IMPORTANT: You *must* ensure that the prebuilt library corresponds to the target ABI you are using. More on this later.
重要:你必须确保预构建库对应你正在使用的目标ABI(注:应用程序二进制接口,即操作系统开放给应用程序的接口)。更多相关信息见后。
3. Include PREBUILT_SHARED_LIBRARY, instead of BUILD_SHARED_LIBRARY, if you are providing a shared, library. For static ones, use PREBUILT_STATIC_LIBRARY.
3. 包含PREBUILT_SHARED_LIBRARY,而非BUILD_SHARED_LIBRARY,如果你提供的是一个动态库。对于静态库,请使用PREBUILT_STATIC_LIBRARY
A prebuilt module does not build anything. However, a copy of your prebuilt shared library will be copied into $PROJECT/obj/local, and another will be copied and stripped into $PROJECT/libs/<abi>.
一个预构建模块不编译任何东西。然而,你的预构建动态库的副本将被复制到$PROJECT/obj/local,而另一个副本将被复制并裁剪进$PROJECT/libs/<abi>。
II. Referencing the prebuilt library in other modules:
二、引用其它模块的预构建库:
------------------------------------------------------
Simply list your prebuilt module's name in the LOCAL_STATIC_LIBRARIES or LOCAL_SHARED_LIBRARIES declaration in the Android.mk of any module that depends on them.
在依赖于你的构建模块的所有模块的Android.mk的LOCAL_STATIC_LIBRARIES或LOCAL_SHARED_LIBRARIES的声明中简单列出这些预构建模块的名称。
For example, a naive example of a module using libfoo.so would be:
例如,一个使用libfoo.so的模块的单纯例子将是:
include $(CLEAR_VARS)
LOCAL_MODULE := foo-user
LOCAL_SRC_FILES := foo-user.c
LOCAL_SHARED_LIBRARY := foo-prebuilt
include $(BUILD_SHARED_LIBRARY)
III. Exporting headers for prebuilt libraries:
三、导出预构建库的头文件:
----------------------------------------------
The example above was called 'naive' because, in practice, the code in foo-user.c is going to depend on specific declarations that are normally found in a header file distributed with the prebuilt library (e.g. "foo.h").
上面的例子被称为“单纯”是因为,实际上,foo-user.c的代码将依赖于特定的声明,那些声明通常在预构建库分发的头文件中找到(例如,foo.h)
In other words, foo-user.c is going to have a line like:
换句话说,foo-user.c将有类似的一行:
#include <foo.h>
And you need to provide the header and its include path to the compiler when building the foo-user module.
而你需要在构建foo-user模块时提供头文件和它的编译器包含目录。
A simple way to deal with that is to use exports in the prebuilt module definition. For example, assuming that a file "foo.h" is located under the 'include' directory relative to the prebuilt module, we can write:
一个简单处理方法是在预构建模块定义中使用导出。例如,假设一个foo.h文件位于相对于预构建模块的include目录下,我们可以这样写:
include $(CLEAR_VARS)
LOCAL_MODULE := foo-prebuilt
LOCAL_SRC_FILES := libfoo.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)
The LOCAL_EXPORT_C_INCLUDES definition here ensures that any module that depends on the prebuilt one will have its LOCAL_C_INCLUDES automatically prepended with the path to the prebuilt's include directory, and will thus be able to find headers inside that.
这里LOCAL_EXPORT_C_INCLUDES的定义确保任何依赖于预构建模块的模块将自动拥有带预构建库包含目录为前置值的LOCAL_C_INCLUDES,而它将能够找到包含其中的头文件。
IV. Debugging prebuilt binaries:
四、调试预构建二进制文件:
--------------------------------
We recommend you to provide prebuilt shared libraries that contain debug symbols. The version that is installed into $PROJECT/libs/<abi>/ is always stripped by the NDK build system, but the debug version will be used for debugging purposes with ndk-gdb.
我们建议你提供包含调试符号的预构建共享库。安装进$PROJECT/libs/<abi>/的版本常常是被NDK构建系统裁剪过(注:ndk提供的工具链中包含了strip工具,它应该是用来优化生成文件的大小),但调试版本将可以供ndk-gdb使用以达到调试目的。
V. ABI Selection of prebuilt binaries:
五、预构建二进制文件的ABI选择:
--------------------------------------
As said previously, it is crucial to provide a prebuilt shared library that is compatible with the targetted ABI during the build. To do that, check for the value of TARGET_ARCH_ABI, its value will be:
正如前面所说,关键问题是在构建期间提供一个兼容于目标ABI的预构建动态库(注:开源是好事啊)。为了做到那点,检查TARGET_ARCH_ABI的值,它的值将是:
armeabi => when targetting ARMv5TE or higher CPUs
armeabi => 目标为ARMv5TE或更高的CPU
armeabi-v7a => when targetting ARMv7 or higher CPUs
armeabi-v7a => 目标为ARMv7或更高的CPU
x86 => when targetting x86 CPUs
x86 => 目标为x86 CPU。
Note that armeabi-v7a systems can run armeabi binaries just fine.
注意armeabi-v7a系统可以很好地运行armeabi的二进制文件。
Here's an example where we provide two versions of a prebuilt library and select which one to copy based on the target ABI:
这里有一个例子,我们提供两个版本的预构建库并且基于目标ABI选择哪一个版本去复制。
include $(CLEAR_VARS)
LOCAL_MODULE := foo-prebuilt
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libfoo.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)
Here. we assume that the prebuilt libraries to copy are under the following directory hierarchy:
这里。我们假设要复制的预构建库位于以下目录层次:
Android.mk --> the file above
Android.mk --> 上面的文件
armeabi/libfoo.so --> the armeabi prebuilt shared library
armeabi/libfoo.so --> armeabi预构建动态库
armeabi-v7a/libfoo.so --> the armeabi-v7a prebuilt shared library
armeabi-v7a/libfoo.so --> armeabi-v7a预构建动态库
include/foo.h --> the exported header file
include/foo.h --> 导出的头文件
NOTE: Remember that you don't need to provide an armeabi-v7a prebuilt library, since an armeabi one can easily run on the corresponding devices.
注意:记住你不需要提供一个armeabi-v7a预构建库,因为armeabi版本可以更容易地运行在相应的设备上。
发表评论
-
【翻译】(25)ANDROID ATOMICS OPERATIONS
2012-02-21 10:22 1742----------------- 英文 ... -
【翻译】(21)Licenses
2011-11-13 21:11 962----------------- 英文文档见android ... -
【翻译】(19)Bionic Changes
2011-11-13 21:08 2528----------------- 英文文档见android ... -
【翻译】(16)Bionic Overview
2011-09-09 23:27 2261----------------- 英文文档见android ... -
【翻译】(17)SYSV IPC
2011-09-09 08:15 1623----------------- 英文文档见android ... -
【翻译】(20)System Issues
2011-09-08 18:22 1097----------------- 英文文档见andr ... -
【翻译】(24)Native Activity
2011-09-08 08:53 1532----------------- 英文文档见android ... -
【翻译】(23)NDK Stack
2011-09-07 16:45 2554----------------- 英文文档见android ... -
【翻译】(22)CPU X86
2011-09-07 15:52 1093----------------- 英文文档见android ... -
【翻译】(15)Standalone Toolchain
2011-04-26 17:05 1571----------------- 英文文档 ... -
【翻译】(14)Stable APIs
2011-04-26 17:04 1556----------------- 英文文档见android ... -
【翻译】(12)NDK GDB
2011-04-26 17:00 1463----------------- 英文文档 ... -
【翻译】(11)NDK Build
2011-04-26 16:58 1585----------------- 英文文档 ... -
【翻译】(10)Import Module
2011-04-26 16:54 1506----------------- 英文文档见android ... -
【翻译】(9)CPU Features
2011-04-26 16:52 1522----------------- 英文文档见android ... -
【翻译】(8)CPU ARM Neon
2011-04-26 16:50 1553----------------- 英文文档见android ... -
【翻译】(7)CPU Arch ABIs
2011-04-26 16:48 1253----------------- 英文文档见android ... -
【翻译】(6)Application.mk File
2011-04-26 16:46 1419----------------- 英文文档 ... -
【翻译】(5)Android.mk File
2011-04-26 16:45 1329----------------- 英文文档见android ... -
【翻译】(4)How To
2011-04-26 16:43 990----------------- 英文文档见android ...
相关推荐
标题中的"android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9"是一个针对Android开发的预构建GCC编译器工具链。这个工具链主要用于将用C语言(由标签"C"指出)编写的源代码编译成可以在Android设备上...
本文将深入探讨标题提及的"android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9",这是一个专为在Linux-x86平台上编译针对aarch64架构的Android应用程序的工具集。这个工具链是Android开放源代码...
预先建立的APK 这是FOSS APK的集合,再加上相应的Android.mk,可轻松集成到Android构建系统中。 这些只是官方未修改的预编译二进制文件,由相应的开发人员签名,除了: ...Additional_repos.xml,因为它只是microG F...
平台厂商预置组件是Android操作系统开发中的一个重要环节,"platform_vendor_prebuilts"这个术语直接关联到Android系统的构建过程。在Android系统中,"vendor"层包含了与硬件紧密相关的驱动程序、库和应用程序,这些...
在深入探讨Android系统开发的过程中,我们经常会遇到一个关键组件——"android_prebuilts_gcc_darwin-x86_x86_x86_64-linux-android-4.9"。这个名字看似复杂,实则包含了丰富的信息,它是我们理解Android编译环境和...
"pocl-android-prebuilts"项目正是为了简化在Android设备上构建POCL的过程,提供了一系列预构建的库。 首先,我们要理解OpenCL是什么。OpenCL是由Khronos Group定义的一种开放标准,用于编写并行程序,可运行在各种...
"android_prebuilts_gcc_darwin-x86_aarch64_aarch64-linux-android-4.9" 是一个专门针对Apple Darwin(Mac OS)x86架构的Android预构建GCC(GNU Compiler Collection)工具链,用于支持Aarch64(64位ARM)架构的...
标题“android_prebuilts_gcc_darwin-x86_arm_arm-linux-androideabi-4.9”指的是Android开发环境中预构建的GNU Compiler Collection (GCC) 工具链,这个工具链是针对Darwin(Mac OS X)系统上的x86架构,用于构建...
在Android开发领域,编译环境的构建是至关重要的一步,而`android_prebuilts_gcc_linux-x86_x86_x86_64-linux-android-4.9`则是Google为Android平台提供的一个预构建的GNU Compiler Collection (GCC) 工具链。...
资源包的名字:prebuilts.rar 下载之后,在linux下使用unrar命令解压 linux系统操作步骤如下: wbyq@wbyq:~/work$ unrar x /prebuilts.rar wbyq@wbyq:~/work$ cd prebuilts/ wbyq@wbyq:~/work$ cd gcc-x64/ ...
android-ndk-r10-mac-x86_64包里toolchains目录下的mips64el-linux-android-4.9和mipsel-linux-android-4.9,可以解决NDK17版本以上编译出现的No toolchains found in the NDK
android Launcher3 androidstudio环境编译缺少的jar包 launcher_protos.jar
【标题】"Controller源码"涉及的是ASP.NET MVC3框架中的关键组件——Controller类的源代码分析。在ASP.NET MVC3中,Controller是应用程序的主要控制层,负责处理来自客户端的请求,协调应用逻辑,并返回相应的视图...
**Fastjson:高效且强大的Java JSON库** Fastjson是阿里巴巴开源的一款高性能的JSON解析和生成库,它在Java社区中广泛被使用,特别是在处理JSON数据的场景下。这个压缩包集合包含了Fastjson的1.2.38版本,具体包括...
1,python的资料。 2,linux下的python下的资料。
### Linux下编译Android内核源码遇到的问题及解决方案 #### 概述 在尝试编译Android内核源码的过程中,经常会遇到各种错误提示。本文将针对这些常见的编译错误进行详细解析,并提供相应的解决办法。...
Cubieboard1 移植到 cm-10.1(android-4.2.2) ... 重要提示:准备好这是 13 Gig 下载。 $ cd ~/cb-cm-10.1 $ 回购同步 运行 cm get-prebuilts $ cd 供应商/厘米 $ ./get-prebuilts 环境设置 $ cd ~/cb-cm-1
pcf8563_i2c1_r8_ruoge_ov2640通过给RTC驱动增加设备节点读取秒钟成功+直接读取I2C1获取秒钟值20160626_2201.7z ...在Android源码树中添加userspace I2C读写工具(i2c-util) 本文使用的开发板是:杭州若格科技有限...
1、Android非SDK接口检测工具(2022.02.16版本) 2、对应的官方地址为: https://android.googlesource.com/platform/prebuilts/runtime/+/master/appcompat
Hyperledger Fabric make: *** No rule to make target问题 最近一段时间,改Fabric代码,发现没法编译了!make总是报找不到target! ➜ fabric git:(master) ✗ make configtxgen make: *** No rule to make target ...