What is Android NDK–a File by File View

Android NDK is a collection of tools and libraries that allow us to develop Android apps in C/C++. This post dissect the latest Android NDK release r8c by providing detailed information about the files and directories.

build: the build tools and scripts

–awk: some awk programs used internally by NDK build system, mainly for parsing various files of an Android NDK project.

–core: mk files used internally by NDK build system.
–gmsl: GNU make standard library.  A collection of functions implemented using native GNU Make functionality that provide list and string manipulation, integer arithmetic, associative arrays, stacks, and debugging facilities.

–tools: a collection of tools (mainly scripts) used for NDK compilation, installation, etc. We don’t need to use these tools as a NDK app developer.

docs: the documentations
–ANDROID-ATOMICS.html: issues about Android atomic operations defined in sys/atomics.h

–ANDROID-MK.html: how Android.mk file works

–APPLICATION-MK.html: how Application.mk file works

–CHANGES.html: the NDK change log for all NDK versions.

–CPLUSPLUS-SUPPORT.html: C++ support on Android. Different runtimes are discussed.

–CPU-ARCH-ABIS.html: native code Application Binary Interface (ABI) management. Supported ABIs include arm, arm-v7a, x86 and mips.

–CPU-ARM-NEON.html: how to use the NEON features available on some arm cpu.

–CPU-FEATURES.html: how to detect CPU families and features using the cpu-features library.

–CPU-MIPS.html: how to enable MIPS support at Android NDK

–CPU-X86.html: how to enable x86 support at Android NDK

–DEVELOPMENT.html: how to modify, compile and generate release packages of NDK

–HOWTO.html: a collection of commonly used tips and tricks.

–IMPORT-MODULE.html: how to import a module outside of project source tree.

–INSTALL.html: how to install Android NDK

–LICENSES.html: license

–NATIVE-ACTIVITY.HTML: how to development and build native activity and application

–NDK-BUILD.html: how ndk-build command works

–NDK-GDB.html: how ndk-debug command works

–NDK-STACK.html: how to use the ndk-stack tool

–openmaxal:

—-index.html: Android specific doc about OpenMAX AL

—-OpenMAX_AL_1_0_1_Specification.pdf: the OpenMAX AL specification 1.0.1

–opensles

—-index.html: Android specific doc about OpenSL ES

—-OpenSL_ES_Specification_1.0.1.pdf: the OpenSL ES specification 1.0.1

–OVERVIEW.html: Android NDK overview

–PREBUILTS.html: How Android prebuilt library works

–sidenav.html: sidebar for the documentation, basically a menu

–STABLE-APIS.html: the list of stable APIs available at different Android API level.

–STANDALONE-TOOLCHAIN.html: how to use the NDK toolchain as a standalone compiler.

–system

—-libc

——CHANGES.html: Android Bionic C change log.

——OVERVIEW.html: Android Bionic C library overview.

——SYSV-IPC.html: explains why Android doesn’t support System V IPCs.

–SYSTEM-ISSUES.html: a list of known issues at Android NDK and Android system images.

documentation.html: the documentation html main page

GNUmakefile: a small script used to detect NDK path. It “includes” /build/core/main.mk. possibly the entry point of NDK build system.

ndk-build: the entry point for building NDK code

ndk-build.cmd: a Windows batch script to invoke NDK-specific GNU Make executables

ndk-gdb: the entry point for debugging NDK code

ndk-stack: a tool that allows us to trace the stack in a shared library with the logcat output. The details of this tool can be found at docs/NDK-STACK.html.

ndk-which: a tool to learn the path of the active toolchain components within the ndk.

platforms: The platform files, the libraries and header files for various Android API level at different platforms.
–android-3:

—-arch-arm: the logical root directory for libraries and headers at Android-3 ARM

–android-4:

—-arch-arm: the logical root directory for libraries and headers at Android-4 ARM

–android-5:

—-arch-arm: the logical root directory for libraries and headers at Android-5 ARM

–android-8:

—-arch-arm: the logical root directory for libraries and headers at Android-8 ARM

–android-9:

—-arch-arm: the logical root directory for libraries and headers at Android-9 ARM

—-arch-mips: the logical root directory for libraries and headers at Android-9 MIPS

—-arch-x86: the logical root directory for libraries and headers at Android-9 x86

