NDK-Build instructions

ndk-build The script can be used to compile projects using NDK’s Make-based build system. In addition, we also provide more specific documents for the configuration of Android.mk and Application.mk used by ndk-build.

Internal compilation

Running the ndk-build script is equivalent to running the following command:

 $GNUMAKE -f /build/core/ build-local.mk
    
    

$GNUMAKE Point to GNU Make 3.81 or higher, < /code> points to the NDK installation directory. You can call ndk-build from other shell scripts (even your own Make files) based on this information.

Call < from the command line /h2>

ndk-build The script is located at the top level of the NDK installation directory. To run the script from the command line, call it in the application project directory or its subdirectories. For example:

 $ cd 
    $ /ndk-build
    

In this example, points to the root directory of the project, < ndk> is the directory where you installed the NDK.

Options

All parameters of ndk-build will be passed directly to the underlying GNU make command that runs the NDK compilation script. Please use ndk-build with the options in the form ndk-build. For example:

 $ ndk-build clean
    

You can use the following options:

clean < /dt>

Remove all previously generated binary files.

Note: On Mac OS X, running ndk-build clean in a large number of parallel executions may cause the following messages to appear Compilation error:

 rm: fts_read: No such file or directory
    

To avoid this problem, please consider not using -jN modifier, or select a smaller value (such as 2) for N.

V=1
Start the compilation and display the compilation command.
-B
Force a complete recompilation.
-B V=1
Force a complete recompilation and display the compilation command.
NDK_LOG=1
Display internal NDK log messages (used to debug the NDK itself).
NDK_DEBUG=1
Enforce debuggable compilation (see Table 1 for details).
NDK_DEBUG=0
Mandatory execution of release compilation (see Table 1 for details).
NDK_HOST_32BIT=1
Always use the tool chain in 32-bit mode (see 64-bit and 32-bit tool chains for details).
NDK_APPLICATION_MK=
Use NDK_APPLICATION_MK the specific Application.mk file pointed to by the variable Compile.
-C
Compile the native code located in the project path of . This option is very useful if you do not want to switch to this path via cd in the terminal.

debug version compilation and release Version compilation

Use NDK_DEBUG Option, and under specific circumstances, specify the debug version or release version to compile, optimize related behaviors, and whether to include symbols through AndroidManifest.xml. Table 1 shows the results of each possible setting combination.

Table 1. NDK_DEBUG (command line) and android:debuggable (list) The result of the combination.

List settings NDK_DEBUG=0 NDK_DEBUG=1 NDK_DEBUG is not specified
android:debuggable="true" debugging; symbol; optimized*1 debugging; symbol; not optimized*2 (same as NDK_DEBUG=1)
android:debuggable="false" release; symbol; optimized release; symbol; not optimized release; unsigned; optimized*3

*1: For analysis.
*2: The default value used to run ndk-gdb.
*3: The default mode.

Note: NDK_DEBUG=0 is equivalent to APP_OPTIM=release, And compile with -O2. NDK_DEBUG=1 is equivalent to APP_OPTIM=debug in Application.mk, and compiled with -O0. To learn more about APP_OPTIM, please refer to Application.mk.

For example, the syntax on the command line is:

 $ ndk-build NDK_DEBUG=1
    

64-bit and 32-bit toolchain

Some toolchains come with both 64-bit and 32-bit versions. For example, the directories /toolchain//prebuilt/ and /prebuilt/ may contain both linux-x86 and linux-x86_64 folder for Linux tools in 32-bit and 64-bit modes respectively. The ndk-build script will automatically select the 64-bit version of the toolchain (if supported by the host operating system). You can force the use of a 32-bit toolchain by using NDK_HOST_32BIT=1 in your own environment or on the ndk-build command line.

Please note that 64-bit tools can make better use of host resources (for example, they are faster and can handle larger programs), while they can still generate 32-bit Android binaries.

Requires

Usually, you need to install GNU Make 3.81 or higher to use ndk-build or NDK. The compilation script will detect non-compliant Make tools and generate an error message.

If you have installed GNU Make 3.81, but the default make command does not start it, please define GNUMAKE in your environment so that you can start ndk-build pointed to it before. For example:

 $ export GNUMAKE=/usr/local/bin/gmake
    $ ndk-build
    

You can add other hosts in $NDK/prebuilt//bin/ The pre-compilation tool is replaced with the following environment variables:

 $ export NDK_HOST_AWK=
    $ export NDK_HOST_ECHO=
    $ export NDK_HOST_CMP=
    

td>

< td>Release; unsigned; optimized*3

List settings NDK_DEBUG=0 NDK_DEBUG=1 NDK_DEBUG is not specified
android:debuggable ="true" Debug; symbol; optimized*1 Debug; symbol; not optimized*2 (same as NDK_DEBUG=1)
android:debuggable="false" release; symbol; optimized release; symbol; not optimized

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3591 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.