1page.title=Standalone Toolchain 2@jd:body 3 4<div id="qv-wrapper"> 5 <div id="qv"> 6 <h2>On this page</h2> 7 8 <ol> 9 <li><a href="#syt">Selecting Your Toolchain</a></li> 10 <li><a href="#sys">Selecting Your Sysroot</a></li> 11 <li><a href="#itc">Invoking the Compiler</a></li> 12 <li><a href="#wwc">Working with Clang</a></li> 13 <li><a href="#abi">ABI Compatibility</a></li> 14 <li><a href="#war">Warnings and Limitations</a></li> 15 </ol> 16 </div> 17 </div> 18 19<p>You can use the toolchains provided with the Android NDK independently, or as plug-ins 20with an existing IDE, such as Eclipse. This flexibility 21can be useful if you already have your own build system, and only need the ability to invoke the 22cross-compiler in order to add support to Android for it.</p> 23 24<p>A typical use case is invoking the configure script of an open-source library that expects a 25cross-compiler in the {@code CC} environment variable.</p> 26 27<p class="note"><strong>Note:</strong> This page assumes significant understanding of 28compiling, linking, and low-level architecture. In addition, the techniques it describes are 29unnecessary for most use cases. In most cases, we recommend that you forego using a standalone 30toolchain, and instead stick to the NDK build system.</p> 31 32<h2 id="syt">Selecting Your Toolchain</h2> 33<p>Before anything else, you need to decide which processing architecture your standalone toolchain 34is going to target. Each architecture corresponds to a different toolchain name, as Table 1 35shows.</p> 36 37<p class="table-caption" id="table1"> 38 <strong>Table 1.</strong> {@code APP_ABI} settings for different instruction sets.</p> 39<table> 40 <tr> 41 <th scope="col">Architecture</th> 42 <th scope="col">Toolchain name</th> 43 </tr> 44 <tr> 45 <td>ARM-based</td> 46 <td>{@code arm-linux-androideabi-<gcc-version>}</td> 47 </tr> 48 <tr> 49 <td>x86-based</td> 50 <td>{@code x86-<gcc-version>}</td> 51 </tr> 52 <tr> 53 <td>MIPS-based</td> 54 <td>{@code mipsel-linux-android-<gcc-version>}</td> 55 </tr> 56 <tr> 57 <td>ARM64-based</td> 58 <td>{@code aarch64-linux-android-<gcc-version>}</td> 59 </tr> 60 <tr> 61 <td>X86-64-based</td> 62 <td>{@code x86_64-<gcc-version>}</td> 63 </tr> 64 <tr> 65 <td>MIPS64-based</td> 66 <td>{@code mips64el-linux-android--<gcc-version>}</td> 67 </tr> 68</table> 69 70 71 72<h2 id="sys">Selecting Your Sysroot</h2> 73<p>The next thing you need to do is define your <i>sysroot</i> (A sysroot is a directory containing 74the system headers and libraries for your target). To define the sysroot, you must must know the 75Android API level you want to target for native support; available native APIs vary by Android API 76level.</p> 77 78<p>Native APIs for the respective <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html"> 79Android API levels</a> reside under {@code $NDK/platforms/}; each API-level 80directory, in turn, contains subdirectories for the various CPUs and architectures. The 81following example shows how to define a <em>sysroot</em> for a build targeting Android 5.0 82(API level 21), for ARM architecture:</p> 83 84<pre class="no-pretty-print"> 85SYSROOT=$NDK/platforms/android-21/arch-arm 86</pre> 87 88For more detail about the Android API levels and the respective native APIs they support, see 89<a href={@docRoot}ndk/guides/stable_apis.html>Android NDK Native APIs</a>. 90 91<h2 id="itc">Invoking the Compiler</h2> 92 93<p>There are two ways to invoke the compiler. One method is simple, and leaves most of the lifting 94to the build system. The other is more advanced, but provides more flexibility.</p> 95 96<h3 id="sm">Simple method</h3> 97<p>The simplest way to build is by invoking the appropriate compiler directly from the command 98line, using the {@code --sysroot} option to indicate the location of the system files for the 99platform you're targeting. For example:</p> 100 101<pre class="no-pretty-print"> 102export CC="$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/ \ 103linux-x86/bin/arm-linux-androideabi-gcc-4.8 --sysroot=$SYSROOT" 104$CC -o foo.o -c foo.c 105</pre> 106 107<p>While this method is simple, it lacks in flexibility: It does not allow you to use any C++ STL 108(STLport, libc++, or the GNU libstdc++) with it. It also does not support exceptions or RTTI.</p> 109 110<p>For Clang, you need to perform an additional two steps:</p> 111<ul> 112<ol type="1"> 113<li>Add the appropriate {@code -target} for the target architecture, as Table 2 shows.</li> 114 115<p class="table-caption" id="table2"> 116 <strong>Table 2.</strong> Architectures and corresponding values for {@code -target}.</p> 117 <table> 118 <tr> 119 <th scope="col">Architecture</th> 120 <th scope="col">Value</th> 121 </tr> 122 <tr> 123 <td>armeabi</td> 124 <td>{@code -target armv5te-none-linux-androideabi}</td> 125 </tr> 126 <tr> 127 <td>armeabi-v7a</td> 128 <td>{@code -target armv7-none-linux-androideabi}</td> 129 </tr> 130 <tr> 131 <td>arm64-v8a</td> 132 <td>{@code -target aarch64-none-linux-android}</td> 133 </tr> 134 <tr> 135 <td>x86</td> 136 <td>{@code -target i686-none-linux-android}</td> 137 </tr> 138 <tr> 139 <td>x86_64</td> 140 <td>{@code -target x86_64-none-linux-android}</td> 141 </tr> 142 <tr> 143 <td>mips</td> 144 <td>{@code -target mipsel-none-linux-android}</td> 145 </tr> 146</table> 147 148<li>Add assembler and linker support by adding the {@code -gcc-toolchain} option, as in the 149following example:</li> 150<pre class="no-pretty-print"> 151-gcc-toolchain $NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64 152</pre> 153</ol> 154 155Ultimately, a command to compile using Clang might look like this: 156 157<pre class="no-pretty-print"> 158export CC="$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/ \ 159linux-x86/bin/arm-linux-androideabi-gcc-4.8 --sysroot=$SYSROOT" -target \ 160armv7-none-linux-androideabi \ 161-gcc-toolchain $NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64" 162$CC -o foo.o -c foo.c 163</pre> 164</ul> 165 166<h3>Advanced method</h3> 167<p>The NDK provides the {@code make-standalone-toolchain.sh} shell script to allow you to perform a 168customized toolchain installation from the command line. This approach affords you more flexibility 169than the procedure described in <a href="#sm">Simple method</a>.</p> 170 171<p>The script is located in the {@code $NDK/build/tools/} directory, where {@code $NDK} is the 172installation root for the NDK. An example of the use of this script appears below:</p> 173 174<pre class="no-pretty-print"> 175$NDK/build/tools/make-standalone-toolchain.sh \ 176--arch=arm --platform=android-21 --install-dir=/tmp/my-android-toolchain 177</pre> 178 179<p>This command creates a directory named {@code /tmp/my-android-toolchain/}, containing a copy of 180the {@code android-21/arch-arm} sysroot, and of the toolchain binaries for a 32-bit ARM 181architecture.</p> 182 183<p>Note that the toolchain binaries do not depend on or contain host-specific paths, in other words, 184you can install them in any location, or even move them if you need to.</p> 185 186<p>By default, the build system uses the 32-bit, ARM-based GCC 4.8 toolchain. You can specify a 187different value, however, by specifying {@code --arch=<toolchain>} as an option. 188Table 3 shows the values to use for other toolchains: 189 190<p class="table-caption" id="table3"> 191 <strong>Table 3.</strong> Toolchains and corresponding values, using {@code --arch}.</p> 192 <table> 193 <tr> 194 <th scope="col">Toolchain</th> 195 <th scope="col">Value</th> 196 </tr> 197 <tr> 198 <td>mips64 compiler</td> 199 <td>{@code --arch=mips64}</td> 200 </tr> 201 <tr> 202 <td>mips GCC 4.8 compiler</td> 203 <td>{@code --arch=mips}</td> 204 </tr> 205 <tr> 206 <td>x86 GCC 4.8 compiler</td> 207 <td>{@code --arch=x86}</td> 208 </tr> 209 <tr> 210 <td>x86_64 GCC 4.8 compiler</td> 211 <td>{@code --arch=x86_64}</td> 212 </tr> 213 <tr> 214 <td>mips GCC 4.8 compiler</td> 215 <td>{@code --arch=mips}</td> 216 </tr> 217</table> 218 219<p>Alternatively, you can use the {@code --toolchain=<toolchain>} option. Table 4 shows the 220values you can specify for {@code <toolchain>}:</p> 221 222<p class="table-caption" id="table4"> 223 <strong>Table 4.</strong> Toolchains and corresponding values, using {@code --toolchain}.</p> 224 <table> 225 <tr> 226 <th scope="col">Toolchain</th> 227 <th scope="col">Value</th> 228 </tr> 229 230 <tr> 231 <td>arm</td> 232 <td> 233 <li>{@code --toolchain=arm-linux-androideabi-4.8}</li> 234 <li>{@code --toolchain=arm-linux-androideabi-4.9}</li> 235 <li>{@code --toolchain=arm-linux-android-clang3.5}</li> 236 <li>{@code --toolchain=arm-linux-android-clang3.6}</li> 237 </td> 238 </tr> 239 <tr> 240 <td>x86</td> 241 <td> 242 <li>{@code --toolchain=x86-linux-android-4.8}</li> 243 <li>{@code --toolchain=x86-linux-android-4.9}</li> 244 <li>{@code --toolchain=x86-linux-android-clang3.5}</li> 245 <li>{@code --toolchain=x86-linux-android-clang3.6}</li> 246 </td> 247 </tr> 248 <tr> 249 <td>mips</td> 250 <td> 251 <li>{@code --toolchain=mips-linux-android-4.8}</li> 252 <li>{@code --toolchain=mips-linux-android-4.9}</li> 253 <li>{@code --toolchain=mips-linux-android-clang3.5}</li> 254 <li>{@code --toolchain=mips-linux-android-clang3.6}</li> 255 </td> 256 </tr> 257 258 <tr> 259 <td>arm64</td> 260 <td> 261 <li>{@code --toolchain=aarch64-linux-android-4.9}</li> 262 <li>{@code --toolchain=aarch64-linux-android-clang3.5}</li> 263 <li>{@code --toolchain=aarch64-linux-android-clang3.6}</li> 264 </td> 265 </tr> 266 <tr> 267 <td>x86_64</td> 268 <td> 269 <li>{@code --toolchain=x86_64-linux-android-4.9}</li> 270 <li>{@code --toolchain=x86_64-linux-android-clang3.5}</li> 271 <li>{@code --toolchain=x86_64-linux-android-clang3.6}</li> 272 </td> 273 </tr> 274 <tr> 275 <td>mips64</td> 276 <td> 277 <li>{@code --toolchain=mips64el-linux-android-4.9}</li> 278 <li>{@code --toolchain=mips64el-linux-android-clang3.5}</li> 279 <li>{@code --toolchain=mips64el-linux-android-clang3.6}</li> 280 </td> 281 </tr> 282</table> 283 284<p class="note"><strong>Note: </strong> Table 4 is not an exhaustive list. Other combinations may 285also be valid, but are unverified.</p> 286 287<p>You can also copy Clang/LLVM 3.6, using one of two methods: You can append {@code -clang3.6} to 288the {@code --toolchain} option, so that the {@code --toolchain} option looks like the following 289example: 290 291<pre class="no-pretty-print"> 292--toolchain=arm-linux-androideabi-clang3.6 293</pre> 294 295<p>You can also add {@code -llvm-version=3.6} as a separate option on the command 296line.</p> 297 298<p class="note"><strong>Note: </strong>Instead of specifying a specific version, you can also 299use {@code <version>}, which defaults 300to the highest available version of Clang.</p> 301 302<p>By default, the build system builds for a 32-bit host toolchain. You can specify a 64-bit 303host toolchain instead. Table 5 shows the value to use with {@code -system} for different 304platforms.</p> 305 306<p class="table-caption" id="table5"> 307 <strong>Table 5.</strong> Host toolchains and corresponding values, using {@code -system}.</p> 308 <table> 309 <tr> 310 <th scope="col">Host toolchain</th> 311 <th scope="col">Value</th> 312 </tr> 313 <tr> 314 <td>64-bit Linux</td> 315 <td>{@code -system=linux-x86_64}</td> 316 </tr> 317 <tr> 318 <td>64-bit MacOSX</td> 319 <td>{@code -system=darwin-x86_64}</td> 320 </tr> 321 <tr> 322 <td>64-bit Windows</td> 323 <td>{@code -system=windows-x86_64}</td> 324 </tr> 325</table> 326 327For more information on specifying a 64- or 32-bit instruction host toolchain, see 328<a href="{@docRoot}ndk/guides/ndk-build.html#6432">64-Bit and 32-Bit Toolchains</a>. 329 330<p>You may specify {@code --stl=stlport} to copy {@code libstlport} instead of the default 331{@code libgnustl}. If you do so, and you wish to link against the shared library, you must 332explicitly use {@code -lstlport_shared}. This requirement is similar to having to use 333{@code -lgnustl_shared} for GNU {@code libstdc++}.</p> 334 335<p>Similarly, you can specify {@code --stl=libc++} to copy the LLVM libc++ headers and libraries. 336To link against the shared library, you must explicitly use -lc++_shared.</p> 337 338<p>You can make these settings directly, as in the following example:</p> 339 340<pre class="no-pretty-print"> 341export PATH=/tmp/my-android-toolchain/bin:$PATH 342export CC=arm-linux-androideabi-gcc # or export CC=clang 343export CXX=arm-linux-androideabi-g++ # or export CXX=clang++ 344</pre> 345 346<p>Note that if you omit the {@code -install-dir} option, the {@code make-standalone-toolchain.sh} 347shell script creates a tarball in {@code tmp/ndk/<toolchain-name>.tar.bz2}. This tarball makes 348it easy to archive, as well as to redistribute the binaries.</p> 349 350<p>This standalone toolchain provides an additional benefit, as well, in that it contains a working 351copy of a C++ STL library, with working exceptions and RTTI support.</p> 352 353<p>For more options and details, use {@code --help}.</p> 354 355<h2 id="wwc">Working with Clang</h2> 356<p>You can install Clang binaries in the standalone installation by using the 357{@code --llvm-version=<version>} option. {@code <version>} is a LLVM/Clang version 358number, such as {@code 3.5} or {@code 3.6}. For example: 359 360<pre class="no-pretty-print"> 361build/tools/make-standalone-toolchain.sh \ 362--install-dir=/tmp/mydir \ 363--toolchain=arm-linux-androideabi-4.8 \ 364--llvm-version=3.6 365</pre> 366 367<p>Note that Clang binaries are copied along with the GCC ones, because they rely on the same 368assembler, linker, headers, libraries, and C++ STL implementation.</p> 369 370<p>This operation also installs two scripts, named {@code clang} and {@code clang++}, under 371{@code <install-dir>/bin/@}. These scripts invoke the real {@code clang} binary with default 372target architecture flags. In other words, they should work without any modification, and you should 373be able to use them in your own builds by just setting the {@code CC} and {@code CXX} environment 374variables to point to them.</p> 375 376<h4>Invoking Clang</h4> 377<p>In an ARM standalone installation built with {@code llvm-version=3.6}, invoking 378<a href="http://clang.llvm.org/">Clang</a> on a Unix system takes the form of a single line. For 379instance:</p> 380 381<pre class="no-pretty-print"> 382`dirname $0`/clang36 -target armv5te-none-linux-androideabi "$@" 383</pre> 384 385<p><code>clang++</code> invokes <code>clang++31</code> in the same way.</p> 386 387<h4>Clang targets with ARM</h4> 388 389<p>When building for ARM, Clang changes the target based on the presence of the 390{@code -march=armv7-a} and/or {@code -mthumb} options:</p> 391 392<p class="table-caption" id="table5"> 393 <strong>Table 5.</strong> Specifiable {@code -march} values and their resulting targets.</p> 394 <table> 395 <tr> 396 <th scope="col">{@code -march} value</th> 397 <th scope="col">Resulting target</th> 398 </tr> 399 <tr> 400 <td>{@code -march=armv7-a}</td> 401 <td>{@code armv7-none-linux-androideabi}</td> 402 </tr> 403 <tr> 404 <td>{@code -mthumb}</td> 405 <td>{@code thumb-none-linux-androideabi}</td> 406 </tr> 407 <tr> 408 <td>Both {@code -march=armv7-a} and {@code -mthumb}</td> 409 <td>{@code thumbv7-none-linux-androideabi}</td> 410 </tr> 411</table> 412 413<p>You may also override with your own {@code -target} if you wish.</p> 414 415<p>The {@code -gcc-toolchain} option is unnecessary because, in a standalone package, 416Clang locates {@code as} and {@code ld} in a predefined relative location. <p> 417 418<p>{@code clang} and {@code clang++} should be easy drop-in replacements for {@code gcc} and 419{@code g++} in a makefile. When in doubt, add the following options to verify that they are 420working properly:</p> 421 422<ul> 423<li>{@code -v} to dump commands associated with compiler driver issues</li> 424<li>{@code -###} to dump command line options, including implicitly predefined ones.</li> 425<li>{@code -x c < /dev/null -dM -E} to dump predefined preprocessor definitions</li> 426<li>{@code -save-temps} to compare {@code *.i} or {@code *.ii} preprocessed files.</li> 427</ul> 428 429<p>For more information about Clang, see 430<a href="http://clang.llvm.org/">http://clang.llvm.org/</a>, especially the GCC compatibility 431section.</p> 432 433 434<h2 id="abi">ABI Compatibility</h2> 435<p>The machine code that the ARM toolchain generates should be compatible with the official Android 436{@code armeabi} <a href="{@docRoot}ndk/guides/abis.html">ABI</a> by default.</p> 437 438<p>We recommend use of the {@code -mthumb} compiler flag to force the generation of 16-bit Thumb-1 439instructions (the default being 32-bit ARM instructions).</p> 440 441<p>If you want to target the armeabi-v7a ABI, you must set the following flags: </p> 442 443<pre class="no-pretty-print"> 444CFLAGS= -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 445</pre> 446 447<p>The first flag enables Thumb-2 instructions. The second flag enables hardware-FPU instructions 448while ensuring that the system passes floating-point parameters in core registers, which is critical 449for ABI compatibility.</p> 450 451<p class="note"><strong>Note: </strong>In versions of the NDK prior to r9b, do not use these flags 452separately. You must set all or none of them. Otherwise, unpredictable behavior and crashes may 453result.</p> 454 455<p>To use NEON instructions, you must change the {@code -mfpu} compiler flag:</p> 456 457<pre class="no-pretty-print"> 458CFLAGS= -march=armv7-a -mfloat-abi=softfp -mfpu=neon 459</pre> 460 461<p>Note that this setting forces the use of {@code VFPv3-D32}, per the ARM specification.</p> 462 463<p>Also, make sure to provide the following two flags to the linker:</p> 464 465<pre class="no-pretty-print"> 466LDFLAGS= -march=armv7-a -Wl,--fix-cortex-a8 467</pre> 468 469<p>The first flag instructs the linker to pick {@code libgcc.a}, {@code libgcov.a}, and 470{@code crt*.o}, which are tailored for armv7-a. The 2nd flag is required as a workaround for a CPU 471bug in some Cortex-A8 implementations.</p> 472 473<p>Since NDK version r9b, all Android native APIs taking or returning double or float values have 474{@code attribute((pcs("aapcs")))} for ARM. This makes it possible to compile user code in 475{@code -mhard-float} (which implies {@code -mfloat-abi=hard}), and still link with the Android 476native APIs that comply with the softfp ABI. For more information on this, see the comments in 477{@code $NDK/tests/device/hard-float/jni/Android.mk}.</p> 478 479<p>If you want to use NEON intrinsics on x86, the build system can translate them to the native x86 480SSE intrinsics using a special C/C++ language header with the same name, {@code arm_neon.h}, as the 481standard ARM NEON intrinsics header.</p> 482 483<p>By default, the x86 ABI supports SIMD up to SSSE3, and the header covers ~93% of (1869 of 2009) 484NEON functions.</p> 485 486<p>You don't have to use any specific compiler flag when targeting the MIPS ABI.</p> 487 488<p>To learn more about ABI support, see <a href="{@docRoot}ndk/guides/x86.html">x86 Support</a>.</p> 489 490<h2 id="war">Warnings and Limitations</h2> 491<h3>Windows support</h3> 492<p>The Windows binaries do not depend on Cygwin. This lack of dependency makes them faster. The 493cost, however, is that they do not understand Cygwin path specifications like 494{@code cygdrive/c/foo/bar}, as opposed to {@code C:/foo/bar}.</p> 495 496<p>The NDK build system ensures that all paths passed to the compiler from Cygwin are automatically 497translated, and manages other complexities, as well. If you have a custom build system, 498you may need to resolve these complexities yourself.</p> 499 500<p>For information on contributing to support for Cygwin/MSys, visit the android-ndk 501<a href="https://groups.google.com/forum/#!forum/android-ndk">forum</a>.</p> 502 503<h3>wchar_t support</h3> 504 505<p>The Android platform did not really support {@code wchar_t} until Android 2.3 (API level 9). This 506fact has several ramifications:</p> 507<ul> 508<li>If you target platform Android 2.3 or higher, the size of {@code wchar_t} is 4 bytes, and most 509{@code wide-char} functions are available in the C library (with the exception of multi-byte 510encoding/decoding functions and {@code wsprintf}/{@code wsscanf}).</li> 511 512<li>If you target any lower API level, the size of {@code wchar_t} is 1 byte, and none of the 513wide-char functions works.</li> 514</ul> 515 516<p>We recommend that you get rid of any dependencies on the {@code wchar_t} type, and switch to 517better representations. The support provided in Android is only there to help you migrate existing 518code.</p> 519 520<h3>Exceptions, RTTI, and STL</h3> 521<p>The toolchain binaries support C++ exceptions and RTTI by default. To disable C++ exceptions 522and RTTI when building sources (to generate lighter-weight machine code, for example), use 523{@code -fno-exceptions} and {@code -fno-rtti}.</p> 524 525<p>To use these features in conjunction with GNU libstdc++, you must explicitly link with libsupc++. 526To do so, use {@code -lsupc++} when linking binaries. For example:</p> 527 528<pre class="no-pretty-print"> 529arm-linux-androideabi-g++ .... -lsupc++ 530</pre> 531 532<p>You do not need to do this when using the STLport or libc++ library.</p> 533 534<h3>C++ STL support</h3> 535<p>The standalone toolchain includes a copy of a C++ Standard Template Library implementation. This 536implementation is either for GNU libstdc++, STLport, or libc++, depending on what you specify for the 537{@code --stl=<name>} option described previously. To use this implementation of STL, you need 538to link your project with the proper library:</p> 539 540<ul> 541<li> 542Use {@code -lstdc++} to link against the static library version of any implementation. Doing so 543ensures that all required C++ STL code is included into your final binary. This method is ideal if 544you are only generating a single shared library or executable.</p> 545 546<p>This is the method that we recommend.</p> 547</li> 548 549<li>Alternatively, use {@code -lgnustl_shared} to link against the shared library version of GNU 550{@code libstdc++}. If you use this option, you must also make sure to copy 551{@code libgnustl_shared.so} to your device in order for your code to load properly. Table 6 shows 552where this file is for each toolchain type. 553</li> 554 555<p class="note"><strong>Note: </strong>GNU libstdc++ is licensed under the GPLv3 license, with a 556linking exception. If you cannot comply with its requirements, you cannot redistribute the 557shared library in your project.</p> 558 559 560<li>Use {@code -lstlport_shared} to link against the shared library version of STLport. When you do 561so, you need to make sure that you also copy {@code libstlport_shared.so} to your device in order 562for your code to load properly. Table 6 shows where this file is for each toolchain:</li> 563 564<p class="table-caption" id="table6"> 565 <strong>Table 6.</strong> Specifiable {@code -march} values and their resulting targets.</p> 566 <table> 567 <tr> 568 <th scope="col">Toolchain</th> 569 <th scope="col">Location</th> 570 </tr> 571 <tr> 572 <td>arm</td> 573 <td>{@code $TOOLCHAIN/arm-linux-androideabi/lib/}</td> 574 </tr> 575 <tr> 576 <td>arm64</td> 577 <td>{@code $TOOLCHAIN/aarch64-linux-android/lib/}</td> 578 </tr> 579 <tr> 580 <td>x86</td> 581 <td>{@code $TOOLCHAIN/i686-linux-android/lib/}</td> 582 </tr> 583 <tr> 584 <td>x86_64</td> 585 <td>{@code $TOOLCHAIN/x86_64-linux-android/lib/}</td> 586 </tr> 587 <tr> 588 <td>mips</td> 589 <td>{@code $TOOLCHAIN/mipsel-linux-android/lib/}</td> 590 </tr> 591 <tr> 592 <td>mips64</td> 593 <td>{@code $TOOLCHAIN/mips64el-linux-android/lib/}</td> 594 </tr> 595</table> 596 597<p class="note"><strong>Note: </strong>If your project contains multiple shared libraries or 598executables, you must link against a shared-library STL implementation. Otherwise, the build 599system does not define certain global uniquely, which can result in unpredictable runtime behavior. 600This behavior may include crashes and failure to properly catch exceptions.</p> 601 602<p>The reason the shared version of the libraries is not simply called {@code libstdc++.so} is that 603this name would conflict at runtime with the system's own minimal C++ runtime. For this reason, 604the build system enforces a new name for the GNU ELF library. The static library does not have 605this problem.</p> 606