–android-14:
—-arch-arm: the logical root directory for libraries and headers at Android-14 ARM
——usr:
——–include:
——–lib:
—-arch-mips: the logical root directory for libraries and headers at Android-14 MIPS
——usr:
——–include:
——–lib:
—-arch-x86: the logical root directory for libraries and headers at Android-14 x86
——usr:
——–include:
——–lib:
prebuilt: contains the prebuilt binaries required by the host and the target platform
–android-arm: some binaries used by NDK on arm target
—-gdbserver
——gdbserver: gdb server
–android-mips: some binaries used by NDK on MIPS target
—-gdbserver
——gdbserver: gdb server
–android-x86: some binaries used by NDK on x86 target
—-gdbserver
——gdbserver: gdb server
–linux-x86: some binaries used by the Android NDK build system
—-bin:
——awk: an interpreted programming language typically used as a data extraction and reporting tool.
——make: a tool which controls the generation of executables and other non-source files of a program from source files.
——sed: stream editor. A utility that parses text and applies transformations to text.

README.TXT: introduction for Android NDK

RELEASE.TXT: contains NDK version.

samples: contains a few sample NDK projects.
–bitmap-plasma: jnigraphics API
–hello-gl2: OpenGL ES v2.
–hello-jni: basic example for JNI
–hello-neon: how to use cpufeatures to detect CPU features and how to use NEON feature of ARM CPU
–module-exports: how to use a module in another module.
–native-activity: how to create nativity actitiy
–native-audio: OpenSL ES audio API
–native-media: OpenMAX AL media API
–native-plasma: native_app_glue
–san-angeles: OpenGL ES v1.
–test-libstdc++: build native executable
–two-libs: two libraries, where the second depends on the first one.

sources: some library modules and their source code
–android:

—-cpufeatures: a library that helps us detecting device CPU type and features. source code available.

—-libportable: Device Shared Library libportable. (???)

—-libthread_db: the sources of the special libthread_db that will be statically linked against the gdbserver binary. These are uses automatically by the build-gdbserver.sh script. This is not an import module.

—-native_app_glue: the android_native_app_glue module, used for creating a native activity.

–cpufeatures: the cpufeatures import module. just a link to android/cpufeatures.

–cxx-stl: various C++ runtime libraries, refer to docs/CPLUSPLUS-SUPPORT.html for more details.
—-gabi++: gabi++ C++ runtime
—-gnu-libstdc++: GNU C++ runtime
—-stlport:  stlport C++ runtime
—-system:  system default C++ runtime=

tests: scripts and sources to perform automated testing for NDK release
–awk: test files for awk
–build: contains tests used to check the NDK build system itself.
–check-release.sh: a few sanity checks on a given NDK release install/package.
–device: contains tests used to check that NDK-generated binaries work properly on an Android device.

–README: description about the folders under tests
–run-tests-all.sh: run all tests
–run-tests.sh: used to run NDK build tests. Without any parameters, this will try to run all standard tests.

–standalone: test programs and scripts for testing a standalone toolchain.

toolchains: toolchains for various platforms, we only show arm-linux-androideabi-4.6 in detail

–arm-linux-androideabi-4.6: toolchain used to compile for arm architecture android ABI on linux with gcc 4.6

—-config.mk: config file for the arm gcc-4.6 toolchain for the Android NDK

—-setup.mk: this file is used to prepare the NDK to build with the arm gcc-4.6 toolchain any number of source files. It defines (or re-defines) templates used to build various sources into target object files, libraries or executables.

—-prebuilt

——linux-x86

——–arm-linux-androideabi

———-lib:

————ldscripts:

———-bin: the tools in this directory is the same as the corresponding binaries (with arm-linux-androideabi- prefix) in the linux-x86/bin directory. including ar, as, c++, g++, gcc, ld, ld.bfd, ld.gold, nm, objcopy, objdump, ranlib, strip

——–bin:

———-arm-linux-androideabi-addr2line: Convert addresses into line number/file name pairs. e.g.: arm-linux-androideabi-addr2line -C -f –e obj/local/armeabi/libnativemaprender.so 0003deb4 (Binutils)

———-arm-linux-androideabi-ar: archiver, used to create modify and extract from libraries. It is normally used to create static libraries. (Binutils)

———-arm-linux-androideabi-as: assembler. (Binutils)

———-arm-linux-androideabi-c++: C++ front end, same as arm-linux-androideabi-g++ (gcc)

———-arm-linux-androideabi-c++filt: Filter to demangle encoded C++ symbols. (Binutils)

———-arm-linux-androideabi-cpp: C preprocessor. The C preprocessor implements the macro language used to transform C, C++, and Objective-C programs before they are compiled. (gcc)

———-arm-linux-androideabi-elfedit: examine and modify ELF metadata within an ELF object. (Binutils)

———-arm-linux-androideabi-g++: GCC compiler C++ front end (gcc)

