commit | b56bb19bf892770b07c4a083a406abccf5e640ba | [log] [tgz] |
---|---|---|
author | Ryan Prichard <[email protected]> | Mon Oct 09 16:55:27 2017 -0700 |
committer | Ryan Prichard <[email protected]> | Mon Oct 09 16:55:27 2017 -0700 |
tree | 0061f159e86d56c7d8a14424a7dd6ff20446ecc0 | |
parent | a22ba3d35f0b489fba9ac1bc40f8d41d73da3496 [diff] |
Fix the PIC code in the x86 yasm test and add x86_64 support This instruction was segfaulting: mov [esp], dword fmt wrt ..gotoff The build-time linker replaces "fmt wrt ..gotoff" with an offset from the end of the GOT to the fmt symbol. We need to setup a PIC register (in ebx) containing the end address of the GOT, then add ebx to the fmt gotoffset. Also: extend the test to x86_64 to fix the buganizer bug. Bug: http://b/24620865 Test: ./run_tests.py --filter yasm --abi x86 --abi x86_64 --rebuild Change-Id: I60dd0f594bf6b5a9b48385808687513653035f2f
The latest version of this document is available at https://android.googlesource.com/platform/ndk/+/master/README.md.
Note: This document is for developers of the NDK, not developers that use the NDK.
The NDK allows Android application developers to include native code in their Android application packages, compiled as JNI shared libraries.
Both Linux and Windows NDKs are built on Linux machines. Windows host binaries are cross-compiled with MinGW.
Building the NDK for Mac OS X requires at least 10.8.
The NDK components can be loosely grouped into host toolchains, target prebuilts, build systems, and support libraries.
toolchains/
contains GCC and Clang toolchains.$TOOLCHAIN/config.mk
contains ARCH and ABIS this toolchain can handle.$TOOLCHAIN/setup.mk
contains toolchain-specific default CFLAGS/LDFLAGS when this toolchain is used.prebuilt/$HOST_TAG
contains build dependencies and additional tools.ndk-depends
, ndk-stack
and ndk-gdb
can also be found here.sysroot/usr/include
contains the headers for the NDK. See Unified Headers for more information.platforms/android-$VERSION/arch-$ARCH_NAME/
contains stub shared libraries and a few static libraries for each API level. See Platform APIs for more information.sources/cxx-stl/$STL
contains the headers and libraries for the various C++ STLs.prebuilt/android-$ARCH/gdbserver
contains gdbserver.build/
contains ndk-build, the NDK's home grown build system. Most of the implementation lives in build/core
.build/cmake
contains components for using the NDK with CMake (at present only a CMake toolchain file, but in the future it will contain CMake modules that CMake will load, obviating the need for a toolchain file).build/tools
contains make_standalone_toolchain.py
, but also contains legacy sripts that were used to build the NDK. Eventually, this should contain nothing but the standalone toolchain scripts.sources/android
and sources/third_party
contain modules that can be used in apps (gtest, cpufeatures, native_app_glue, etc) via $(call import-module,$MODULE)
.Check out the branch master-ndk
repo init -u https://android.googlesource.com/platform/manifest \ -b master-ndk # Googlers, use repo init -u \ persistent-https://android.git.corp.google.com/platform/manifest \ -b master-ndk
Additional Linux Dependencies (available from apt):
Mac OS X also requires Xcode.
Running tests requires that adb
is in your PATH
. This is provided as part of the Android SDK.
$ python checkbuild.py
$ python checkbuild.py --system windows # Or windows64.
checkbuild.py
will also build all of the NDK tests. This takes about four times as long as building the NDK itself, so pass --no-build-tests
to skip building the tests. They can be built later with python run_tests.py --rebuild
.
checkbuild.py
also accepts a variety of other options to speed up local builds, namely --arch
and --module
.
By default, checkbuild.py
will also package the NDK. To skip the packaging step, use the --no-package
flag. To avoid packaging an incomplete NDK, packaging will not be run if --module
was passed unless --force-package
was also provided.