———-arm-linux-androideabi-gcc: GCC compiler C front end (gcc)

———-arm-linux-androideabi-gcc-4.6: same as above. (gcc)

———-arm-linux-androideabi-gcov: program to test code coverage. (gcc)

———-arm-linux-androideabi-gdb: gdb debugger. (gdb)

———-arm-linux-androideabi-gdbtui: gdb text user interface. (gdb)

———-arm-linux-androideabi-gprof: display profiling info (Binutils)

———-arm-linux-androideabi-ld: linker. same as arm-linux-androideabi-ld.gold (Binutils)

———-arm-linux-androideabi-ld.bfd: linker using BFD, the Binary File Descriptor library.(Binutils)

———-arm-linux-androideabi-ld.gold: a new faster, ELF only linker. (Binutils)

———-arm-linux-androideabi-nm: Lists symbols from object files. (Binutils)

———-arm-linux-androideabi-objcopy: Copy and translates object files. (Binutils)

———-arm-linux-androideabi-objdump: Displays information from object files. (Binutils)

———-arm-linux-androideabi-ranlib: Generates an index to the contents of an archive. The index lists all the symbols defined by archive members that are relocatable object files. (Binutils)

———-arm-linux-androideabi-readelf: Displays information from any ELF format object file. (Binutils)

———-arm-linux-androideabi-run: for manipulating simulators.

———-arm-linux-androideabi-size:  Lists the section sizes of an object or archive file. (Binutils)

———-arm-linux-androideabi-strings: Lists printable strings from files. (Binutils)

———-arm-linux-androideabi-strip: remove symbols. (Binutils)

——–include:

———-lib:

————libiberty.a: contains routines used by various GNU programs, including getopt, obstack, strerror, strtol, and stroul

————libarm-elf-linux-sim.a:

————libarm-linux-android-sim.a:

————gcc:
————–arm-linux-androideabi:
—————-4.6:
——————libgcov.a: a library used by GCC compiler to support code coverage test.
——————libgcc.a: a library used by GCC compiler for some low-level computations.
——————gcov-src: the source code for libgcov
——————crtbegin.o: program initialization code. refer to http://gcc.gnu.org/onlinedocs/gccint/Initialization.html
——————crtbeginS.o: variant of crtbegin.o
——————crtbeginT.o: variant of crtbegin.o
——————crtend.o: program destruction code.
——————crtendS.o: variant of crtend.o
——————arm-v7a: files for arm-v7a ABI
——————thumb: files for thumb code
——–lib32:
———-libbfd.a: the binary file descriptor library. It is a package which allows applications to use the same routines to operate on object files of different object file formats. (Binutils)

———-libbfd.la:  libtool library file for libbfd.a

———-libintl.a: it is a library that provides native language (non-english) support to programs. It is a part of gettext.

———-libexec: some utilities and libraries used by GCC internally
——–gcc:
———-arm-linux-androideabi:
————4.6: some utilities and libraries used by GCC internally, including collect2, cc1, cc1plus etc.
——–SOURCES: description about the sources for the toolchain
——–sysroot: root directory for headers and libraries
———-usr: prefix

————lib: same as content platforms/android-<depends on the sysroot set when compiling the toolchain>/arch-arm/usr/lib/

————include: same as content in platforms/android-<depends on the sysroot set when compiling the toolchain>/arch-arm/usr/include/

–arm-linux-androideabi-4.4.3: toolchain used to compile for arm architecture android ABI on linux with gcc 4.4.3

–arm-linux-androideabi-clang3.1: toolchain used to compile for ARM architecture android ABI on linux with gcc 4.4.3 (contains the config.mk and setup.mk files only)

–llvm-3.1: contains the clang compiler from LLVM

–mipsel-linux-android-4.4.3: toolchain used to compile for MIPS architecture android ABI on linux with gcc 4.4.3

–mipsel-linux-android-4.6: toolchain used to compile for MIPS architecture android ABI on linux with gcc 4.6

–mipsel-linux-android-clang3.1: toolchain used to compile for MIPS architecture android ABI on linux with clang 3.1 (contains the config.mk and setup.mk files only)

–x86-4.4.3: toolchain used to compile for x86 architecture android ABI on linux with gcc 4.4.3

–x86-4.6:  toolchain used to compile for x86 architecture android ABI on linux with gcc 4.6

–x86-clang3.1:  toolchain used to compile for x86 architecture android ABI on linux with clang 3.1 (contains the config.mk and setup.mk files only)

Leave a Reply

Your email address will not be published. Required fields are marked *