1ndk=true 2page.template=sdk 3 4 5ndk.mac64_download=android-ndk-r10c-darwin-x86_64.bin 6ndk.mac64_bytes=436952863 7ndk.mac64_checksum=bc04ef44b920cf6cd2157b6f2c3531d6 8 9ndk.mac32_download=android-ndk-r10c-darwin-x86.bin 10ndk.mac32_bytes=435858709 11ndk.mac32_checksum=6b3e143f7e64d5cd337b727513e27913 12 13ndk.linux64_download=android-ndk-r10c-linux-x86_64.bin 14ndk.linux64_bytes=449013322 15ndk.linux64_checksum=792c61706cd9ec6713fa1b69b2f42996 16 17ndk.linux32_download=android-ndk-r10c-linux-x86.bin 18ndk.linux32_bytes=438555265 19ndk.linux32_checksum=d1595d9ca5e15484e047f1ac326c4ceb 20 21ndk.win64_download=android-ndk-r10c-windows-x86_64.exe 22ndk.win64_bytes=458925419 23ndk.win64_checksum=af8edf5d316e1bf1a5a72e04a9faec41 24 25ndk.win32_download=android-ndk-r10c-windows-x86.exe 26ndk.win32_bytes=433102815 27ndk.win32_checksum=805a04810719886674d3c7bff5eca53f 28 29 30 31 32page.title=Android NDK 33@jd:body 34 35 36 37 38<div id="tos" style="display:none;width:760px;height:0;margin:0 auto"> 39 40<div id="download" class="ndk" style=" 41z-index: 99; 42width: 720px; 43position: absolute; 44margin: -70px 0; 45padding: 14px; 46background: white; 47border: 1px solid #999; 48box-shadow: -10px 10px 50px #888; 49-moz-box-shadow: -10px 10px 50px #888; 50-webkit-box-shadow: -10px 10px 50px #888;"> 51<p>Before installing the Android NDK, you must agree to the following terms and conditions.</p> 52<div class="sdk-terms" style="width:auto" onfocus="this.blur()"> 53<h2 class="norule">Terms and Conditions</h2> 54This is the Android Software Development Kit License Agreement 55 56<h3>1. Introduction</h3> 571.1 The Android Software Development Kit (referred to in this License Agreement as the "SDK" and 58specifically including the Android system files, packaged APIs, and Google APIs add-ons) is 59licensed to you subject to the terms of this License Agreement. This License Agreement forms a 60legally binding contract between you and Google in relation to your use of the SDK. 61 621.2 “Android” means the Android software stack for devices, as made available under the Android 63Open Source Project, which is located at the following URL: http://source.android.com/, as updated 64from time to time. 65 661.3 "Google" means Google Inc., a Delaware corporation with principal place of business at 1600 67Amphitheatre Parkway, Mountain View, CA 94043, United States. 68 69 70<h3>2. Accepting this License Agreement</h3> 712.1 In order to use the SDK, you must first agree to this License Agreement. You may not use the 72SDK if you do not accept this License Agreement. 73 742.2 By clicking to accept, you hereby agree to the terms of this License Agreement. 75 762.3 You may not use the SDK and may not accept the License Agreement if you are a person barred 77from receiving the SDK under the laws of the United States or other countries including the country 78in which you are resident or from which you use the SDK. 79 802.4 If you are agreeing to be bound by this License Agreement on behalf of your employer or other 81entity, you represent and warrant that you have full legal authority to bind your employer or such 82entity to this License Agreement. If you do not have the requisite authority, you may not accept 83the License Agreement or use the SDK on behalf of your employer or other entity. 84 85 86<h3>3. SDK License from Google</h3> 873.1 Subject to the terms of this License Agreement, Google grants you a limited, worldwide, 88royalty-free, non-assignable and non-exclusive license to use the SDK solely to develop 89applications to run on the Android platform. 90 913.2 You agree that Google or third parties own all legal right, title and interest in and to the 92SDK, including any Intellectual Property Rights that subsist in the SDK. "Intellectual Property 93Rights" means any and all rights under patent law, copyright law, trade secret law, trademark law, 94and any and all other proprietary rights. Google reserves all rights not expressly granted to you. 95 963.3 You may not use the SDK for any purpose not expressly permitted by this License Agreement. 97Except to the extent required by applicable third party licenses, you may not: (a) copy (except for 98backup purposes), modify, adapt, redistribute, decompile, reverse engineer, disassemble, or create 99derivative works of the SDK or any part of the SDK; or (b) load any part of the SDK onto a mobile 100handset or any other hardware device except a personal computer, combine any part of the SDK with 101other software, or distribute any software or device incorporating a part of the SDK. 102 1033.4 You agree that you will not take any actions that may cause or result in the fragmentation of 104Android, including but not limited to distributing, participating in the creation of, or promoting 105in any way a software development kit derived from the SDK. 106 1073.5 Use, reproduction and distribution of components of the SDK licensed under an open source 108software license are governed solely by the terms of that open source software license and not this 109License Agreement. 110 1113.6 You agree that the form and nature of the SDK that Google provides may change without prior 112notice to you and that future versions of the SDK may be incompatible with applications developed 113on previous versions of the SDK. You agree that Google may stop (permanently or temporarily) 114providing the SDK (or any features within the SDK) to you or to users generally at Google's sole 115discretion, without prior notice to you. 116 1173.7 Nothing in this License Agreement gives you a right to use any of Google's trade names, 118trademarks, service marks, logos, domain names, or other distinctive brand features. 119 1203.8 You agree that you will not remove, obscure, or alter any proprietary rights notices (including 121copyright and trademark notices) that may be affixed to or contained within the SDK. 122 123 124<h3>4. Use of the SDK by You</h3> 1254.1 Google agrees that it obtains no right, title or interest from you (or your licensors) under 126this License Agreement in or to any software applications that you develop using the SDK, including 127any intellectual property rights that subsist in those applications. 128 1294.2 You agree to use the SDK and write applications only for purposes that are permitted by (a) 130this License Agreement and (b) any applicable law, regulation or generally accepted practices or 131guidelines in the relevant jurisdictions (including any laws regarding the export of data or 132software to and from the United States or other relevant countries). 133 1344.3 You agree that if you use the SDK to develop applications for general public users, you will 135protect the privacy and legal rights of those users. If the users provide you with user names, 136passwords, or other login information or personal information, you must make the users aware that 137the information will be available to your application, and you must provide legally adequate 138privacy notice and protection for those users. If your application stores personal or sensitive 139information provided by users, it must do so securely. If the user provides your application with 140Google Account information, your application may only use that information to access the user's 141Google Account when, and for the limited purposes for which, the user has given you permission to 142do so. 143 1444.4 You agree that you will not engage in any activity with the SDK, including the development or 145distribution of an application, that interferes with, disrupts, damages, or accesses in an 146unauthorized manner the servers, networks, or other properties or services of any third party 147including, but not limited to, Google or any mobile communications carrier. 148 1494.5 You agree that you are solely responsible for (and that Google has no responsibility to you or 150to any third party for) any data, content, or resources that you create, transmit or display 151through Android and/or applications for Android, and for the consequences of your actions 152(including any loss or damage which Google may suffer) by doing so. 153 1544.6 You agree that you are solely responsible for (and that Google has no responsibility to you or 155to any third party for) any breach of your obligations under this License Agreement, any applicable 156third party contract or Terms of Service, or any applicable law or regulation, and for the 157consequences (including any loss or damage which Google or any third party may suffer) of any such 158breach. 159 160 161<h3>5. Your Developer Credentials</h3> 1625.1 You agree that you are responsible for maintaining the confidentiality of any developer 163credentials that may be issued to you by Google or which you may choose yourself and that you will 164be solely responsible for all applications that are developed under your developer credentials. 165 166 167<h3>6. Privacy and Information</h3> 1686.1 In order to continually innovate and improve the SDK, Google may collect certain usage 169statistics from the software including but not limited to a unique identifier, associated IP 170address, version number of the software, and information on which tools and/or services in the SDK 171are being used and how they are being used. Before any of this information is collected, the SDK 172will notify you and seek your consent. If you withhold consent, the information will not be 173collected. 174 1756.2 The data collected is examined in the aggregate to improve the SDK and is maintained in 176accordance with Google's Privacy Policy. 177 178 179<h3>7. Third Party Applications</h3> 1807.1 If you use the SDK to run applications developed by a third party or that access data, content 181or resources provided by a third party, you agree that Google is not responsible for those 182applications, data, content, or resources. You understand that all data, content or resources which 183you may access through such third party applications are the sole responsibility of the person from 184which they originated and that Google is not liable for any loss or damage that you may experience 185as a result of the use or access of any of those third party applications, data, content, or 186resources. 187 1887.2 You should be aware the data, content, and resources presented to you through such a third 189party application may be protected by intellectual property rights which are owned by the providers 190(or by other persons or companies on their behalf). You may not modify, rent, lease, loan, sell, 191distribute or create derivative works based on these data, content, or resources (either in whole 192or in part) unless you have been specifically given permission to do so by the relevant owners. 193 1947.3 You acknowledge that your use of such third party applications, data, content, or resources may 195be subject to separate terms between you and the relevant third party. In that case, this License 196Agreement does not affect your legal relationship with these third parties. 197 198 199<h3>8. Using Android APIs</h3> 2008.1 Google Data APIs 201 2028.1.1 If you use any API to retrieve data from Google, you acknowledge that the data may be 203protected by intellectual property rights which are owned by Google or those parties that provide 204the data (or by other persons or companies on their behalf). Your use of any such API may be 205subject to additional Terms of Service. You may not modify, rent, lease, loan, sell, distribute or 206create derivative works based on this data (either in whole or in part) unless allowed by the 207relevant Terms of Service. 208 2098.1.2 If you use any API to retrieve a user's data from Google, you acknowledge and agree that you 210shall retrieve data only with the user's explicit consent and only when, and for the limited 211purposes for which, the user has given you permission to do so. 212 213 214<h3>9. Terminating this License Agreement</h3> 2159.1 This License Agreement will continue to apply until terminated by either you or Google as set 216out below. 217 2189.2 If you want to terminate this License Agreement, you may do so by ceasing your use of the SDK 219and any relevant developer credentials. 220 2219.3 Google may at any time, terminate this License Agreement with you if: 222(A) you have breached any provision of this License Agreement; or 223(B) Google is required to do so by law; or 224(C) the partner with whom Google offered certain parts of SDK (such as APIs) to you has terminated 225its relationship with Google or ceased to offer certain parts of the SDK to you; or 226(D) Google decides to no longer provide the SDK or certain parts of the SDK to users in the country 227in which you are resident or from which you use the service, or the provision of the SDK or certain 228SDK services to you by Google is, in Google's sole discretion, no longer commercially viable. 229 2309.4 When this License Agreement comes to an end, all of the legal rights, obligations and 231liabilities that you and Google have benefited from, been subject to (or which have accrued over 232time whilst this License Agreement has been in force) or which are expressed to continue 233indefinitely, shall be unaffected by this cessation, and the provisions of paragraph 14.7 shall 234continue to apply to such rights, obligations and liabilities indefinitely. 235 236 237<h3>10. DISCLAIMER OF WARRANTIES</h3> 23810.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SDK IS AT YOUR SOLE RISK AND THAT THE 239SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF ANY KIND FROM GOOGLE. 240 24110.2 YOUR USE OF THE SDK AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED THROUGH THE USE OF THE 242SDK IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR 243COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF DATA THAT RESULTS FROM SUCH USE. 244 24510.3 GOOGLE FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY KIND, WHETHER EXPRESS 246OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, 247FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 248 249 250<h3>11. LIMITATION OF LIABILITY</h3> 25111.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT GOOGLE, ITS SUBSIDIARIES AND AFFILIATES, AND ITS 252LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF LIABILITY FOR ANY DIRECT, INDIRECT, 253INCIDENTAL, SPECIAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY 254LOSS OF DATA, WHETHER OR NOT GOOGLE OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF OR SHOULD HAVE BEEN 255AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING. 256 257 258<h3>12. Indemnification</h3> 25912.1 To the maximum extent permitted by law, you agree to defend, indemnify and hold harmless 260Google, its affiliates and their respective directors, officers, employees and agents from and 261against any and all claims, actions, suits or proceedings, as well as any and all losses, 262liabilities, damages, costs and expenses (including reasonable attorneys fees) arising out of or 263accruing from (a) your use of the SDK, (b) any application you develop on the SDK that infringes 264any copyright, trademark, trade secret, trade dress, patent or other intellectual property right of 265any person or defames any person or violates their rights of publicity or privacy, and (c) any 266non-compliance by you with this License Agreement. 267 268 269<h3>13. Changes to the License Agreement</h3> 27013.1 Google may make changes to the License Agreement as it distributes new versions of the SDK. 271When these changes are made, Google will make a new version of the License Agreement available on 272the website where the SDK is made available. 273 274 275<h3>14. General Legal Terms</h3> 27614.1 This License Agreement constitutes the whole legal agreement between you and Google and 277governs your use of the SDK (excluding any services which Google may provide to you under a 278separate written agreement), and completely replaces any prior agreements between you and Google in 279relation to the SDK. 280 28114.2 You agree that if Google does not exercise or enforce any legal right or remedy which is 282contained in this License Agreement (or which Google has the benefit of under any applicable law), 283this will not be taken to be a formal waiver of Google's rights and that those rights or remedies 284will still be available to Google. 285 28614.3 If any court of law, having the jurisdiction to decide on this matter, rules that any 287provision of this License Agreement is invalid, then that provision will be removed from this 288License Agreement without affecting the rest of this License Agreement. The remaining provisions of 289this License Agreement will continue to be valid and enforceable. 290 29114.4 You acknowledge and agree that each member of the group of companies of which Google is the 292parent shall be third party beneficiaries to this License Agreement and that such other companies 293shall be entitled to directly enforce, and rely upon, any provision of this License Agreement that 294confers a benefit on (or rights in favor of) them. Other than this, no other person or company 295shall be third party beneficiaries to this License Agreement. 296 29714.5 EXPORT RESTRICTIONS. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND REGULATIONS. YOU MUST 298COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND REGULATIONS THAT APPLY TO THE SDK. THESE 299LAWS INCLUDE RESTRICTIONS ON DESTINATIONS, END USERS AND END USE. 300 30114.6 The rights granted in this License Agreement may not be assigned or transferred by either you 302or Google without the prior written approval of the other party. Neither you nor Google shall be 303permitted to delegate their responsibilities or obligations under this License Agreement without 304the prior written approval of the other party. 305 30614.7 This License Agreement, and your relationship with Google under this License Agreement, shall 307be governed by the laws of the State of California without regard to its conflict of laws 308provisions. You and Google agree to submit to the exclusive jurisdiction of the courts located 309within the county of Santa Clara, California to resolve any legal matter arising from this License 310Agreement. Notwithstanding this, you agree that Google shall still be allowed to apply for 311injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction. 312 313 314<em>November 13, 2012</em> 315</div> 316 317 318 319<div id="sdk-terms-form"> 320<p> 321<input id="agree" type="checkbox" name="agree" value="1" onclick="onAgreeChecked()" /> 322<label id="agreeLabel" for="agree">I have read and agree with the above terms and conditions</label> 323</p> 324<p><a href="" class="button disabled ndk" id="downloadForRealz" onclick="return onDownloadNdkForRealz(this);"></a></p> 325</div> 326 327 328 329</div> 330</div> 331 332 <div id="qv-wrapper"> 333 <div id="qv"> 334 <h2>In this document</h2> 335 336 <ol> 337 <li><a href="#Downloads">Downloads</a></li> 338 <li><a href="#Revisions">Revisions</a></li> 339 <li><a href="#Reqs">System and Software Requirements</a></li> 340 <li><a href="#Installing">Installing the NDK</a></li> 341 <li><a href="#GetStarted">Getting Started with the NDK</a> 342 <ol> 343 <li><a href="#Using">Using the NDK</a></li> 344 </ol> 345 </li> 346 <li><a href="#Contents">Contents of the NDK</a> 347 <ol> 348 <li><a href="#Tools">Development tools</a></li> 349 <li><a href="#Docs">Documentation</a></li> 350 <li><a href="#Samples">Sample apps</a></li> 351 </ol> 352 </li> 353 </ol> 354 </div> 355 </div> 356 357 <p>The NDK is a toolset that allows you to implement parts 358 of your app using native-code languages such as C and C++. For certain types of apps, 359 this can be helpful so you can reuse existing code libraries written in these 360 languages, but most apps do not need the Android NDK.</p> 361 362 <p>Before downloading the NDK, you should understand that <strong>the NDK 363 will not benefit most apps</strong>. As a developer, you need to balance its benefits 364 against its drawbacks. Notably, using native code on Android 365 generally does not result in a noticable performance improvement, 366 but it always increases your app complexity. In general, you should only use the NDK 367 if it is essential to your app—never because you simply prefer to program in C/C++.</p> 368 369 <p>Typical good candidates for the NDK are CPU-intensive workloads such as game engines, 370 signal processing, physics simulation, and so on. When examining 371 whether or not you should develop in native code, think about your requirements and see if the 372 Android framework APIs provide the functionality that you need.</p> 373 374 375<h2 id="Downloads">Downloads</h2> 376 377 378<script> 379$('#Downloads').after($('#download-table')); 380</script> 381 382<h2 id="Revisions">Revisions</h2> 383 384<p>The following sections provide information about releases of the NDK.</p> 385 386 387<div class="toggle-content opened"> 388 <p> 389 <a href="#" onclick="return toggleContent(this)"> <img 390 src="/assets/images/triangle-opened.png" class="toggle-content-img" alt="" 391 >Android NDK, Revision 10c</a> <em>(October 2014)</em> 392 </p> 393 <div class="toggle-content-toggleme"> 394 <dl> 395 <dt>Important changes:</dt> 396 <dd> 397 <ul> 398 <li>Made the following changes to download structure:</li> 399 <ul> 400 <li>Each package now contains both the 32- and the 64-bit headers, libraries, and tools for 401 its respective platform.</li> 402 <li>STL libraries with debugging info no longer need be downloaded separately.</li> 403 </ul> 404 <li>Changed everything previously called <code>Android-L</code> to the official release 405 designation: <code>android-21</code>.</li> 406 <li>Updated GCC 4.9 by rebasing to the <code>google</code> branch 407 of the GCC repository. Major differences from the upstream version of GCC 4.9 include:</li> 408 409 <ul> 410 <li>The <code>-O2</code> option now turns on vectorization, without loop peeling but with more 411 aggressive unrolling.</li> 412 <li>Enhancements to FDO and <a href="https://gcc.gnu.org/wiki/LightweightIpo#LIPO_-_Profile_Feedback_Based_Lightweight_IPO"> 413 LIPO</a></li> 414 <p>For more detailed information, see <em>Important bug fixes</em> below.</p> 415 </ul> 416 417 <li>Added Clang 3.5 support to all hosts: <code>NDK_TOOLCHAIN_VERSION=clang</code> 418 now picks Clang 3.5. Note that:</li> 419 <ul> 420 421 <li>ARM and x86 default to using the integrated assembler. If this causes issues, use 422 <code>-fno-integrated-as</code> as a workaround.</code> 423 <li>Clang 3.5 issues more warnings for unused flags, such as the <code>-finline-functions</code> 424 option that GCC supports.</li> 425 <p>When migrating from projects using GCC, you can use 426 <code>-Wno-invalid-command-line-argument</code> and <code>-Wno-unused-command-line-argument</code> 427 to ignore the unused flags until you're able decide on what to do with them longer-term.</p> 428 429 </ul> 430 <li>Made it possible to enter ART debugging mode, when debugging on an Android 5.0 device using 431 ART as its virtual machine, by specifying the <code>art-on</code> option. For more information, 432 see <code>prebuilt/common/gdb/common.setup</code> in the directory containing the NDK.</li> 433 <li>Removed support for Clang 3.3.</li> 434 <li>Deprecated GCC 4.6, and may remove it from future releases.</li> 435 <li>Updated mclinker to 2.8 with Identical Code Folding ("ICF") support. Specify ICF using the 436 <code>--icf</code> option.</li> 437 <li>Broadened <code>arm_neon.h</code> support in x86 and x86_64, attaining coverage of ~93% of 438 NEON intrinsics. For more information about NEON support: 439 <ul> 440 <li>Navigate to the NDK Programmer's Guide (<code>docs/Programmers_Guide/html/</code>), and see 441 Architectures and CPUs > Neon.</li> 442 <li>Examine the updated <code>hello-neon</code> sample in <code>samples/</code>. 443 <li>See Intel's guide to <a href="https://software.intel.com/en-us/blogs/2012/12/12/from-arm-neon-to-intel-mmxsse-automatic-porting-solution-tips-and-tricks"> porting from ARM NEON to Intel SSE.</a></li> 444 </ul> 445 <li>Documented support for <code>_FORTIFY_SOURCE</code> in <code>headers/libs/android-21</code>, 446 which appeared in r10 (when <code>android-21</code> was still called <code>Android-L</code>), 447 but had no documentation.</li> 448 </ul> 449 </dd> 450 <dl> 451 452 453 <dt>Important bug fixes:</dt> 454 <dd> 455 <ul> 456 <li>Fixed an internal compiler error with GCC4.9/aarch64 that was causing the following 457 error message (Issue <a href="http://b.android.com/77564">77564</a>):</li> 458<pre> 459internal compiler error: in simplify_const_unary_operation, at simplify-rtx.c:1539 460</pre> 461 <li>Fixed incorrect code generation from GCC4.9/arm. (Issue 462 <a href="http://b.android.com/77567">77567<a>)</li> 463 <li>Fixed an internal compiler error with GCC4.9/mips involving inline-assembly. (Issue 464 <a href="http://b.android.com/77568">77568</a>)</li> 465 <li>Fixed incorrect code that GCC4.9/arm was generating for <code>x = (cond) ? y : x</code>. 466 (Issue <a href="http://b.android.com/77569">77569</a>)</li> 467 <li>Fixed GCC4.9/aarch64 and Clang3.5/aarch64 to work around the 468 <a href="http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20141006/116322.html"> 469 Cortex-A53 erratum (835769)</a> by default. Disable the workaround by specifying 470 <code>-mno-fix-cortex-a53-835769</code>.</li> 471 </ul> 472 </dd> 473 474 475 <dt>Other bug fixes:</dt> 476 <dd> 477 <ul> 478 <li>Made the following header and library fixes to <code>android-21</code>: 479 <ul> 480 481 <li>Added more TV keycodes: <code>android/keycodes.h</code></li> 482 <li>Added more constants and six new sensor functions to <code>android/sensor.h</code>: 483 <code>ASensorManager_getDefaultSensorEx</code>, <code>ASensor_getFifoMaxEventCount</code>, 484 <code>ASensor_getFifoReservedEventCount</code>, <code>ASensor_getStringType</code>, 485 <code>ASensor_getReportingMode</code>, and <code>ASensor_isWakeUpSensor</code>.</li> 486 <li>Fixed <code>stdatomic.h</code> to improve compatibility with GCC 4.6, and provide support 487 for the <code><atomic></code> header.</li> 488 <li>Added <code>sys/ucontext.h</code> and <code>sys/user.h</code> to all API levels. The 489 <code>signal.h</code> header now includes <code><sys/ucontext.h></code>. You may 490 remove any existing definition of <code>struct ucontext</code>.</li> 491 <li>Added <code>posix_memalign</code> to API levels 17, 18, and 19.</li> 492 <li>Added the following functions to all architectures: 493 <code>android_set_abort_message</code>, <code>posix_fadvise</code>, 494 <code>posix_fadvise64</code>, <code>pthread_gettid_np</code>.</li> 495 <li>Added the required permissions to the <code>native-media/AndroidManifest.xml</code> 496 sample. 497 (Issue <a href="https://android-review.googlesource.com/#/c/106640/">106640</a>)</li> 498 <li>Added <code>clock_nanosleep</code> and <code>clock_settime</code> to API level 21. (Issue 499 <a href="http://b.android.com/77372">77372</a>) 500 <li>Removed the following symbols from all architectures: 501 <code>get_malloc_leak_info</code>, <code>free_malloc_leak_info</code>, 502 <code>__srget</code>, <code>__swbuf</code>, <code>__srefill</code>, <code>__swsetup</code>, 503 <code>__sdidinit</code>, <code>__sflags</code>, <code>__sfp</code>, 504 <code>__sinit</code>, <code>__smakebuf</code>, <code>__sflush</code>, <code>__sread</code>, 505 <code>__swrite</code>, <code>__sseek</code>, <code>__sclose</code>, 506 <code>_fwalk</code>, <code>__sglue</code>, <code>__get_thread</code>, <code>__wait4</code>, 507 <code>__futex_wake</code>, <code>__open</code>, <code>__get_tls</code>, 508 <code>__getdents64</code>, and <code>dlmalloc</code>.</li> 509 <li>Removed the following functions from the 64-bit architectures: <code>basename_r</code>, 510 <code>dirname_r</code>, <code>__isthreaded</code>, <code>_flush_cache</code> (mips64).</li> 511 <li>Removed the following function from the 32-bit architectures: 512 <code>__signalfd4</code>.</li> 513 <li>Changed the type of the third argument from <code>size_t</code> to <code>int</code> in 514 the following functions: <code>strtoll_l</code>, <code>strtoull_l</code>, 515 <code>wcstoll_l</code>, and <code>wcstoull_l</code>.</li> 516 <li>Restored the following functions to the 64-bit architecture: <code>arc4random</code>, 517 <code>arc4random_buf</code>, and <code>arc4random_uniform</code>.</li> 518 <li>Moved <code>cxa_*</code> and the <code>new</code> and <code>delete</code> operators back 519 to <code>libstdc++.so</code>. This change restores r9d behavior; previous versions of r10 520 contained dummy files.</li> 521 522 </ul> 523 <li>Restored MXU support in GCC 4.8 and 4.9 for mips. This support had been absent from 524 r10 and r10b because those versions of GCC had been compiled with binutils-2.24, which did 525 not support MXU. It now does.</li> 526 <li>Fixed <code>--toolchain=</code> in <code>make-standalone-toolchain.sh</code> so that it 527 now properly supports use of a suffix specifying a version of Clang.</li> 528 <li>Fixed the libc++/armeabi <code>strtod()</code> functions.</li> 529 <li>Made fixes to NDK documentation in <code>docs/</code>.</li> 530 </ul> 531 </dd> 532 533 <dt>Other changes:</dt> 534 <dd> 535 <ul> 536 <li>Enhanced <code>cpu-features</code> to detect ARMv8 support for the following 537 instruction sets: AES, CRC32, SHA2, SHA1, and 64-bit PMULL/PMULL2. (Issue 538 <a href="https://android-review.googlesource.com/#/c/106360/">106360</a>)</li> 539 540 <li>Modified ndk-build to use <code>*-gcc-ar</code>, which is available in GCC 4.8, GCC 4.9, and 541 Clang. Clang specifies it, instead of <code>*-ar</code>. This setting brings improved LTO 542 support.</li> 543 544 <li>Removed the <code>include-fixed/linux/a.out.h</code> and 545 <code>include-fixed/linux/compiler.h</code> headers from the GCC compiler. 546 (Issue <a href ="http://b.android.com/73728">73728</a>)</li> 547 548 <li>Fixed an issue related to <code>-flto</code> with GCC 4.8 on Mac OS X. The error message 549 read:</li> 550 551 <pre> 552.../ld: error: .../libexec/gcc/arm-linux-androideabi/4.9/liblto_plugin.so 553Symbol not found: _environ 554</pre> 555 556 <li>Fixed a typo in <code>build-binary.mk.</code> (Issue 557 <a href="http://b.android.com/76992">76992</a>)</li> 558 </ul> 559 </dd> 560 561 <dt>Important known issues:</dt> 562 <dd> 563 <ul> 564 <li>Specifying -Os (<code>-fauto-profile</code>) in GCC4.9 may cause crashing. 565 (Issue <a href="http://b.android.com/77571">77571</a>)</li> 566 </ul> 567 </dd> 568 569 </dl> 570 </div> 571</div> 572 573 574 575 576 577<div class="toggle-content closed"> 578 <p> 579 <a href="#" onclick="return toggleContent(this)"> <img 580 src="/assets/images/triangle-closed.png" class="toggle-content-img" alt="" 581 >Android NDK, Revision 10b</a> <em>(September 2014)</em> 582 </p> 583 <div class="toggle-content-toggleme"> 584 <dl> 585 586 <dt>Important notes:</dt> 587 <dd> 588 <ul> 589 <li>Because of the 512MB size restriction on downloadable packages, the following 32-bit items are not in the 32-bit NDK download packages. Instead, they reside in the 64-bit ones:</li> 590 <ul> 591 <li>Android-L headers</li> 592 <li>GCC 4.9</li> 593 </ul> 594 <li>Currently, the only Renderscript support provided by the NDK is for 32-bit Renderscript with Android 4.4 (API level 19). You cannot build HelloComputeNDK (the only Renderscript sample) with any other combination of Renderscript (32- or 64-bit) and Android version.</li> 595 <li>To compile native-codec, you must use a 64-bit NDK package, which is where all the Android-L headers are located. </li> 596 </ul> 597 </dd> 598 599 600 <dt>Important bug fixes:</dt> 601 <dd> 602 <ul> 603 <li>Fixed gdb 7.6 in GCC 4.8/4.9. (Issues <a href="http://b.android.com/74112">74112</a> and <a href="http://b.android.com/74371">74371</a>.)</li> 604 <li>Fixed GCC 4.8/4.9 for x86, so that they no longer enable <code>-msse4.2</code> and <code>-mpopcnt</code> by default. (Issue <a href="http://b.android.com/73843">73843</a>.)</li> 605 </ul> 606 </dd> 607 608 <dt>Other bug fixes:</dt> 609 <dd> 610 <ul> 611 <li>Removed <code>stdio.h</code> from the <code>include-fixed/</code> directories of all versions of GCC. (Issue <a href="http://b.android.com/73728">73728</a>.)</li> 612 <li>Removed duplicate header files from the Windows packages in the <code>platforms/android-L/arch-*/usr/include/linux/netfilter*/</code> directories. (Issue <a href="https://code.google.com/p/android/issues/detail?id=73704">73704</a>.)</li> 613 <li>Fixed a problem that prevented Clang from building HelloComputeNDK.</li> 614 <li>Fixed atexit. (Issue <a href="http://b.android.com/66595">66595</a>.)</li> 615 <li>Made various fixes to the docs in <code>docs/</code> and <code>sources/third_party/googletest/README.NDK</code>. (Issue <a href="http://b.android.com/74069">74069</a>.)</li> 616 <li>Made the following fixes to the Android-L headers:</li> 617 <ol> 618 <li>Added the following functions to <code>ctype.h</code> and <code>wchar.h</code>: <code>dn_expand()</code>, <code>grantpt()</code>, <code> inet_nsap_addr()</code>, <code>inet_nsap_ntoa()</code>, <code>insque()</code>, <code>nsdispatch()</code>, <code>posix_openpt()</code>, <code>__pthread_cleanup_pop()</code>, <code>__pthread_cleanup_push()</code>, <code>remque()</code>, <code>setfsgid()</code>, <code>setfsuid()</code>, <code>splice()</code>, <code>tee()</code>, <code>twalk()</code> (Issue <a href = "http://b.android.com/73719">73719</a>), and 42 <code>*_l()</code> functions.</li> 619 620 <li>Renamed <code>cmsg_nxthdr</code> to <code>__cmsg_nxthdr</code>.</li> 621 622 <li>Removed <code>__libc_malloc_dispatch</code>.</li> 623 624 <li>Changed the <code>ptrace()</code> prototype to <code>long ptrace(int, ...);</code>.</li> 625 626 <li>Removed <code>sha1.h</code>.</li> 627 628 <li>Extended <code>android_dlextinfo</code> in <code>android/dlext.h</code>.</li> 629 630 <li>Annotated <code>__NDK_FPABI__</code> for functions receiving or returning float- or double-type values in <code>stdlib.h</code>, <code>time.h</code>, <code>wchar.h</code>, and <code>complex.h</code>.</li> 631 </ol> 632 </ul> 633 </dd> 634 635 <dt>Other changes:</dt> 636 <dd> 637 <ul> 638 <li>Updated <code>mipsel-linux-android-4.9</code> and <code>mips64el-linux-android-4.9</code>, implementing a new multilib directory layout, and providing support for gdb-7.7</li> 639 <li>Enhanced <code>cpu-features</code> to detect more arm64 features. (Change list <a href="https://android-review.googlesource.com/#/c/100339">100339</a>.)</li> 640 </dd> 641 </ul> 642 643 </dl> 644 </div> 645</div> 646 647<div class="toggle-content closed"> 648 <p> 649 <a href="#" onclick="return toggleContent(this)"> <img 650 src="/assets/images/triangle-closed.png" class="toggle-content-img" alt="" 651 >Android NDK, Revision 10</a> <em>(July 2014)</em> 652 </p> 653 <div class="toggle-content-toggleme"> 654 <dl> 655 <dt>Important changes:</dt> 656 <dd> 657 <ul> 658 <li>Added 3 new ABIs, all 64-bit: arm64-v8a, x86_64, mips64.</li> Note that: 659 <ul> 660 <li>GCC 4.9 is the default compiler for 64-bit ABIs. Clang is currently version 3.4. 661<code>NDK_TOOLCHAIN_VERSION=clang</code> 662 may not work for arm64-v8a and mips64.</li> 663 <li>Android-L is the first level with 64-bit support. Note that this API 664level is a temporary one, and only for L-preview. An actual API level number will replace it at 665L-release.</li> 666 <li>This release includes now includes <code>all32</code> and <code>all64</code> 667settings for <code>APP_ABI</code>. 668 <ul> 669 <li><code>APP_ABI=all32</code> is equivalent to 670<code>APP_ABI=armeabi,armeabi-v7a,x86,mips</code>.</li> 671 <li><code>APP_ABI=all64</code> is equivalent to 672<code>APP_ABI=arm64-v8a,x86_64,mips64</code>.</li> 673 <li><code>APP_ABI=all</code> selects all ABIs.</li> 674 </ul> 675 <li>The new GNU libstdc++ in Android-L contains all <code><tr1/cmath></code> 676Before defining your own math function, check <code>_GLIBCXX_USE_C99_MATH_TR1</code> to see a 677function with that name already exists, in order to avoid "multiple definition" errors from the 678linker.</li> 679 <li>The cpu-features library has been updated for the ARMv8 kernel. The existing 680cpu-features library may fail to detect the presence of NEON on the ARMv8 platform. Recompile your 681code with the new version.</li> 682 </ul> 683 <li>Added a new <code>platforms/android-L/</code> API directory. It includes:</li> 684 <ul> 685 <li>Updated Bionic headers, which had not changed from Android API levels 3 686(Cupcake) to 19 (KitKat). This new version, for level L, is to be synchronized with AOSP.</li> 687 <li>New media APIs and a native-codec sample.</li> 688 <li>An updated <code>Android.h</code> header for SLES/OpenSLES, enabling support for 689single-precision, floating-point audio format in AudioPlayer.</li> 690 <li>GLES 3.1 and AEP extensions to <code>libGLESv3.so.</code></li> 691 <li>GLES2 and GLES3 headers updated to the latest official Khronos versions.</li> 692 </ul> 693 <li>Added GCC 4.9 compilers to the 32-/64-bit ABIs. GCC 4.9 is the default (only) compiler 694for 64-bit ABIs, as previously mentioned. For 32-bit ABIs, you must explcitly enable GCC 4.9, as 695GCC 4.6 is still the default.</li> 696 <ul> 697 <li>For ndk-build, enable 32-bit, GCC 4.9 building either by adding 698<code>NDK_TOOLCHAIN_VERSION=4.9</code> to <code>Application.mk</code>, or exporting it as an 699environment variable from the command line.</li> 700 <li>For a standalone toolchain, use the <code>--toolchain=</code> option in the 701<code>make-standalone-toolchain.sh</code> script. For example: <code>--toolchain=arm-linux-androideabi-4.9.</code></li> 702 </ul> 703 <li>Upgraded GDB to version 7.6 in GCC 4.8/4.9 and x86*. Since GDB is still at version GDB-7.3.x in 704GCC 4.6 (the default for ARM and MIPS), you must set 705<code>NDK_TOOLCHAIN_VERSION=4.8</code> or <code>4.9</code> to enable ndk-gdb to select GDB 7.6.</li> 706 <li>Added the <code>-mssse3</code> build option to provide SSSE3 support, and made it the default for ABI x86 707(upgrading from SSE3). The image released by Google does not contain SSSE3 instructions.</li> 708 <li>Updated GCC 4.8 to 4.8.3.</li> 709 <li>Improved ARM libc++ EH support by switching from gabi++ to libc++abi. For details, see the "C++ Support" section of the documentation. 710 Note that:</li> 711 <ul> 712 <li>All tests except for locale now pass for Clang 3.4 and GCC 4.8. For more 713information, see the "C++ Support" section of the documentation.</li> 714 <li>The libc++ libraries for X86 and MIPS libc++ still use gabi++.</li> 715 <li>GCC 4.7 and later can now use <atomic>.</li> 716 <li>You must add <code>-fno-strict-aliasing</code> if you use <code> <list></code>, because <code>__list_imp::_end</code>_ breaks 717 TBAA rules. (Issue <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61571">61571</a>.)</li> 718 <li>As of GCC 4.6, LIBCXX_FORCE_REBUILD:=true no longer rebuilds libc++. Rebuilding it 719requires the use of a different compiler. Note that Clang 3.3 is untested.</li> 720 </ul> 721 <li>mclinker is now version 2.7, and has aarch64 Linux support.</li> 722 <li>Added precompiled header support for headers specified by <code>LOCAL_PCH</code>. (Issue <a href="http://b.android.com/25412">25412</a>).</li> 723 </dd> 724 <dl> 725 726 727 <dt>Important bug fixes:</dt> 728 <dd> 729 <ul> 730 <li>Fixed libc++ so that it now compiles <code>std::feof</code>, etc. (Issue <a 731href="http://b.android.com/66668">66668</a>).</li> 732 <li>Fixed a Clang 3.3/3.4 atomic library call that caused crashes in some of the libc++ 733tests for ABI armeabi.</li> 734 <li>Fixed Clang 3.4 crashes that were occurring on reading precompiled headers. (Issue <a 735href="http://b.android.com/66657">66657</a>).</li> 736 <li>Fixed the Clang 3.3/3.4 <code>-O3</code> assert on:</li> 737 <code>llvm-3.2/llvm/include/llvm/MDBuilder.h:64: llvm::MDNode* 738llvm::MDBuilder::createBranchWeights(llvm::ArrayRef<unsigned int>): Assertion Weights.size() >= 2 739&& "Need at least two branch weights!"</code> (Issue <a href="http://b.android.com/57381">57381</a>). 740 <li>Fixed the following Clang 3.3/3.4 crash:</li> 741 <code>Assertion failed: (!Fn && "cast failed but able to resolve overload expression!!"), function CheckCXXCStyleCast, file 742Volumes/data/ndk-toolchain/src/llvm-3.3/llvm/tools/clang/lib/Sema/SemaCast.cpp, line 2018</code>. 743(Issue <a href="http://b.android.com/66950">66950</a>). 744 </ul> 745 </dd> 746 747 <dt>Other bug fixes:</dt> 748 <dd> 749 <ul> 750 <li>Fixed headers:</li> 751 <ul> 752 <li>Fixed 32-bit <code>ssize_t</code> to be <code>int</code> instead of <code>long 753int</code>.</li> 754 <li>Fixed <code>WCHAR_MIN</code> and <code>WCHAR_MAX</code> so that they they take 755appropriate signs according to the architecture they're running on:</li> 756 <ul> 757 <li>X86/MIPS: signed. 758 <li>ARM: unsigned. 759 <li>To force X86/MIPS to default to unsigned, use 760<code>-D__WCHAR_UNSIGNED__</code>.</li> 761 <li>To force <code>wchar_t</code> to be 16 bits, use <code>-fshort-wchar</code>.</li> 762 </ul> 763 <li>Removed non-existent symbols from 32-bit <code>libc.so</code>, and added <code>pread64</code>, 764<code>pwrite64</code>, <code>ftruncate64</code> for 765Android API level 12 and higher. (Issue <a href="http://b.android.com/69319">69319</a>). For more 766information, see the commit message accompanying AOSP change list 767 <a href="https://android-review.googlesource.com/#/c/94137">94137</a>.</li> 768 </ul> 769 <li>Fixed GCC warning about redefinition of <code>putchar</code>. Warning message reads:</li> 770 <code>include/stdio.h:236:5: warning: conflicts with previous declaration here 771[-Wattributes] int putchar(int);</code> (Change list <a 772href="https://android-review.googlesource.com/#/c/91185">91185</a>). 773 <li>Fixed <code>make-standalone-toolchain.sh --stl=libc++</code> so that it:</li> 774 <ul> 775 <li>Copies <code>cxxabi.h</code>. (Issue <a 776href="http://b.android.com/68001">68001</a>).</li> 777 <li>Runs in directories other than the NDK install directory. (Issues <a 778href="http://b.android.com/67690">67690</a> and <a href="http://b.android.com/68647">68647</a>).</li> 779 </ul> 780 <li>Fixed GCC/Windows to quote arguments only when necessary for spawning processes in 781external programs. This change decreases the likelihood of exceeding the 32K length limit.</li> 782 <li>Fixed an issue that made it impossible to adjust the <code>APP_PLATFORM</code> 783environment variable.</li> 784 <li>Fixed the implementation of <code>IsSystemLibrary()</code> in crazy_linker so that it 785uses <code>strrchr()</code> 786 instead of <code>strchr()</code> to find the library path's true basename.</li> 787 <li>Fixed native-audio's inability to build in debug mode.</li> 788 <li>Fixed gdb's inability to print extreme floating-point numbers. (Issue <a 789href="http://b.android.com/69203">69203</a>).</li> 790 <li>Fixed Clang 3.4 inability to compile with <code>-Wl,-shared</code> (as opposed to 791<code>-shared</code>, which 792 had no compilation issues). The problem was that Clang added <code>-pie</code> for Android 793targets if neither <code>-shared</code> nor <code>-static</code> existed. This behavior, which was 794incorrect, caused the linker to complain that <code>-shared</code> and <code>-pie</code> could not 795co-exist.</li> 796 797 </ul> 798 </dd> 799 800 801 <dt>Other changes:</dt> 802 <dd> 803 <ul> 804 <li>Added <code>arm_neon.h</code> to the x86 toolchain so that it now emulates ~47% of 805Neon. There is currently no support for 64-bit types. For more information, see the section on ARM 806Neon intrinsics support in the x86 documentation.</li> 807 <li>Ported ARM/GOT_PREL optimization (present in GCC 4.6 built from the GCC google branch) to 808ARM GCC 4.8/4.9. This optimization sometimes reduces instruction count when accessing global 809variables. As an example, see the build.sh script in 810<code>$NDK/tests/build/b14811006-GOT_PREL-optimization/</code>.</li> 811 <li>Added ARM version for STL gabi++, stlport, and libc++. They now have both it and Thumb 812mode.</li> 813 <li>It is now possible to call the make-standalone-toolchain.sh script with 814<code>--toolchain=x86_64-linux-android-4.9</code>, which is equivalent to 815<code>--toolchain=x86_64-4.9</code>.</li> 816 </dd> 817 </ul> 818 </dl> 819 </div> 820</div> 821 822 823<div class="toggle-content closed"> 824 <p> 825 <a href="#" onclick="return toggleContent(this)"> <img 826 src="/assets/images/triangle-closed.png" class="toggle-content-img" alt="" 827 >Android NDK, Revision 9d</a> <em>(March 2014)</em> 828 </p> 829 <div class="toggle-content-toggleme"> 830 <dl> 831 <dt>Important changes:</dt> 832 <dd> 833 <ul> 834 <li>Added support for the Clang 3.4 compiler. The 835<code>NDK_TOOLCHAIN_VERSION=clang</code> option now picks Clang 3.4. GCC 4.6 is 836still the default compiler.</li> 837 <li>Added <code>APP_ABI=armeabi-v7a-hard</code>, with 838additional multilib option <code>-mfloat-abi=hard</code>. These options are for 839use with ARM GCC 4.6/4.8 and Clang 3.3/3.4 (which use 4.8's assembler, linker, 840and libs). When using these options, note the following changes:</li> 841 <ul> 842 <li> When executing the <code>ndk-build</code> script, add the 843following options for armeabi-v7a target: 844<pre>TARGET_CFLAGS += -mhard-float -D_NDK_MATH_NO_SOFTFP=1 845TARGET_LDFLAGS += -Wl,--no-warn-mismatch -lm_hard</pre> 846The built library is copied to <code>libs/armeabi-v7a</code>. For make to 847behave as expected, you cannot specify both <code>armeabi-v7a</code> and 848<code>armeabi-v7a-hard</code> as make targets (i.e., on the APP_ABI= line). 849Doing so causes one of them to be ignored. Note that <code>APP_ABI=all</code> 850is still equivalent to 851<code>armeabi armeabi-v7a x86 mips</code>.</li> 852 <li>The <code>make-standalone-toolchain.sh</code> script copies 853additional libaries under <code>/hard</code> directories. 854 Add the above <code>CFLAGS</code> and <code>LFLAGS</code> to your 855makefile to enable GCC or Clang to link with 856 libraries in <code>/hard</code>.</li> 857 </ul> 858 <li>Added the yasm assembler, as well as <code>LOCAL_ASMFLAGS</code> 859and <code>EXPORT_ASMFLAGS</code> flags for x86 860targets. The <code>ndk-build</code> script uses 861<code>prebuilts/*/bin/yasm*</code> to build <code>LOCAL_SRC_FILES</code> that 862have the <code>.asm</code> extension.</li> 863 <li>Updated MClinker to 2.6.0, which adds <code>-gc-sections</code> 864support.</li> 865 <li>Added experimental libc++ support (upstream r201101). Use this new 866feature by following these steps: 867 <ul> 868 <li>Add <code>APP_STL := c++_static</code> or <code>APP_STL := 869c++_shared</code> in <code>Application.mk</code>. 870 You may rebuild from source via <code>LIBCXX_FORCE_REBUILD := 871true</code></li> 872 <li>Execute <code>make-standalone-toolchain.sh --stl=libc++</code> 873to create a standalone toolchain with libc++ headers/lib.</li> 874 </ul> 875 For more information, see 876<code>CPLUSPLUS-SUPPORT.html</code>. 877(Issue <a href="http://b.android.com/36496">36496</a>)</li> 878 </ul> 879 </dd> 880 <dl> 881 <dt>Important bug fixes:</dt> 882 <dd> 883 <ul> 884 <li>Fixed an uncaught throw from an unexpected 885exception handler for GCC 4.6/4.8 ARM EABI. (GCC Issue <a 886href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59392">59392</a>)</li> 887 <li>Fixed GCC 4.8 so that it now correctly resolves partial 888specialization of a template with 889 a dependent, non-type template argument. (GCC Issue <a 890href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59052">59052</a>)</li> 891 <li>Added more modules to prebuilt python (Issue <a 892href="http://b.android.com/59902">59902</a>): 893 <ul> 894 <li>Mac OS X: <code>zlib</code>, <code>bz2</code>, 895<code>_curses</code>, <code>_curses_panel</code>, <code>_hashlib</code>, 896<code>_ssl</code></li> 897 <li>Linux: <code>zlib</code>, <code>nis</code>, 898<code>crypt</code>, <code>_curses</code>, and <code>_curses_panel</code></li> 899 </ul> 900 <li>Fixed the x86 and MIPS gdbserver 901<code>event_getmsg_helper</code>.</li> 902 <li>Fixed numerous issues in the RenderScript NDK toolchain, including 903issues with compatibility across older devices and C++ reflection.</li> 904<br> 905 </ul> 906 </dd> 907 908 <dt>Other bug fixes:</dt> 909 <dd> 910 <ul> 911 <li>Header fixes: 912 <ul> 913 <li>Fixed a missing <code>#include <sys/types.h></code> in 914<code>android/asset_manager.h</code> for Android API level 13 and higher. 915 (Issue <a href="http://b.android.com/64988">64988</a>)</li> 916 <li>Fixed a missing <code>#include <stdint.h></code> in 917<code>android/rect_manager.h</code> for Android API level 14 and higher.</li> 918 <li>Added <code>JNICALL</code> to <code>JNI_OnLoad</code> and 919<code>JNI_OnUnload</code> in <code>jni.h</code>. Note that <code>JNICALL</code> 920 is defined as <code>__NDK_FPABI__</code> For more information, see 921<code>sys/cdefs.h</code>.</li> 922 <li>Updated the following headers so that they can be included 923without the need to 924manually include their dependencies (Issue <a 925href="http://b.android.com/64679">64679</a>):</li> 926<pre> 927android/tts.h 928EGL/eglext.h 929fts.h 930GLES/glext.h 931GLES2/gl2ext.h 932OMXAL/OpenMAXSL_Android.h 933SLES/OpenSLES_Android.h 934sys/prctl.h 935sys/utime.h 936</pre> 937 <li>Added <code>sys/cachectl.h</code> for all architectures. MIPS 938developers can now include this header instead of writing <code>#ifdef 939__mips__</code>.</li> 940 <li></code>Fixed <code>platforms/android-18/include/android/input.h 941</code> by adding <code>__NDK_FPABI__</code> to functions taking or returning 942float or double values.</li> 943 <li>Fixed MIPS <code>struct stat</code>, which was incorrectly set 944to its 64-bit counterpart for Android API level 12 and later. This wrong 945setting was a 946regression introduced in release r9c.</li> 947 <li>Defined <code>__PTHREAD_MUTEX_INIT_VALUE</code>, 948<code>__PTHREAD_RECURSIVE_MUTEX_INIT_VALUE</code>, 949 and <code>__PTHREAD_ERRORCHECK_MUTEX_INIT_VALUE</code> for Android API 950level 9 and lower.</li> 951 <li>Added <code>scalbln</code>, <code>scalblnf</code>, and 952<code>scalblnl</code> to x86 <code>libm.so</code> for APIs 18 and later.</li> 953 <li>Fixed a typo in 954<code>sources/android/support/include/iconv.h</code>. 955 (Issue <a href="http://b.android.com/63806">63806</a>)</li> 956 957 </ul> 958 </li> 959 <li>Fixed gabi++ <code>std::unexpected()</code> to call 960<code>std::terminate()</code> so that 961 a user-defined <code>std::terminate()</code> handler has a chance to run. 962</li> 963 <li>Fixed gabi++ to catch <code>std::nullptr</code>.</li> 964 <li>Fixed samples Teapot and MoreTeapots: 965 <ul> 966 <li>Solved a problem with Tegra 2 and 3 chips by changing specular 967variables to use medium precision. Values for specular power can now be less 968than 1.0. </li> 969 <li>Changed the samples so that pressing the volume button restores 970immersive mode and invalidates 971<code>SYSTEM_UI_FLAG_IMMERSIVE_STICKY</code>. Screen rotation does not 972trigger <code>onSystemUiVisibilityChange</code>, and so does not restore 973immersive mode.</li> 974 </ul> 975 </li> 976 <li>Fixed the <code>ndk-build</code> script to add 977<code>-rpath-link=$SYSROOT/usr/lib</code> and 978<code>-rpath-link=$TARGET_OUT</code> in order to use <code>ld.bfd</code> to 979link executables. (Issue <a href="http://b.android.com/64266">64266</a>)</li> 980 <li>Removed <code>-Bsymbolic</code> from all STL builds.</li> 981 <li>Fixed <code>ndk-gdb-py.cmd</code> by setting <code>SHELL</code> as 982an environment variable 983instead of passing it to 984 <code>python.exe</code>, which ignores the setting. 985 (Issue <a href="http://b.android.com/63054">63054</a>)</li> 986 <li>Fixed the <code>make-standalone-toolchain.sh</code> script so that 987the <code>--stl=stlport</code> option copies the gabi++ headers instead of 988symlinking them; the <code>cmd.exe</code> and MinGW shells do not understand 989symlinks created by cygwin.</li> 990 </ul> 991 </dd> 992 993 <dt>Other changes:</dt> 994 <dd> 995 <ul> 996 <li>Applied execution permissions to all <code>*cmd</code> scripts 997previously intended for use only in the <code>cmd.exe</code> shell, in case 998developers prefer to use <code>ndk-build.cmd</code> in cygwin instead of the 999recommended <code>ndk-build</code> script.</li> 1000 <li>Improved the speed of the <code>make-standalone-toolchain.sh</code> 1001script by moving instead of copying if the specified destination directory does 1002not exist.</li> 1003 </dd> 1004 </ul> 1005 </dl> 1006 </div> 1007</div> 1008 1009<div class="toggle-content closed"> 1010 <p> 1011 <a href="#" onclick="return toggleContent(this)"> <img 1012 src="/assets/images/triangle-closed.png" class="toggle-content-img" alt="" 1013 >Android NDK, Revision 9c</a> <em>(December 2013)</em> 1014 </p> 1015 <div class="toggle-content-toggleme"> 1016<p>This is a bug-fix-only release.</p> 1017 <dl> 1018 <dt>Important bug fixes:</dt> 1019 <dd> 1020 <ul> 1021 <li>Fixed a problem with GCC 4.8 ARM, in which the stack pointer is 1022restored too early. This problem prevented the frame pointer from reliably 1023accessing a variable in the stack frame. (GCC Issue <a 1024href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854">58854</a>)</li> 1025<li>Fixed a problem with GCC 4.8 libstdc++, in which a bug in 1026std::nth_element was causing generation of code that produced a random 1027segfault. (Issue <a 1028href="https://code.google.com/p/android/issues/detail?id=62910">62910</a>)</li> 1029 <li>Fixed GCC 4.8 ICE in cc1/cc1plus with 1030<code>-fuse-ld=mcld</code>, so that the following error no longer occurs: 1031<pre>cc1: internal compiler error: in common_handle_option, at 1032opts.c:1774</pre></li> 1033 <li>Fixed <code>-mhard-float</code> support for 1034<code>__builtin</code> math functions. For ongoing information on fixes for 1035<code>-mhard-float</code> with STL, please follow Issue <a 1036href="http://b.android.com/61784">61784</a>.</li> 1037 </ul> 1038 </dd> 1039 1040 <dt>Other bug fixes:</dt> 1041 <dd> 1042 <ul> 1043 <li>Header fixes: 1044 <ul> 1045 <li>Changed prototype of <code>poll</code> to <code>poll(struct 1046pollfd *, nfds_t, int);</code> in <code>poll.h</code>.</li> 1047 <li>Added <code>utimensat</code> to <code>libc.so</code> for Android 1048API levels 12 and 19. These libraries are now included for all Android API 1049levels 12 through 19.</li> 1050<li>Introduced <code>futimens</code> into <code>libc.so</code>, for Android API 1051level 19.</li> 1052<li>Added missing <code>clock_settime()</code> and 1053<code>clock_nanosleep()</code> to <code>time.h</code> for Android API level 8 1054and higher.</li> 1055<li>Added <code>CLOCK_MONOTONIC_RAW, CLOCK_REALTIME_COARSE, 1056CLOCK_MONOTONIC_COARSE, CLOCK_BOOTTIME, CLOCK_REALTIME_ALARM,</code> and 1057<code>CLOCK_BOOTTIME_ALARM</code> in <code>time.h.</code></li> 1058<li>Removed obsolete <code>CLOCK_REALTIME_HR</code> and 1059<code>CLOCK_MONOTONIC_HR.</code></li> 1060 </ul> 1061 </li> 1062 <li>In samples Teapot, MoreTeapots, and 1063<code>source/android/ndk_helper</code>: 1064 <ul> 1065<li>Changed them so that they now use a hard-float abi for armeabi-v7a.</li> 1066<li>Updated them to use immersive mode on Android API level 19 and 1067higher.</li> 1068<li>Fixed a problem with <code>Check_ReleaseStringUTFChars</code> in 1069<code>/system/lib/libdvm.so</code> that was causing crashes on x86 devices.</li> 1070 </ul> 1071 </li> 1072<li>Fixed <code>ndk-build</code> fails that happen in cygwin when the NDK 1073package is 1074referenced via symlink.</li> 1075<li>Fixed <code>ndk-build.cmd</code> fails that happen in windows 1076<code>cmd.exe</code> when 1077<code>LOCAL_SRC_FILES</code> contains absolute paths. (Issue <a 1078href="https://android-review.googlesource.com/#/c/69992">69992</a>)</li> 1079<li>Fixed the <code>ndk-stack</code> script to proceed even when it can't parse 1080a frame due to inability to find a routine, filename, or line number. In any of 1081these cases, it prints <code>??</code>.</li> 1082<li>Fixed the <code>ndk-stack</code> stack for windows-x64_64 targets so that 1083it no longer erroneously matches a frame line with a line in the 1084<code>stack:</code> section that doesn't contain <code>pc</code>, 1085<code>eip</code>, or <code>ip</code>. For example: 1086<pre>I/DEBUG ( 1151): #00 5f09db68 401f01c4 1087/system/lib/libc.so</pre></li> 1088<li>Fixed gabi++ so that it: 1089 <ul> 1090 <li>Does not use malloc() to allocate C++ thread-local 1091 objects.</li> 1092 <li>Avoids deadlocks in gabi++ in cases where libc.debug.malloc is 1093non-zero in userdebug/eng Android platform builds.</li> 1094 </ul> 1095 </ul> 1096 </dd> 1097 1098 <dt>Other changes:</dt> 1099 <dd> 1100 <ul> 1101 <li>Added <code>LOCAL_EXPORT_LDFLAGS</code>.</li> 1102<li>Introduced the <code>NDK_PROJECT_PATH=null</code> setting for use in an 1103integrated build system where options are explicitly passed to 1104<code>ndk-build</code>. With this setting, <code>ndk-build</code> makes no 1105attempt to look for <code>NDK_PROJECT_PATH.</code> This setting also prevents 1106variables from deriving default settings from NDK_PROJECT_PATH. As a result, 1107the following variables must now be explicitly specified (with their default 1108values if such exist): <code>NDK_OUT, NDK_LIBS_OUT, APP_BUILD_SCRIPT, 1109NDK_DEBUG</code> (optional, default to 0), and other <code>APP_*</code>'s 1110contained in <code>Application.mk</code>.</li> 1111<li><code>APP_ABI</code> can now be enumerated in a comma-delimited list. For 1112example: 1113<pre>APP_ABI := "armeabi,armeabi-v7a"</pre></li> 1114<li>Provided the ability to rebuild all of STL with debugging info in an 1115optional, separate package called 1116<code>android-ndk-r9c-cxx-stl-libs-with-debugging-info.zip</code>, using the 1117<code>-g</code> option. This option 1118helps the <code>ndk-stack</code> script provide better a stack dump across STL. 1119This change should not affect the code/size of the final, stripped file.</li> 1120<li>Enhanced <code>hello-jni</code> samples to report <code>APP_ABI</code> at 1121compilation.</li> 1122<li>Used the <code>ar</code> tool in Deterministic mode (option 1123<code>-D</code>) to build static libraries. (Issue <a 1124href="http://b.android.com/60705">60705</a>)</li> 1125 </ul> 1126 </dd> 1127 1128 </dl> 1129 </div> 1130</div> 1131 1132<div class="toggle-content closed"> 1133 <p> 1134 <a href="#" onclick="return toggleContent(this)"> <img 1135 src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" alt="" 1136 >Android NDK, Revision 9b</a> <em>(October 2013)</em> 1137 </p> 1138 <div class="toggle-content-toggleme"> 1139 <dl> 1140 <dt>Important changes:</dt> 1141 <dd> 1142 <ul> 1143 <li>Updated {@code include/android/*h} and {@code math.h} for all Android API levels up to 1144 18, including the addition of levels 13, 15, 16 and 17. 1145 For information on added APIs, see commit messages for Changes 1146 <a href="https://android-review.googlesource.com/68012">68012</a> and 1147 <a href="https://android-review.googlesource.com/68014">68014</a>. 1148 (Issues <a href="http://b.android.com/47150">47150</a>, 1149 <a href="http://b.android.com/58528">58528</a>, and 1150 <a href="http://b.android.com/38423">38423</a>)</li> 1151 <li>Added support for Android API level 19, including Renderscript binding.</li> 1152 <li>Added support for <code>-mhard-float</code> in the existing armeabi-v7a ABI. For more 1153 information and current restrictions on Clang, see 1154 {@code tests/device/hard-float/jni/Android.mk}.</li> 1155 <li>Migrated from GNU Compiler Collection (GCC) 4.8 to 4.8.2, and added diagnostic color 1156 support. To enable diagnostic colors, set <code>-fdiagnostics-color=auto</code>, 1157 <code>-fdiagnostics-color=always,</code> or export {@code GCC_COLORS} as shown below: 1158<pre> 1159GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' 1160</pre> 1161 For more information, see 1162 <a href="http://gcc.gnu.org/onlinedocs/gcc/Language-Independent-Options.html">GCC 1163 Language Independent Options</a>. 1164 </li> 1165 <li>Added two new samples to demonstrate OpenGL ES 3.0 features: Teapot and MoreTeapots. 1166 These samples run on devices with Android 4.1 (API level 16) and higher.</li> 1167 <li>Deprecated GCC 4.7 and Clang 3.2 support, which will be removed in the next 1168 release.</li> 1169 </ul> 1170 </dd> 1171 1172 <dt>Important bug fixes:</dt> 1173 <dd> 1174 <ul> 1175 <li>Fixed problem with ARM GCC 4.6 {@code thumb2} failing to generate 16-bit relative jump 1176 tables. (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48328">GCC Issue</a>)</li> 1177 <li>Fixed GCC 4.8 internal compiler error (ICE) on 1178 {@code g++.dg/cpp0x/lambda/lambda-defarg3.C}. 1179 (<a href="https://android-review.googlesource.com/62770">Change 62770</a>, 1180 <a href="http://gcc.gnu.org/ml/gcc/2013-07/msg00424.html">GCC Issue</a>)</li> 1181 <li>Fixed a problem with Windows 32-bit {@code *-gdb.exe} executables failing to launch. 1182 (<a href="http://b.android.com/58975">Issue 58975</a>)</li> 1183 <li>Fixed GCC 4.8 ICE when building bullet library. The error message is as follows: 1184 <pre>internal compiler error: verify_flow_info failed</pre> 1185 (<a href="http://b.android.com/58916">Issue 58916</a>, 1186 <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58165">GCC Issue</a>)</li> 1187 <li>Modified GDB/ARM build to skip {@code ARM.exidx} data for unwinding in prologue code and 1188 added a command ({@code set arm exidx-unwinding}) to control exidx-based stack unwinding. 1189 (<a href="http://b.android.com/55826">Issue 55826</a>)</li> 1190 <li>Fixed Clang 3.3 MIPS compiler problem where HI and LO registers are incorrectly 1191 reused.</li> 1192 <li>Fixed issue with MIPS 4.7 ICE in {@code dbx_reg_number}. The error message is as 1193follows: 1194<pre> 1195external/icu4c/i18n/decimfmt.cpp:1322:1: 1196internal compiler error: in dbx_reg_number, at dwarf2out.c:10185 1197</pre> 1198 (<a href="http://gcc.gnu.org/ml/gcc-patches/2012-12/msg00830.html">GCC Patch</a>) 1199 1200 </li> 1201 1202 </ul> 1203 </dd> 1204 1205 <dt>Other bug fixes:</dt> 1206 <dd> 1207 <ul> 1208 <li>Header fixes 1209 <ul> 1210 <li>Fixed the ARM {@code WCHAR_MIN} and {@code WCHAR_MAX} to be unsigned according to 1211 spec (the X86/MIPS versions are signed). Define {@code _WCHAR_IS_ALWAYS_SIGNED} to 1212 restore old behavior. (<a href="http://b.android.com/57749">Issue 57749</a>)</li> 1213 <li>Fixed {@code include/netinet/tcp.h} to contain {@code TCP_INFO} state enum. 1214 (<a href="http://b.android.com/38881">Issue 38881</a>)</li> 1215 <li>Fixed the {@code cdefs_elh.h} macro {@code _C_LABEL_STRING} to stop generating 1216 warnings in the GCC 4.8 toolchain when using c++11 mode. 1217 (<a href="http://b.android.com/58135">Issue 58135</a>, 1218 <a href="http://b.android.com/58652">Issue 58652</a>)</li> 1219 <li>Removed non-existent functions {@code imaxabs} and {@code imaxdiv} from header 1220 {@code inttypes.h}.</li> 1221 <li>Fixed issue with {@code pthread_exit()} return values and {@code pthread_self()}. 1222 (<a href="http://b.android.com/60686">Issue 60686</a>)</li> 1223 <li>Added missing {@code mkdtemp()} function, which already exists in {@code bionic} 1224 header {@code stdlib.h}.</li> 1225 </ul> 1226 </li> 1227 <li>Fixed problem building {@code samples/gles3jni} with Clang on Android API level 11.</li> 1228 <li>Fixed MCLinker to allow multiple occurrences of the following options: 1229 {@code -gc-sections} and {@code --eh-frame-hdr}.</li> 1230 <li>Fixed MCLinker to accept the {@code --no-warn-mismatch} option.</li> 1231 <li>Modified {@code cpu-features} option to not assume all VFPv4 devices support IDIV. 1232 Now this option only adds IDIV to white-listed devices, including Nexus 4. 1233 (<a href="http://b.android.com/57637">Issue 57637</a>)</li> 1234 <li>Fixed problem with {@code android_native_app_glue.c} erroneously logging errors on event 1235 predispatch operations.</li> 1236 <li>Fixed all operations on {@code gabi++} terminate and unexpected_handler to be 1237 thread-safe.</li> 1238 <li>Fixed several issues with Clang <code>-integrated-as</code> option so it can pass 1239 tests for {@code ssax-instructions} and {@code fenv}.</li> 1240 <li>Fixed GCC 4.6/4.7/4.8 compiler to pass the linker option {@code --eh-frame-hdr} even 1241 for static executables. For more information, see the 1242 <a href="http://gcc.gnu.org/ml/gcc-patches/2012-09/msg00969.html">GCC patch</a>.</li> 1243 <li>Fixed extra apostrophe in <code>CPU-ARCH-ABIS.html</code>. For more information, see 1244 <code>NDK-DEPENDS.html</code>. (<a href="http://b.android.com/60142">Issue 60142</a>)</li> 1245 <li>Fixed extra quotes in ndk-build output on Windows. 1246 (<a href="http://b.android.com/60649">Issue 60649</a>)</li> 1247 <li>Fixed Clang 3.3 to compile ARM's built-in, atomic operations such as 1248 {@code __atomic_fetch_add}, {@code __atomic_fetch_sub}, and {@code __atomic_fetch_or}. 1249 </li> 1250 <li>Fixed Clang 3.3 ICE with customized {@code vfprintf}. 1251 (<a href="http://llvm.org/bugs/show_bug.cgi?id=16344">Clang issue</a>) 1252 </li> 1253 </ul> 1254 </dd> 1255 1256 <dt>Other changes:</dt> 1257 <dd> 1258 <ul> 1259 <li>Enabled OpenMP for all GCC builds. To use this feature, add the following flags to your 1260 build settings: 1261<pre> 1262LOCAL_CFLAGS += -fopenmp 1263LOCAL_LDFLAGS += -fopenmp 1264</pre> 1265 For code examples, see {@code tests/device/test-openmp}</li> 1266 <li>Reduced the size of {@code ld.mcld} significantly (1.5MB vs. {@code ld.bfd} 3.5MB and 1267 {@code ld.gold} 7.5MB), resulting in a speed improvement of approximately 20%.</li> 1268 <li>Added <code>LOCAL_CONLYFLAGS</code> and <code>APP_CONLYFLAGS</code> to specify 1269 options applicable to C only but not C++. The existing <code>LOCAL_CFLAGS</code> 1270 and <code>APP_CFLAGS</code> are also used for C++ compilation (to save trouble of 1271 specifying most options twice), so options such as <code>-std=gnu99</code> may fail in 1272 g++ builds with a warning and clang++ builds with an error.</li> 1273 <li>Added {@code gabi++} array helper functions.</li> 1274 <li>Modified GCC builds so that all {@code libgcc.a} files are built with 1275 <code>-funwind-tables</code> to allow the stack to be unwound past previously blocked 1276 points, such as <code>__aeabi_idiv0</code>.</li> 1277 <li>Added Ingenic MXU support in MIPS GCC4.6/4.7/4.8 with new <code>-mmxu</code> 1278option.</li> 1279 <li>Extended MIPS GCC4.6/4.7/4.8 <code>-mldc1-sdc1</code> to control ldxc1/sdxc1 too</li> 1280 <li>Added crazy linker. For more information, see 1281 {@code sources/android/crazy_linker/README.TXT}.</li> 1282 <li>Fixed {@code bitmap-plasma} to draw to full screen rather than a 200x200 pixel 1283area.</li> 1284 <li>Reduced linux and darwin toolchain sizes by 25% by creating symlinks to identical files. 1285 </li> 1286 </ul> 1287 </dd> 1288 1289 </dl> 1290 </div> 1291</div> 1292 1293 1294<div class="toggle-content closed"> 1295 <p> 1296 <a href="#" onclick="return toggleContent(this)"> <img 1297 src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" alt="" 1298 >Android NDK, Revision 9</a> <em>(July 2013)</em> 1299 </p> 1300 <div class="toggle-content-toggleme"> 1301 <dl> 1302 <dt>Important changes:</dt> 1303 <dd> 1304 <ul> 1305 <li>Added support for Android 4.3 (API level 18). For more information, see 1306 {@code STABLE-APIS.html} and new code examples in {@code samples/gles3jni/README}. 1307 <li>Added headers and libraries for OpenGL ES 3.0, which is supported by Android 4.3 1308 (API level 18) and higher.</li> 1309 <li>Added GNU Compiler Collection (GCC) 4.8 compiler to the NDK. Since GCC 4.6 is still 1310 the default, you must explicitly enable this option: 1311 <ul> 1312 <li>For {@code ndk-build} builds, export {@code NDK_TOOLCHAIN_VERSION=4.8} or 1313 add it in {@code Application.mk}.</li> 1314 <li>For standalone builds, use the {@code --toolchain=} option in 1315 {@code make-standalone-toolchain.sh}, for example:<br> 1316 {@code --toolchain=arm-linux-androideabi-4.8}</li> 1317 </ul> 1318 <p class="note"><strong>Note:</strong> 1319 The {@code -Wunused-local-typedefs} option is enabled by {@code -Wall}. Be 1320 sure to add {@code __attribute__((unused))} if you use compile-time asserts like 1321 {@code sources/cxx-stl/stlport/stlport/stl/config/features.h}, line #311. For more 1322 information, see 1323 <a href="https://android-review.googlesource.com/#/c/55460">Change 55460</a></p> 1324 <p class="note"><strong>Note:</strong> 1325 In the GCC 4.7 release and later, ARM compilers generate unaligned access code by 1326 default for ARMv6 and higher build targets. You may need to add the 1327 {@code -mno-unaligned-access} build option when building for kernels that do not support 1328 this feature.</p> 1329 </li> 1330 <li>Added Clang 3.3 support. The {@code NDK_TOOLCHAIN_VERSION=clang} build option 1331 now picks Clang 3.3 by default. 1332 <p class="note"><strong>Note:</strong> 1333 Both GCC 4.4.3 and Clang 3.1 are deprecated, and will be removed from the next NDK 1334 release.</p></li> 1335 <li>Updated GNU Project Debugger (GDB) to support python 2.7.5.</li> 1336 <li>Added MCLinker to support Windows hosts. Since {@code ld.gold} 1337 is the default where available, you must add {@code -fuse-ld=mcld} in 1338 {@code LOCAL_LDFLAGS} or {@code APP_LDFLAGS} to enable MCLinker.</li> 1339 <li>Added {@code ndk-depends} tool which prints ELF library dependencies. 1340 For more information, see {@code NDK-DEPENDS.html}. 1341 (<a href="http://b.android.com/53486">Issue 53486</a>)</li> 1342 </ul> 1343 </dd> 1344 1345 <dt>Important bug fixes:</dt> 1346 <dd> 1347 <ul> 1348 <li>Fixed potential event handling issue in {@code android_native_app_glue}. 1349 (<a href="http://b.android.com/41755">Issue 41755</a>)</li> 1350 <li>Fixed ARM/GCC-4.7 build to generate sufficient alignment for NEON load and store 1351 instructions VST and VLD. 1352 (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57271">GCC Issue 57271</a>)</li> 1353 <li>Fixed a GCC 4.4.3/4.6/4.7 internal compiler error (ICE) for a constant negative index 1354 value on a string literal. 1355 (<a href="http://b.android.com/54623">Issue 54623</a>)</li> 1356 <li>Fixed GCC 4.7 segmentation fault for constant initialization with an object address. 1357 (<a href="http://b.android.com/56508">Issue 56508</a>)</li> 1358 <li>Fixed GCC 4.6 ARM segmentation fault for <code>-O</code> values when using Boost 1359 1.52.0. (<a href="http://b.android.com/42891">Issue 42891</a>) 1360 <li>Fixed {@code libc.so} and {@code libc.a} to support the {@code wait4()} function. 1361 (<a href="http://b.android.com/19854">Issue 19854</a>)</li> 1362 <li>Updated the x86 libc.so and libc.a files to include the {@code clone()} 1363 function.</li> 1364 <li>Fixed {@code LOCAL_SHORT_COMMANDS} bug where the {@code linker.list} file is 1365 empty or not used.</li> 1366 <li>Fixed GCC MIPS build on Mac OS to use CFI directives, without which 1367 {@code ld.mcld --eh-frame-hdr} fails frequently.</li> 1368 <li>Fixed Clang 3.2 X86/MIPS internal compiler error in {@code llvm/lib/VMCore/Value.cpp}. 1369 (<a href="https://android-review.googlesource.com/#/c/59021">Change 59021</a>)</li> 1370 <li>Fixed GCC 4.7 64-bit Windows assembler crash. (Error: {@code out of memory allocating 1371 4294967280 bytes}).</li> 1372 <li>Updated {@code ndk-gdb} script so that the {@code --start} or {@code --launch} actions 1373 now wait for the GNU Debug Server, so that it can more reliably hit breakpoints set 1374 early in the execution path (such as breakpoints in JNI code). 1375 (<a href="http://b.android.com/41278">Issue 41278</a>) 1376 <p class="note"><strong>Note:</strong> 1377 This feature requires jdb and produces warning about pending breakpoints. 1378 Specify the {@code --nowait} option to restore previous behavior. 1379 </p> 1380 </li> 1381 <li>Fixed GDB crash when library list is empty.</li> 1382 <li>Fixed GDB crash when using a {@code stepi} command past a {@code bx pc} or 1383 {@code blx pc} Thumb instruction. 1384 (<a href="http://b.android.com/56962">Issue 56962</a>, 1385 <a href="http://b.android.com/36149">Issue 36149</a>)</li> 1386 <li>Fixed MIPS {@code gdbserver} to look for {@code DT_MIPS_RLD_MAP} instead of 1387 {@code DT_DEBUG}. (<a href="http://b.android.com/56586">Issue 56586</a>)</li> 1388 <li>Fixed a circular dependency in the ndk-build script, for example: If A->B and 1389 B->B, then B was dropped from build. 1390 (<a href="http://b.android.com/56690">Issue 56690</a>)</li> 1391 </ul> 1392 </dd> 1393 1394 <dt>Other bug fixes:</dt> 1395 <dd> 1396 <ul> 1397 <li>Fixed the {@code ndk-build} script to enable you to specify a version of Clang as a 1398 command line option (e.g., {@code NDK_TOOLCHAIN_VERSION=clang3.2}). Previously, only 1399 specifying the version as an environment variable worked.</li> 1400 <li>Fixed gabi++ size of {@code _Unwind_Exception} to be 24 for MIPS build targets when 1401 using the Clang compiler. 1402 (<a href="https://android-review.googlesource.com/#/c/54141">Change 54141</a>)</li> 1403 <li>Fixed the {@code ndk-build} script to ensure that built libraries are actually 1404 removed from projects that include prebuilt static libraries when using the 1405 {@code ndk-build clean} command. 1406 (<a href="https://android-review.googlesource.com/#/c/54461">Change 54461</a>, 1407 <a href="https://android-review.googlesource.com/#/c/54480">Change 54480</a>)</li> 1408 <li>Modified the {@code NDK_ANALYZE=1} option to be less verbose.</li> 1409 <li>Fixed {@code gnu-libstdc++/Android.mk} to include a {@code backward/} path for builds 1410 that use backward compability. 1411 (<a href="http://b.android.com/53404">Issue 53404</a>)</li> 1412 <li>Fixed a problem where {@code stlport new} sometimes returned random values.</li> 1413 <li>Fixed {@code ndk-gdb} to match the order of {@code CPU_ABIS}, not {@code APP_ABIS}. 1414 (<a href="http://b.android.com/54033">Issue 54033</a>)</li> 1415 <li>Fixed a problem where the NDK 64-bit build on MacOSX choses the wrong path for 1416 compiler. 1417 (<a href="http://b.android.com/53769">Issue 53769</a>)</li> 1418 <li>Fixed build scripts to detect 64-bit Windows Vista. 1419 (<a href="http://b.android.com/54485">Issue 54485</a>)</li> 1420 <li>Fixed x86 {@code ntonl/swap32} error: {@code invalid 'asm': operand number 1421 out of range}. 1422 (<a href="http://b.android.com/54465">Issue 54465</a>, 1423 <a href="https://android-review.googlesource.com/#/c/57242">Change 57242</a>)</li> 1424 <li>Fixed {@code ld.gold} to merge string literals.</li> 1425 <li>Fixed {@code ld.gold} to handle large symbol alignment.</li> 1426 <li>Updated {@code ld.gold} to enable the {@code --sort-section=name} option.</li> 1427 <li>Fixed GCC 4.4.3/4.6/4.7 to suppress the {@code -export-dynamic} option for 1428 statically linked programs. GCC no longer adds an {@code .interp} section for statically 1429 linked programs.</li> 1430 <li>Fixed GCC 4.4.3 {@code stlport} compilation error about inconsistent {@code typedef} 1431 of {@code _Unwind_Control_Block}. 1432 (<a href="http://b.android.com/54426">Issue 54426</a>)</li> 1433 <li>Fixed {@code awk} scripts to handle {@code AndroidManifest.xml} files created on 1434 Windows which may contain trailing {@code \r} characters and cause build errors. 1435 (<a href="http://b.android.com/42548">Issue 42548</a>)</li> 1436 <li>Fixed {@code make-standalone-toolchain.sh} to probe the {@code prebuilts/} 1437 directory to detect if the host is 32 bit or 64 bit.</li> 1438 <li>Fixed the Clang 3.2 {@code -integrated-as} option.</li> 1439 <li>Fixed the Clang 3.2 ARM EHABI compact model {@code pr1} and {@code pr2} handler data. 1440 </li> 1441 <li>Added Clang {@code -mllvm -arm-enable-ehabi} option to fix the following Clang error: 1442 <pre>clang: for the -arm-enable-ehabi option: may only occur zero or one times!</pre> 1443 </li> 1444 <li>Fixed build failure when there is no {@code uses-sdk} element in application 1445 manifest. (<a href="http://b.android.com/57015">Issue 57015</a>)</li> 1446 </ul> 1447 1448 </dd> 1449 <dt>Other changes:</dt> 1450 <dd> 1451 <ul> 1452 <li>Header Fixes 1453 <ul> 1454 <li>Modified headers to make {@code __set_errno} an inlined function, since 1455 {@code __set_errno} in {@code errno.h} is deprecated, and {@code libc.so} no longer 1456 exports it.</li> 1457 <li>Modified {@code elf.h} to include {@code stdint.h}. 1458 (<a href="http://b.android.com/55443">Issue 55443</a>)</li> 1459 <li>Fixed {@code sys/un.h} to be included independently of other headers. 1460 (<a href="http://b.android.com/53646">Issue 53646</a>)</li> 1461 <li>Fixed all of the {@code MotionEvent_getHistorical} API family to take the 1462 {@code const AInputEvent* motion_event}. 1463 (<a href="http://b.android.com/55873">Issue 55873</a>)</li> 1464 <li>Fixed {@code malloc_usable_size} to take {@code const void*}. 1465 (<a href="http://b.android.com/55725">Issue 55725</a>)</li> 1466 <li>Fixed stdint.h to be more compatible with C99. 1467 (<a href="https://android-review.googlesource.com/#/c/46821">Change 46821</a>)</li> 1468 <li>Modified {@code wchar.h} to not redefine {@code WCHAR_MAX} and 1469 {@code WCHAR_MIN}</li> 1470 <li>Fixed {@code <inttypes.h>} declaration for pointer-related {@code PRI} and 1471 {@code SCN} macros. (<a href="http://b.android.com/57218">Issue 57218</a>)</li> 1472 <li>Changed the {@code sys/cdefs.h} header so that {@code __WCHAR_TYPE__} is 32-bit 1473 for API levels less than 9, which means that {@code wchat_t} is 32-bit for all 1474 API levels. To restore the previous behavior, define the {@code _WCHAR_IS_8BIT} 1475 boolean variable. (<a href="http://b.android.com/57267">Issue 57267</a>)</li> 1476 </ul> 1477 </li> 1478 <li>Added more formatting in NDK {@code docs/} and miscellaneous documentation fixes. 1479 </li> 1480 <li>Added support for a thin archive technique when building static libraries. 1481 (<a href="http://b.android.com/40303">Issue 40303</a>)</li> 1482 <li>Updated script {@code make-standalone-toolchain.sh} to support the {@code stlport} 1483 library in addition to {@code gnustl}, when you specify the option 1484 {@code --stl=stlport}. For more information, see {@code STANDALONE-TOOLCHAIN.html}.</li> 1485 <li>Updated the {@code make-standalone-toolchain.sh} script so that the 1486 {@code --llvm-version=} option creates the {@code $TOOLCHAIN_PREFIX-clang} and 1487 {@code $TOOLCHAIN_PREFIX-clang++} scripts in addition to {@code clang} and 1488 {@code clang++}, to avoid using the host's clang and clang++ definitions by accident. 1489 </li> 1490 <li>Added two flags to re-enable two optimizations in upstream Clang but disabled in 1491 NDK for better compatibility with code compiled by GCC: 1492 <ul> 1493 <li>Added a {@code -fcxx-missing-return-semantics} flag to re-enable <em>missing 1494return 1495 semantics</em> in Clang 3.2+. Normally, all paths should terminate with a return 1496 statement for a value-returning function. If this is not the case, clang inserts 1497 an undefined instruction (or trap in debug mode) at the path without a return 1498 statement. If you are sure your code is correct, use this flag to allow the 1499 optimizer to take advantage of the undefined behavior. If you are not sure, do not 1500 use this flag. The caller may still receive a random incorrect value, but the 1501 optimizer will not exploit it and make your code harder to debug.</li> 1502 <li>Added a {@code -fglobal-ctor-const-promotion} flag to re-enable 1503 promoting global variables with static constructor to be constants. With this flag, 1504 the global variable optimization pass of LLVM tries to evaluate the global 1505 variables with static constructors and promote them to global constants. Although 1506 this optimization is correct, it may cause some incompatability with code compiled 1507 by GCC. For example, code may do {@code const_cast} to cast the constant to mutable 1508 and modify it. In GCC, the variable is in read-write and the code is run by 1509 accident. In Clang, the const variable is in read-only memory and may cause your 1510 application to crash.</li> 1511 </ul> 1512 </li> 1513 <li>Added {@code -mldc1-sdc1} to the MIPS GCC and Clang compilers. By default, compilers 1514 align 8-byte objects properly and emit the {@code ldc1} and {@code sdc1} instructions 1515 to move them around. If your app uses a custom allocator that does not always align 1516 with a new object's 8-byte boundary in the same way as the default allocator, your app 1517 may crash due to {@code ldc1} and {@code sdc1} operations on unaligned memory. In this 1518 case, use the {@code -mno-ldc1-sdc1} flag to workaround the problem.</li> 1519 <li>Downgraded the event severity from warning to info if {@code APP_PLATFORM_LEVEL} is 1520 larger than {@code APP_MIN_PLATFORM_LEVEL}. The {@code APP_PLATFORM_LEVEL} may be lower 1521 than {@code APP_PLATFORM} in {@code jni/Application.mk} because the NDK does not have 1522 headers for all levels. In this case, the actual level is shifted downwards. The 1523 {@code APP_MIN_PLATFORM_LEVEL} is specified by the {@code android:minSdkVersion} in 1524 your application's manifest. 1525 (<a href="http://b.android.com/39752">Issue 39752</a>)</li> 1526 <li>Added the {@code android_getCpuIdArm()} and {@code android_setCpuArm()} methods to 1527 {@code cpu-features.c}. This addition enables easier retrieval of the ARM CPUID 1528 information. (<a href="http://b.android.com/53689">Issue 53689</a>)</li> 1529 <li>Modified {@code ndk-build} to use GCC 4.7's {@code as/ld} for Clang compiling. 1530 <p class="note"><strong>Note:</strong> 1531 In GCC 4.7, {@code monotonic_clock} and {@code is_monotonic} have been renamed to 1532 {@code steady_clock} and {@code is_steady}, respectively.</p></li> 1533 <li>Added the following new warnings to the {@code ndk-build} script: 1534 <ul> 1535 <li>Added warnings if {@code LOCAL_LDLIBS/LDFLAGS} are used in static library 1536 modules.</li> 1537 <li>Added a warning if a configuration has no module to build.</li> 1538 <li>Added a warning for non-system libraries being used in 1539 {@code LOCAL_LDLIBS/LDFLAGS} of a shared library or executable modules.</li> 1540 </ul> 1541 </li> 1542 <li>Updated build scripts, so that if {@code APP_MODULES} is not defined and only static 1543 libraries are listed in {@code Android.mk}, the script force-builds all of them. 1544 (<a href="http://b.android.com/53502">Issue 53502</a>)</li> 1545 <li>Updated {@code ndk-build} to support absolute paths in {@code LOCAL_SRC_FILES}.</li> 1546 <li>Removed the {@code *-gdbtui} executables, which are duplicates of the {@code *-gdb} 1547 executables with the {@code -tui} option enabled.</li> 1548 <li>Updated the build scripts to warn you when the Edison Design Group (EDG) compiler 1549 front-end turns {@code _STLP_HAS_INCLUDE_NEXT} back on. 1550 (<a href="http://b.android.com/53646">Issue 53646</a>)</li> 1551 <li>Added the environment variable {@code NDK_LIBS_OUT} to allow overriding of the 1552 path for {@code libraries/gdbserver} from the default {@code $PROJECT/libs}. 1553 For more information, see {@code OVERVIEW.html}.</li> 1554 <li>Changed ndk-build script defaults to compile code with format string protection 1555 {@code -Wformat -Werror=format-security}. You may set 1556 {@code LOCAL_DISABLE_FORMAT_STRING_CHECKS=true} to disable it. 1557 For more information, see {@code ANDROID-MK.html}</li> 1558 <li>Added STL pretty-print support in {@code ndk-gdb-py}. For more information, see 1559 {@code NDK-GDB.html}.</li> 1560 <li>Added tests based on the googletest frameworks.</li> 1561 <li>Added a notification to the toolchain build script that warns you if the current shell 1562 is not {@code bash}.</li> 1563 </ul> 1564 </dd> 1565 </dl> 1566 </div> 1567</div> 1568 1569 1570<div class="toggle-content closed"> 1571 <p><a href="#" onclick="return toggleContent(this)"> 1572 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 1573 alt="">Android NDK, Revision 8e</a> <em>(March 2013)</em> 1574 </p> 1575 1576 <div class="toggle-content-toggleme"> 1577 <dl> 1578 <dt>Important changes:</dt> 1579 <dd> 1580 <ul> 1581 <li>Added 64-bit host toolchain set (package name suffix {@code *-x86_64.*}). For more 1582 information, see {@code CHANGES.HTML} and {@code NDK-BUILD.html}.</li> 1583 <li>Added Clang 3.2 compiler. GCC 4.6 is still the default. For information on using the 1584 Clang compiler, see {@code CHANGES.HTML}.</li> 1585 <li>Added static code analyzer for Linux/MacOSX hosts. For information on using the 1586 analyzer, see {@code CHANGES.HTML}.</li> 1587 <li>Added MCLinker for Linux/MacOSX hosts as an experimental feature. The {@code ld.gold} 1588 linker is the default where available, so you must explicitly enable it. For more 1589 information, see {@code CHANGES.HTML}.</li> 1590 <li>Updated ndk-build to use topological sort for module dependencies, which means the 1591 build automatically sorts out the order of libraries specified in 1592 {@code LOCAL_STATIC_LIBRARIES}, {@code LOCAL_WHOLE_STATIC_LIBRARIES} and 1593 {@code LOCAL_SHARED_LIBRARIES}. For more information, see {@code CHANGES.HTML}. 1594 (<a href="http://b.android.com/39378">Issue 39378</a>)</li> 1595 </ul> 1596 </dd> 1597 1598 <dt>Important bug fixes:</dt> 1599 <dd> 1600 <ul> 1601 <li>Fixed build script to build all toolchains in {@code -O2}. Toolchains in previous 1602 releases were incorrectly built without optimization.</li> 1603 <li>Fixed build script which unconditionally builds Clang/llvm for MacOSX in 64-bit.</li> 1604 <li>Fixed GCC 4.6/4.7 internal compiler error: 1605 {@code gen_thumb_movhi_clobber at config/arm/arm.md:5832}. 1606 (<a href="http://b.android.com/52732">Issue 52732</a>)</li> 1607 <li>Fixed build problem where GCC/ARM 4.6/4.7 fails to link code using 64-bit atomic 1608 built-in functions. 1609 (<a href="http://b.android.com/41297">Issue 41297</a>)</li> 1610 <li>Fixed GCC 4.7 linker DIV usage mismatch errors. 1611 (<a href="http://sourceware.org/ml/binutils/2012-12/msg00202.html">Sourceware Issue</a>) 1612 <li>Fixed GCC 4.7 internal compiler error {@code build_data_member_initialization, at 1613 cp/semantics.c:5790}.</li> 1614 <li>Fixed GCC 4.7 internal compiler error {@code redirect_eh_edge_1, at tree-eh.c:2214}. 1615 (<a href="http://b.android.com/52909">Issue 52909</a>)</li> 1616 <li>Fixed a GCC 4.7 segfault. 1617 (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245">GCC Issue</a>)</li> 1618 <li>Fixed {@code <chrono>} clock resolution and enabled {@code steady_clock}. 1619 (<a href="http://b.android.com/39680">Issue 39680</a>)</li> 1620 <li>Fixed toolchain to enable {@code _GLIBCXX_HAS_GTHREADS} for GCC 4.7 libstdc++. 1621 (<a href="http://b.android.com/41770">Issue 41770</a>, 1622 <a href="http://b.android.com/41859">Issue 41859</a>)</li> 1623 <li>Fixed problem with the X86 MXX/SSE code failing to link due to missing 1624 {@code posix_memalign}. 1625 (<a href="https://android-review.googlesource.com/#/c/51872">Change 51872</a>)</li> 1626 <li>Fixed GCC4.7/X86 segmentation fault in {@code i386.c}, function 1627 {@code distance_non_agu_define_in_bb()}. 1628 (<a href="https://android-review.googlesource.com/#/c/50383">Change 50383</a>)</li> 1629 <li>Fixed GCC4.7/X86 to restore earlier {@code cmov} behavior. 1630 (<a href="http://gcc.gnu.org/viewcvs?view=revision&revision=193554">GCC Issue</a>)</li> 1631 <li>Fixed handling NULL return value of {@code setlocale()} in libstdc++/GCC4.7. 1632 (<a href="http://b.android.com/46718">Issue 46718</a>) 1633 <li>Fixed {@code ld.gold} runtime undefined reference to {@code __exidx_start} and 1634 {@code __exidx_start_end}. 1635 (<a href="https://android-review.googlesource.com/#/c/52134">Change 52134</a>)</li> 1636 <li>Fixed Clang 3.1 internal compiler error when using Eigen library. 1637 (<a href="http://b.android.com/41246">Issue 41246</a>)</li> 1638 <li>Fixed Clang 3.1 internal compiler error including {@code <chrono>} in C++11 1639mode. 1640 (<a href="http://b.android.com/39600">Issue 39600</a>)</li> 1641 <li>Fixed Clang 3.1 internal compiler error when generating object code for a method 1642 call to a uniform initialized {@code rvalue}. 1643 (<a href="http://b.android.com/41387">Issue 41387</a>)</li> 1644 <li>Fixed Clang 3.1/X86 stack realignment. 1645 (<a href="https://android-review.googlesource.com/#/c/52154">Change 52154</a>)</li> 1646 <li>Fixed problem with GNU Debugger (GDB) SIGILL when debugging on Android 4.1.2. 1647 (<a href="http://b.android.com/40941">Issue 40941</a>)</li> 1648 <li>Fixed problem where GDB cannot set {@code source:line} breakpoints when symbols 1649contain 1650 long, indirect file paths. 1651 (<a href="http://b.android.com/42448">Issue 42448</a>)</li> 1652 <li>Fixed GDB {@code read_program_header} for MIPS PIE executables. 1653 (<a href="https://android-review.googlesource.com/#/c/49592">Change 49592</a>)</li> 1654 <li>Fixed {@code STLport} segmentation fault in {@code uncaught_exception()}. 1655 (<a href="https://android-review.googlesource.com/#/c/50236">Change 50236</a>)</li> 1656 <li>Fixed {@code STLport} bus error in exception handling due to unaligned access of 1657 {@code DW_EH_PE_udata2}, {@code DW_EH_PE_udata4}, and {@code DW_EH_PE_udata8}.</li> 1658 <li>Fixed Gabi++ infinite recursion problem with {@code nothrow new[]} operator. 1659 (<a href="http://b.android.com/52833">Issue 52833</a>)</li> 1660 <li>Fixed Gabi++ wrong offset to exception handler pointer. 1661 (<a href="https://android-review.googlesource.com/#/c/53446">Change 53446</a>)</li> 1662 <li>Removed Gabi++ redundant free on exception object 1663 (<a href="https://android-review.googlesource.com/#/c/53447">Change 53447</a>)</li> 1664 </ul> 1665 </dd> 1666 1667 <dt>Other bug fixes:</dt> 1668 <dd> 1669 <ul> 1670 <li>Fixed NDK headers: 1671 <ul> 1672 <li>Removed redundant definitions of {@code size_t}, {@code ssize_t}, and 1673 {@code ptrdiff_t}.</li> 1674 <li>Fixed MIPS and ARM {@code fenv.h} header.</li> 1675 <li>Fixed {@code stddef.h} to not redefine {@code offsetof} since it already exists 1676 in the toolchain.</li> 1677 <li>Fixed {@code elf.h} to contain {@code Elf32_auxv_t} and {@code Elf64_auxv_t}. 1678 (<a href="http://b.android.com/38441">Issue 38441</a>) 1679 </li> 1680 <li>Fixed the {@code #ifdef} C++ definitions in the 1681 {@code OpenSLES_AndroidConfiguration.h} header file. 1682 (<a href="http://b.android.com/53163">Issue 53163</a>) 1683 </li> 1684 </ul> 1685 </li> 1686 <li>Fixed {@code STLport} to abort after out of memory error instead of silently exiting. 1687 </li> 1688 <li>Fixed system and Gabi++ headers to be able to compile with API level 8 and lower.</li> 1689 <li>Fixed {@code cpufeatures} to not parse {@code /proc/self/auxv}. 1690 (<a href="http://b.android.com/43055">Issue 43055</a>)</li> 1691 <li>Fixed {@code ld.gold} to not depend on host libstdc++ and on Windows platforms, 1692 to not depend on the {@code libgcc_sjlj_1.dll} library.</li> 1693 <li>Fixed Clang 3.1 which emits inconsistent register list in {@code .vsave} and fails 1694 assembler. 1695 (<a href="https://android-review.googlesource.com/#/c/49930">Change 49930</a>)</li> 1696 <li>Fixed Clang 3.1 to be able to compile libgabi++ and pass the {@code test-stlport} 1697 tests for MIPS build targets. 1698 (<a href="https://android-review.googlesource.com/#/c/51961">Change 51961</a>)</li> 1699 <li>Fixed Clang 3.1 to only enable exception by default for C++, not for C.</li> 1700 <li>Fixed several issues in Clang 3.1 to pass most GNU exception tests.</li> 1701 <li>Fixed scripts {@code clang} and {@code clang++} in standalone NDK compiler to detect 1702 {@code -cc1} and to not specify {@code -target} when found.</li> 1703 <li>Fixed {@code ndk-build} to observe {@code NDK_APP_OUT} set in {@code Application.mk}. 1704 </li> 1705 <li>Fixed X86 {@code libc.so} and {@code lib.a} which were missing the {@code sigsetjmp} 1706 and {@code siglongjmp} functions already declared in {@code setjmp.h}. 1707 (<a href="http://b.android.com/19851">Issue 19851</a>)</li> 1708 <li>Patched GCC 4.4.3/4.6/4.7 libstdc++ to work with Clang in C++ 11. 1709 (<a href="http://clang.llvm.org/cxx_status.html">Clang Issue</a>)</li> 1710 <li>Fixed cygwin path in argument passed to {@code HOST_AWK}.</li> 1711 <li>Fixed {@code ndk-build} script warning in windows when running from project's JNI 1712 directory. 1713 (<a href="http://b.android.com/40192">Issue 40192</a>)</li> 1714 <li>Fixed problem where the {@code ndk-build} script does not build if makefile has 1715 trailing whitespace in the {@code LOCAL_PATH} definition. 1716 (<a href="http://b.android.com/42841">Issue 42841</a>)</li> 1717 </ul> 1718 </dd> 1719 1720 <dt>Other changes:</dt> 1721 <dd> 1722 <ul> 1723 <li>Enabled threading support in GCC/MIPS toolchain.</li> 1724 <li>Updated GCC exception handling helpers {@code __cxa_begin_cleanup} and 1725 {@code __cxa_type_match} to have <em>default</em> visibility from the previous 1726 <em>hidden</em> visibility in GNU libstdc++. For more information, see 1727 {@code CHANGES.HTML}.</li> 1728 <li>Updated build scripts so that Gabi++ and STLport static libraries are now built with 1729 hidden visibility except for exception handling helpers.</li> 1730 <li>Updated build so that {@code STLport} is built for ARM in Thumb mode.</li> 1731 <li>Added support for {@code std::set_new_handler} in Gabi++. 1732 (<a href="http://b.android.com/52805">Issue 52805</a>)</li> 1733 <li>Enabled {@code FUTEX} system call in GNU libstdc++.</li> 1734 <li>Updated {@code ndk-build} so that it no longer copies prebuilt static library to 1735 a project's {@code obj/local/<abi>/} directory. 1736 (<a href="http://b.android.com/40302">Issue 40302</a>)</li> 1737 <li>Removed {@code __ARM_ARCH_5*__} from ARM {@code toolchains/*/setup.mk} script. 1738 (<a href="http://b.android.com/21132">Issue 21132</a>)</li> 1739 <li>Built additional GNU libstdc++ libraries in thumb for ARM.</li> 1740 <li>Enabled MIPS floating-point {@code madd/msub/nmadd/nmsub/recip/rsqrt} 1741 instructions with 32-bit FPU.</li> 1742 <li>Enabled graphite loop optimizer in GCC 4.6 and 4.7 to allow more optimizations: 1743 {@code -fgraphite}, {@code -fgraphite-identity}, {@code -floop-block}, {@code 1744-floop-flatten}, 1745 {@code -floop-interchange}, {@code -floop-strip-mine}, {@code -floop-parallelize-all}, 1746 and {@code -ftree-loop-linear}. 1747 (<a href="http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html">info</a>)</li> 1748 <li>Enabled {@code polly} for Clang 3.1 on Linux and Max OS X 32-bit hosts which analyzes 1749 and optimizes memory access. (<a href="http://polly.llvm.org">info</a>)</li> 1750 <li>Enabled {@code -flto} in GCC 4.7, 4.6, Clang 3.2 and Clang 3.1 on linux (Clang LTO 1751 via LLVMgold.so). MIPS compiler targets are not supported because {@code ld.gold} 1752 is not available.</li> 1753 <li>Enabled {@code --plugin} and {@code --plugin-opt} for {@code ld.gold} in GCC 4.6/4.7. 1754 </li> 1755 <li>Enabled {@code --text-reorder} for {@code ld.gold} in GCC 4.7.</li> 1756 <li>Configured GNU libstdc++ with {@code _GLIBCXX_USE_C99_MATH} which undefines the 1757 {@code isinf} script in the bionic header. For more information, see 1758 {@code CHANGES.html}.</li> 1759 <li>Added {@code APP_LDFLAGS} to the build scripts. For more information, see 1760 {@code ANDROID-MK.html}.</li> 1761 <li>Updated build scripts to allow {@code NDK_LOG=0} to disable the {@code NDK_LOG}.</li> 1762 <li>Updated build scripts to allow {@code NDK_HOST_32BIT=0} to disable the host developer 1763 environment 32-bit toolchain.</li> 1764 <li>Changed the default GCC/X86 flags {@code -march=} and {@code -mtune=} from 1765 {@code pentiumpro} and {@code generic} to {@code i686} and {@code atom}.</li> 1766 <li>Enhanced toolchain build scripts: 1767 <ul> 1768 <li>Fixed a race condition in {@code build-gcc.sh} for the {@code mingw} build type 1769 which was preventing a significant amount of parallel build processing.</li> 1770 <li>Updated {@code build-gabi++.sh} and {@code build-stlport.sh} so they can now run 1771 from the NDK package. 1772 (<a href="http://b.android.com/52835">Issue 52835</a>) 1773 </li> 1774 <li>Fixed {@code run-tests.sh} in the {@code MSys} utilities collection.</li> 1775 <li>Improved 64-bit host toolchain and Canadian Cross build support.</li> 1776 <li>Updated {@code build-mingw64-toolchain.sh} script to more recent version.</li> 1777 <li>Added option to build {@code libgnustl_static.a} and {@code stlport_static.a} 1778 without hidden visibility.</li> 1779 </ul> 1780 </li> 1781 </ul> 1782 1783 </dd> 1784 </dl> 1785 </div> 1786</div> 1787 1788 1789<div class="toggle-content closed"> 1790 <p><a href="#" onclick="return toggleContent(this)"> 1791 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 1792 alt="">Android NDK, Revision 8d</a> <em>(December 2012)</em> 1793 </p> 1794 1795 <div class="toggle-content-toggleme"> 1796 <dl> 1797 <dt>Important changes:</dt> 1798 <dd> 1799 <ul> 1800 <li>Added the GNU Compiler Collection (GCC) 4.7 compiler to the NDK. The GCC 4.6 compiler 1801 is still the default, so you must to explicitly enable the new version as follows: 1802 <ul> 1803 <li>For {@code ndk-build}, export the {@code NDK_TOOLCHAIN_VERSION=4.7} variable 1804 <em>or</em> add it to {@code Application.mk}.</li> 1805 <li>For standalone builds, add the {@code --toolchain=} option to 1806 {@code make-standalone-toolchain.sh}, for example: 1807 <pre>--toolchain=arm-linux-androideabi-4.7</pre></li> 1808 </ul> 1809 <p class="note"> 1810 <strong>Note:</strong> This feature is experimental. Please try it and 1811 <a href="http://code.google.com/p/android/issues/list">report any issues</a>.</p> 1812 </li> 1813 <li>Added {@code stlport} exception support via gabi++. Note that the new gabi++ 1814 depends on {@code dlopen} and related code, meaning that: 1815 <ul> 1816 <li>You can no longer build a <em>static</em> executable using the {@code -static} 1817 option or include {@code libstlport_static.a} using 1818 {@code APP_STL := stlport_static}. (You can still use the {@code -static} option 1819 with a standalone toolchain.) Compiling a <em>dynamic</em> executable using 1820 {@code include $(BUILD_EXECUTABLE)} continues to work because the compiler 1821 automatically adds the {@code -ldl} option.</li> 1822 <li>If your project links using {@code -nostdlib} and {-Wl,--no-undefined}, you 1823 must manually include the {@code -ldl} option.</li> 1824 </ul> 1825 For more information, see {@code CPLUSPLUS-SUPPORT.html}. 1826 1827 <p class="note"> 1828 <strong>Note:</strong> This feature is experimental and works better with the GCC 1829 4.6/4.7 compilers than with GCC 4.4.3 or Clang 3.1. Please try it and 1830 <a href="http://code.google.com/p/android/issues/list">report any issues</a>.</p> 1831 </li> 1832 <li>Added a {@code -mstack-protector-guard=} option for x86 to choose between a 1833 <em>global</em> default path which is compatible with older Android C library (bionic) 1834 and a new <em>tls</em> path (%gs:20) for {@code -fstack-protector}, 1835 {@code -fstack-protector-all} and {@code -fstack-protector-strong} using the GCC 4.6 1836 and higher compilers. 1837 1838 <p class="note"> 1839 <strong>Note:</strong> The {@code -mstack-protector-guard} setting itself does not 1840 enable any {@code -fstack-protector*} options.</p> 1841 </li> 1842 <li>Added {@code android_setCpu()} function to 1843 {@code sources/android/cpufeatures/cpu-features.c} for use when auto-detection via 1844 {@code /proc} is not possible in Android 4.1 and higher. 1845 (<a href="http://code.google.com/p/chromium/issues/detail?id=164154">Chromium Issue 1846 164154</a>)</li> 1847 </ul> 1848 </dd> 1849 1850 <dt>Important bug fixes:</dt> 1851 <dd> 1852 <ul> 1853 <li>Fixed unnecessary rebuild of object files when using the {@code ndk-build} script. 1854 (<a href="http://b.android.com/39810">Issue 39810</a>)</li> 1855 <li>Fixed a linker failure with the NDK 8c release for Mac OS X 10.6.x that produced the 1856 following error: 1857 <pre> 1858dyld: lazy symbol binding failed: Symbol not found: _memmem 1859Referenced from: ...../arm-linux-androideabi/bin/ld 1860Expected in: /usr/lib/libSystem.B.dylib</pre> 1861 This problem was caused by building on Mac OS X 10.7, which produced binaries that were 1862 not compatible with Mac OS 10.6.x and the NDK. 1863 </li> 1864 <li>Removed the {@code -x c++} options from the Clang++ standalone build script. 1865 (<a href="http://b.android.com/39089">Issue 39089</a>)</li> 1866 <li>Fixed issues using the {@code NDK_TOOLCHAIN_VERSION=clang3.1} option in Cygwin. 1867 (<a href="http://b.android.com/39585">Issue 39585</a>)</li> 1868 <li>Fixed the {@code make-standalone-toolchain.sh} script to allow generation of a 1869 standalone toolchain using the Cygwin or MinGW environments. The resulting toolchain 1870 can be used in Cygwin, MingGW or CMD.exe environments. 1871 (<a href="http://b.android.com/39915">Issue 39915</a>, 1872 <a href="http://b.android.com/39585">Issue 39585</a>)</li> 1873 <li>Added missing {@code SL_IID_ANDROIDBUFFERQUEUESOURCE} option in android-14 builds for 1874 ARM and X86. 1875 (<a href="http://b.android.com/40625">Issue 40625</a>)</li> 1876 <li>Fixed x86 CPU detection for the {@code ANDROID_CPU_X86_FEATURE_MOVBE} feature. 1877 (<a href="http://b.android.com/39317">Issue 39317</a>)</li> 1878 <li>Fixed an issue preventing the Standard Template Library (STL) from using C++ 1879 sources that do not have a {@code .cpp} file extension.</li> 1880 <li>Fixed GCC 4.6 ARM internal compiler error <em>at reload1.c:1061</em>. 1881 (<a href="http://b.android.com/20862">Issue 20862</a>)</li> 1882 <li>Fixed GCC 4.4.3 ARM internal compiler error <em>at emit-rtl.c:1954</em>. 1883 (<a href="http://b.android.com/22336">Issue 22336</a>)</li> 1884 <li>Fixed GCC 4.4.3 ARM internal compiler error <em>at postreload.c:396</em>. 1885 (<a href="http://b.android.com/22345">Issue 22345</a>)</li> 1886 <li>Fixed problem with GCC 4.6/4.7 skipping lambda functions. 1887 (<a href="http://b.android.com/35933">Issue 35933</a>)</li> 1888 </ul> 1889 </dd> 1890 1891 <dt>Other bug fixes:</dt> 1892 <dd> 1893 <ul> 1894 <li>NDK header file fixes: 1895 <ul> 1896 <li>Fixed {@code __WINT_TYPE__} and {@code wint_t} to be the same type.</li> 1897 <li>Corrected typo in {@code android/bitmap.h}. 1898 (<a href="http://b.android.com/15134">Issue 15134</a>) 1899 </li> 1900 <li>Corrected typo in {@code errno.h}.</li> 1901 <li>Added check for the presence of {@code __STDC_VERSION__} in {@code sys/cdefs.h}. 1902 (<a href="http://b.android.com/14627">Issue 14627</a>) 1903 </li> 1904 <li>Reorganized headers in {@code byteswap.h} and {@code dirent.h}.</li> 1905 <li>Fixed {@code limits.h} to include {@code page.h} which provides {@code PAGE_SIZE} 1906 settings. 1907 (<a href="http://b.android.com/39983">Issue 39983</a>) 1908 </li> 1909 <li>Fixed return type of {@code glGetAttribLocation()} and 1910 {@code glGetUniformLocation()} from {@code int} to {@code GLint}.</li> 1911 <li>Fixed {@code __BYTE_ORDER} constant for x86 builds. 1912 (<a href="http://b.android.com/39824">Issue 39824</a>) 1913 </li> 1914 </ul> 1915 </li> 1916 <li>Fixed {@code ndk-build} script to not overwrite {@code -Os} with {@code -O2} for ARM 1917 builds.</li> 1918 <li>Fixed build scripts to allow overwriting of {@code HOST_AWK}, {@code HOST_SED}, and 1919 {@code HOST_MAKE} settings.</li> 1920 <li>Fixed issue for {@code ld.gold} on {@code fsck_msdos} builds linking objects built by 1921 the Intel C/C++ compiler (ICC).</li> 1922 <li>Fixed ARM EHABI support in Clang to conform to specifications.</li> 1923 <li>Fixed GNU Debugger (GDB) to shorten the time spent on walking the target's link map 1924 during {@code solib} events. 1925 (<a href="http://b.android.com/38402">Issue 38402</a>)</li> 1926 <li>Fixed missing {@code libgcc.a} file when linking shared libraries.</li> 1927 </ul> 1928 </dd> 1929 1930 <dt>Other changes:</dt> 1931 <dd> 1932 <ul> 1933 <li>Backported 64-bit built-in atomic functions for ARM to GCC 4.6.</li> 1934 <li>Added documentation for audio output latency, along with other documentation and 1935 fixes.</li> 1936 <li>Fixed debug builds with Clang so that non-void functions now raise a {@code SIGILL} 1937 signal for paths without a return statement.</li> 1938 <li>Updated {@code make-standalone-toolchain.sh} to accept the suffix {@code -clang3.1} 1939 which is equivalent to adding {@code --llvm-version=3.1} to the GCC 4.6 toolchain.</li> 1940 <li>Updated GCC and Clang bug report URL to: 1941 <a 1942href="http://source.android.com/source/report-bugs.html">http://source.android.com/source/report-bug 1943s.html</a></li> 1944 <li>Added ARM ELF support to {@code llvm-objdump}.</li> 1945 <li>Suppressed <em>treating c input as c++</em> warning for Clang builds.</li> 1946 <li>Updated build so that only the 32-bit version of {@code libiberty.a} is built and 1947 placed in {@code lib32/}.</li> 1948 </ul> 1949 </dd> 1950 </dl> 1951 </div> 1952</div> 1953 1954 1955<div class="toggle-content closed"> 1956 <p><a href="#" onclick="return toggleContent(this)"> 1957 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 1958 alt="">Android NDK, Revision 8c</a> <em>(November 2012)</em> 1959 </p> 1960 1961 <div class="toggle-content-toggleme"> 1962 <dl> 1963 <dt>Important changes:</dt> 1964 1965 <dd> 1966 <ul> 1967 <li>Added the Clang 3.1 compiler to the NDK. The GNU Compiler Collection (GCC) 4.6 is 1968 still the default, so you must explicitly enable the Clang compiler option as follows: 1969 <ul> 1970 <li>For {@code ndk-build}, export {@code NDK_TOOLCHAIN_VERSION=clang3.1} <em>or</em> 1971 add this environment variable setting to {@code Application.mk}.</li> 1972 <li>For standalone builds, add {@code --llvm-version=3.1} to 1973 {@code make-standalone-toolchain.sh} and replace {@code CC} and {@code CXX} in your 1974 makefile with {@code <tool-path>/bin/clang} and 1975 {@code <tool-path>/bin/clang++}. See {@code STANDALONE-TOOLCHAIN.html} for 1976 details.</li> 1977 </ul> 1978 <p class="note"><strong>Note:</strong> This feature is experimental. Please try it and 1979 <a href="http://code.google.com/p/android/issues/list">report any issues</a>.</p></li> 1980 <li>Added Gold linker {@code ld.gold} for the Windows toolchain. Gold linker is also the 1981 default for ARM and X86 on all hosts. You may override it to use the {@code ld.bfd} 1982 linker by adding {@code LOCAL_LDFLAGS += -fuse-ld=bfd} to {@code Android.mk}, or by 1983passing 1984 {@code -fuse-ld=bfd} to the g++/clang++ command line that does the linking.</li> 1985 <li>Added checks for spaces in the NDK path to the {@code ndk-build[.cmd]} and 1986 {@code ndk-gdb} scripts, to prevent build errors that are difficult to diagnose.</li> 1987 <li>Made the following changes to API level handling: 1988 <ul> 1989 <li>Modified build logic so that projects that specify {@code android-10} through 1990 {@code android-13} in {@code APP_PLATFORM}, {@code project.properties} or 1991 {@code default.properties} link against {@code android-9} instead of 1992 {@code android-14}. 1993 <li>Updated build so that executables using android-16 (Jelly Bean) or higher are 1994 compiled with the {@code -fPIE} option for position-independent executables (PIE). 1995 A new {@code APP_PIE} option allows you to control this behavior. See {@code 1996 APPLICATION-MK.html} for details. 1997 <p class="note"> 1998 <strong>Note:</strong> All API levels above 14 still link against {@code 1999 platforms/android-14} and no new {@code platforms/android-N} have been added. 2000 </p></li> 2001 <li>Modified {@code ndk-build} to provide warnings if the adjusted API level is larger 2002 than {@code android:minSdkVersion} in the project's {@code AndroidManifest.xml}.</li> 2003 </ul> 2004 </li> 2005 <li>Updated the {@code cpu-features} helper library to include more ARM-specific features. 2006 See {@code sources/android/cpufeatures/cpu-features.h} for details.</li> 2007 <li>Modified the long double on the X86 platform to be 8 bytes. This data type is now the 2008 same size as a double, but is still treated as a distinct type.</li> 2009 <li>Updated build for {@code APP_ABI=armeabi-v7a}: 2010 <ul> 2011 <li>Modified this build type to pass the {@code -march=armv7-a} parameter 2012 to the linker. This change ensures that v7-specific libraries and {@code crt*.o} are 2013 linked correctly.</li> 2014 <li>Added {@code -mfpu=vfpv3-d16} to {@code ndk-build} instead of the 2015 {@code -mfpu=vfp} option used in previous releases.</li> 2016 </ul> 2017 </li> 2018 </ul> 2019 </dd> 2020 </dl> 2021 2022 <dl> 2023 <dt>Important bug fixes:</dt> 2024 2025 <dd> 2026 <ul> 2027 <li>Fixed an issue where running {@code make-standalone-toolchain.sh} with root privileges 2028 resulted in the stand alone tool chain being inaccessible to some users. 2029 (<a href="http://b.android.com/35279">Issue 35279</a>) 2030 <ul> 2031 <li>All files and executables in the NDK release package are set to have read and 2032 execute permissions for all.</li> 2033 <li>The ownership/group of {@code libstdc++.a} is now preserved when copied.</li> 2034 </ul> 2035 </li> 2036 <li>Removed redundant {@code \r} from Windows prebuilt {@code echo.exe}. The redundant 2037 {@code \r} caused {@code gdb.setup} to fail in the GNU Debugger (GDB) because it 2038 incorrectly became part of the path. 2039 (<a href="http://b.android.com/36054">Issue 36054</a>)</li> 2040 <li>Fixed Windows parallel builds that sometimes failed due to timing issues in the 2041 {@code host-mkdir} implementation. 2042 (<a href="http://b.android.com/25875">Issue 25875</a>)</li> 2043 <li>Fixed GCC 4.4.3 GNU {@code libstdc++} to <em>not</em> merge {@code typeinfo} names by 2044 default. For more details, see 2045 {@code toolchain repo gcc/gcc-4.4.3/libstdc++-v3/libsupc++/typeinfo}. 2046 (<a href="http://b.android.com/22165">Issue 22165</a>)</li> 2047 <li>Fixed problem on {@code null} context in GCC 4.6 2048 {@code cp/mangle.c::write_unscoped_name}, where GCC may crash when the context is 2049 {@code null} and dereferenced in {@code TREE_CODE}.</li> 2050 <li>Fixed GCC 4.4.3 crashes on ARM NEON-specific type definitions for floats. 2051 (<a href="http://b.android.com/34613">Issue 34613</a>)</li> 2052 <li>Fixed the {@code STLport} internal {@code _IteWrapper::operator*()} implementation 2053 where a stale stack location holding the dereferenced value was returned and caused 2054 runtime crashes. 2055 (<a href="http://b.android.com/38630">Issue 38630</a>)</li> 2056 2057 <li>ARM-specific fixes: 2058 <ul> 2059 <li>Fixed ARM GCC 4.4.3/4.6 {@code g++} to not warn that the <em>mangling of 2060 <va_list> was changed in GCC 4.4</em>. The workaround using the 2061 {@code -Wno-psabi} switch to avoid this warning is no longer required.</li> 2062 <li>Fixed an issue when a project with {@code .arm} or {@code .neon} suffixes in 2063 {@code LOCAL_SRC_FILES} also used {@code APP_STL}. With {@code APP_STL}, the 2064 {@code ndk-build} script searches for C++ files in {@code LOCAL_SRC_FILES} before 2065 adding STL {@code header/lib} paths to compilation. Modified {@code ndk-build} to 2066 filter out {@code .arm} and {@code .neon} suffixes before the search, otherwise items 2067 in {@code LOCAL_SRC_FILES} like {@code myfile.cpp.arm.neon} won't be compiled as C++ 2068 code.</li> 2069 <li>Fixed {@code binutils-2.21/ld.bfd} to be capable of linking object from older 2070 binutils without {@code tag_FP_arch}, which was producing <em>assertion fail</em> 2071 error messages in GNU Binutils. 2072 (<a href="http://b.android.com/35209">Issue 35209</a>) 2073 </li> 2074 <li>Removed <em>Unknown EABI object attribute 44</em> warning when 2075 {@code binutils-2.19/ld} links prebuilt object by newer {@code binutils-2.21}</li> 2076 <li>Fixed an issue in GNU {@code stdc++} compilation with both {@code -mthumb} and 2077 {@code -march=armv7-a}, by modifying {@code make-standalone-toolchain.sh} to populate 2078 {@code headers/libs} in sub-directory {@code armv7-a/thumb}. 2079 (<a href="http://b.android.com/35616">Issue 35616</a>) 2080 </li> 2081 <li>Fixed <em>unresolvable R_ARM_THM_CALL relocation</em> error. 2082 (<a href="http://b.android.com/35342">Issue 35342</a>) 2083 </li> 2084 <li>Fixed internal compiler error at {@code reload1.c:3633}, caused by the ARM 2085 back-end expecting the wrong operand type when sign-extend from {@code char}. 2086 (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50099">GCC Issue 50099</a>)</li> 2087 <li>Fixed internal compiler error with negative shift amount. 2088 (<a href="http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00594.html">GCC Issue</a>)</li> 2089 </ul> 2090 </li> 2091 2092 <li>Fixed {@code -fstack-protector} for X86, which is also the default for the 2093 {@code ndk-build} x86 ABI target.</li> 2094 2095 <li>MIPS-specific fixes: 2096 <ul> 2097 <li>Fixed {@code STLport} endian-ness by setting {@code _STLP_LITTLE_ENDIAN} to 1 when 2098 compiling MIPS {@code libstlport_*}.</li> 2099 <li>Fixed GCC {@code __builtin_unreachable} issue when compiling LLVM. 2100 (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54369">GCC Issue 54369</a>)</li> 2101 <li>Backported fix for {@code cc1} compile process consuming 100% CPU. 2102 (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50380">GCC Issue 50380</a>)</li> 2103 </ul> 2104 </li> 2105 2106 <li>GNU Debugger-specific fixes: 2107 <ul> 2108 <li>Disabled Python support in gdb-7.x at build, otherwise the gdb-7.x configure 2109 function may pick up whatever Python version is available on the host and build 2110 {@code gdb} with a hard-wired dependency on a specific version of Python. 2111 (<a href="http://b.android.com/36120">Issue 36120</a>) 2112 </li> 2113 <li>Fixed {@code ndk-gdb} when {@code APP_ABI} contains {@code all} and matchs none 2114 of the known architectures. 2115 (<a href="http://b.android.com/35392">Issue 35392</a>) 2116 </li> 2117 <li>Fixed Windows pathname support, by keeping the {@code :} character if it looks 2118 like it could be part of a Windows path starting with a drive letter. 2119 (<a href="http://sourceware.org/bugzilla/show_bug.cgi?id=12843">GDB Issue 12843</a>) 2120 </li> 2121 <li>Fixed adding of hardware breakpoint support for ARM in {@code gdbserver}. 2122 (<a href="http://sourceware.org/ml/gdb-patches/2011-09/msg00200.html">GDB Issue</a>) 2123 </li> 2124 <li>Added fix to only read the current {@code solibs} when the linker is consistent. 2125 This change speeds up {@code solib} event handling. 2126 (<a href="http://b.android.com/37677">Issue 37677</a>) 2127 </li> 2128 <li>Added fix to make repeated attempts to find {@code solib} breakpoints. GDB now 2129 retries {@code enable_break()} during every call to {@code svr4_current_sos()} until 2130 it succeeds. 2131 (<a href="https://android-review.googlesource.com/#/c/43563">Change 43563</a>)</li> 2132 <li>Fixed an issue where {@code gdb} would not stop on breakpoints placed in 2133 {@code dlopen-ed} libraries. 2134 (<a href="http://b.android.com/34856">Issue 34856</a>) 2135 </li> 2136 <li>Fixed {@code SIGILL} in dynamic linker when calling {@code dlopen()}, on system 2137 where {@code /system/bin/linker} is stripped of symbols and 2138 {@code rtld_db_dlactivity()} is implemented as {@code Thumb}, due to not preserving 2139 {@code LSB} of {@code sym_addr}. 2140 (<a href="http://b.android.com/37147">Issue 37147</a>) 2141 </li> 2142 </ul> 2143 </li> 2144 </ul> 2145 </dd> 2146 </dl> 2147 2148 <dl> 2149 <dt>Other bug fixes:</dt> 2150 2151 <dd> 2152 <ul> 2153 <li>Fixed NDK headers: 2154 <ul> 2155 <li>Fixed {@code arch-mips/include/asm/*} code that was incorrectly removed from 2156 original kernel. (<a href="https://android-review.googlesource.com/#/c/43335">Change 2157 43335</a>)</li> 2158 <li>Replaced struct member data {@code __unused} with {@code __linux_unused} in 2159 {@code linux/sysctl.h} and {@code linux/icmp.h} to avoid conflict with 2160 {@code #define __unused} in {@code sys/cdefs.h}.</li> 2161 <li>Fixed {@code fenv.h} for enclosed C functions with {@code __BEGIN_DECLS} and 2162 {@code __END_DECLS}.</li> 2163 <li>Removed unimplemented functions in {@code malloc.h}.</li> 2164 <li>Fixed {@code stdint.h} defintion of {@code uint64_t} for ANSI compilers. 2165 (<a href="http://b.android.com/1952">Issue 1952</a>)</li> 2166 <li>Fixed preprocessor macros in {@code <arch>/include/machine/*}.</li> 2167 <li>Replaced {@code link.h} for MIPS with new version supporting all platforms.</li> 2168 <li>Removed {@code linux-unistd.h}</li> 2169 <li>Move GLibc-specific macros {@code LONG_LONG_MIN}, {@code LONG_LONG_MAX} and 2170 {@code ULONG_LONG_MAX} from {@code <pthread.h>} to {@code 2171<limits.h>}.</li> 2172 </ul> 2173 </li> 2174 <li>Fixed a buffer overflow in {@code ndk-stack-parser}.</li> 2175 <li>Fixed {@code _STLP_USE_EXCEPTIONS}, when not defined, to omit all declarations 2176 and uses of {@code __Named_exception}. Compiling and use of {@code __Named_exception} 2177 settings only occurs when {@code STLport} is allowed to use exceptions.</li> 2178 <li>Fixed building of Linux-only NDK packages without also building Windows code. Use the 2179 following settings to perform this type of build: 2180 <pre>./build/tools/make-release.sh --force --systems=linux-x86</pre></li> 2181 <li>Fixed {@code libc.so} so it does not export {@code atexit()} and {@code __do_handler}. 2182 These symbols are exported for ARM builds by the system version of the C library to 2183 support legacy native libraries. NDK-generated should never reference them directly. 2184 Instead, each shared library or executable should embed its own version of these symbols, 2185 provided by {@code crtbegin_*.o}. 2186 <p>If your project is linked with the {@code -nostdlib -Wl,--no-undefined} options, you 2187 must provide your own {@code __dso_handle} because {@code crtbegin_so.o} is not linked in 2188 this case. The content of {@code __dso_handle} does not matter, as shown in the following 2189 example code:</p> 2190<pre> 2191extern "C" { 2192 extern void *__dso_handle __attribute__((__visibility__ ("hidden"))); 2193 void *__dso_handle; 2194} 2195</pre> 2196 </li> 2197 <li>Fixed symbol decoder for ARM used in {@code objdump} for {@code plt} entries to 2198 generate a more readable form {@code function@plt}.</li> 2199 <li>Removed the following symbols, introduced in GCC 4.6 {@code libgcc.a}, from 2200 the X86 platform {@code libc.so} library: {@code __aeabi_idiv0}, {@code __aeabi_ldiv0}, 2201 {@code __aeabi_unwind_cpp_pr1}, and {@code __aeabi_unwind_cpp_pr2}.</li> 2202 <li>Removed unused {@code .ctors}, {@code .dtors}, and {@code .eh_frame} in MIPS 2203 {@code crt*_so.S}.</li> 2204 <li>Updated {@code ndk-gdb} so that it only takes the last line of output for 2205 {@code ndk-build} {@code DUMP_XXXX}. This change ensures that if {@code Application.mk} or 2206 {@code Android.mk} print something with {@code $(info ...)} syntax, it does not get 2207 injected into the result of {@code DUMP_XXXX}. 2208 (<a href="https://groups.google.com/d/msg/android-ndk/-/ew0lTWGr1UEJ">More info</a>)</li> 2209 </ul> 2210 </dd> 2211 </dl> 2212 2213 <dl> 2214 <dt>Other changes:</dt> 2215 2216 <dd> 2217 <ul> 2218 <li>Removed {@code arch-x86} and {@code arch-mips} headers from 2219 {@code platforms/android-[3,4,5,8]}. Those headers were incomplete, since both X86 and 2220 MIPS ABIs are only supported at API 9 or higher.</li> 2221 <li>Simplified c++ include path in standalone packages, as shown below. 2222 (<a href="http://b.android.com/35279">Issue 35279</a>) 2223<pre> 2224<path>/arm-linux-androideabi/include/c++/4.6.x-google 2225 to: 2226<path>/include/c++/4.6/ 2227</pre></li> 2228 <li>Fixed {@code ndk-build} to recognize more C++ file extensions by default: 2229 {@code .cc .cp .cxx .cpp .CPP .c++ .C}. You may still use {@code LOCAL_CPP_EXTENSION} to 2230 overwrite these extension settings.</li> 2231 <li>Fixed an issue in {@code samples/san-angeles} that caused a black screen or freeze 2232 frame on re-launch.</li> 2233 <li>Replaced deprecated APIs in NDK samples. 2234 (<a href="http://b.android.com/20017">Issue 20017</a>) 2235 <ul> 2236 <li>{@code hello-gl2} from android-5 to android-7</li> 2237 <li>{@code native-activity} from android-9 to android-10</li> 2238 <li>{@code native-audio} from android-9 to android-10</li> 2239 <li>{@code native-plasma} from android-9 to android-10</li> 2240 </ul> 2241 </li> 2242 <li>Added new branding for Android executables with a simpler scheme in section 2243 {@code .note.android.ident} (defined in {@code crtbegin_static/dynamic.o}) so that 2244 debugging tools can act accordingly. The structure member and values are defined as 2245 follows: 2246<pre> 2247static const struct { 2248 int32_t namesz; /* = 8, sizeof ("Android") */ 2249 int32_t descsz; /* = 1 * sizeof(int32_t) */ 2250 int32_t type; /* = 1, ABI_NOTETYPE */ 2251 char name[sizeof "Android"]; /* = "Android" */ 2252 int32_t android_api; /* = 3, 4, 5, 8, 9, 14 */ 2253} 2254</pre> 2255 <p>The previous branding options in section {@code .note.ABI-tag} are deprecated.</p> 2256 </li> 2257 <li>Added a new script {@code run-tests-all.sh} which calls {@code run-tests.sh} and 2258 {@code standalone/run.sh} with various conditions. The script {@code run-tests.sh} runs 2259 without the {@code --abi} option, and is enhanced to compile most of the tests for all 2260 supported ABIs and run on all attached devices</li> 2261 </ul> 2262 </dd> 2263 </dl> 2264 2265 </div> 2266</div> 2267 2268<div class="toggle-content closed"> 2269 <p><a href="#" onclick="return toggleContent(this)"> 2270 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 2271 alt="">Android NDK, Revision 8b</a> <em>(July 2012)</em> 2272 </p> 2273 2274 <div class="toggle-content-toggleme"> 2275 <p>The main features of this release are a new GNU Compiler Collection (GCC) 4.6 toolchain and 2276GNU Debugger (GDB) 7.3.x which adds debugging support for the Android 4.1 (API Level 16) system 2277image.</p> 2278 2279 <dl> 2280 <dt>Important bug fixes:</dt> 2281 2282 <dd> 2283 <ul> 2284 <li>Fixed {@code LOCAL_SHORT_COMMANDS} issues on Mac OS, Windows Cygwin environments for 2285static libraries. List file generation is faster, and it is not regenerated to avoid repeated 2286project rebuilds.</li> 2287 <li>Fixed several issues in {@code ndk-gdb}: 2288 <ul> 2289 <li>Updated tool to pass flags {@code -e}, {@code -d} and {@code -s} to adb more 2290consistently.</li> 2291 <li>Updated tool to accept device serial names containing spaces.</li> 2292 <li>Updated tool to retrieve {@code /system/bin/link} information, so {@code gdb} on 2293the host can set a breakpoint in {@code __dl_rtld_db_dlactivity} and be aware of linker activity 2294(e.g., rescan {@code solib} symbols when {@code dlopen()} is called).</li> 2295 </ul> 2296 </li> 2297 <li>Fixed {@code ndk-build clean} on Windows, which was failing to remove 2298{@code ./libs/*/lib*.so}.</li> 2299 <li>Fixed {@code ndk-build.cmd} to return a non-zero {@code ERRORLEVEL} when {@code make} 2300fails.</li> 2301 <li>Fixed {@code libc.so} to stop incorrectly exporting the {@code __exidx_start} and 2302{@code __exidx_end} symbols.</li> 2303 <li>Fixed {@code SEGV} when unwinding the stack past {@code __libc_init} for ARM and 2304MIPS.</li> 2305 </ul> 2306 </dd> 2307 </dl> 2308 2309 <dl> 2310 <dt>Important changes:</dt> 2311 2312 <dd> 2313 <ul> 2314 <li>Added GCC 4.6 toolchain ({@code binutils} 2.21 with {@code gold} and GDB 7.3.x) to 2315co-exist with the original GCC 4.4.3 toolchain ({@code binutils} 2.19 and GDB 6.6). 2316 <ul> 2317 <li>GCC 4.6 is now the default toolchain. You may set {@code 2318NDK_TOOLCHAIN_VERSION=4.4.3} in {@code Application.mk} to select the original one.</li> 2319 <li>Support for the {@code gold} linker is only available for ARM and x86 2320architectures on Linux and Mac OS hosts. This support is disabled by default. Add {@code 2321LOCAL_LDLIBS += -fuse-ld=gold} in {@code Android.mk} to enable it.</li> 2322 <li>Programs compiled with {@code -fPIE} require the new {@code GDB} for debugging, 2323including binaries in Android 4.1 (API Level 16) system images.</li> 2324 <li>The {@code binutils} 2.21 {@code ld} tool contains back-ported fixes from 2325version 2.22: 2326 <ul> 2327 <li>Fixed {@code ld --gc-sections}, which incorrectly retains zombie references to 2328external libraries. (<a href="http://sourceware.org/bugzilla/show_bug.cgi?id=13177">more 2329info</a>).</li> 2330 <li>Fixed ARM {@code strip} command to preserve the original {@code p_align} and 2331{@code p_flags} in {@code GNU_RELRO} section if they are valid. Without this fix, programs 2332built with {@code -fPIE} could not be debugged. (<a 2333href="http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf.c.diff?cvsroot=src&r1=1.552&r2=1.553">mor 2334e info</a>)</li> 2335 </ul> 2336 </li> 2337 <li>Disabled {@code sincos()} optimization for compatibility with older 2338 platforms.</li> 2339 </ul> 2340 </li> 2341 2342 <li>Updated build options to enable the Never eXecute (NX) bit and {@code relro}/{@code 2343bind_now} protections by default: 2344 <ul> 2345 <li>Added {@code --noexecstack} to assembler and {@code -z noexecstack} to linker 2346that provides NX protection against buffer overflow attacks by enabling NX bit on stack and 2347heap.</li> 2348 <li>Added {@code -z relro} and {@code -z now} to linker for hardening of internal 2349data sections after linking to guard against security vulnerabilities caused by memory corruption. 2350(more info: <a href="http://www.akkadia.org/drepper/nonselsec.pdf">1</a>, 2351<a href="http://tk-blog.blogspot.com/2009/02/relro-not-so-well-known-memory.html">2</a>)</li> 2352 2353 <li>These features can be disabled using the following options: 2354 <ol> 2355 <li>Disable NX protection by setting the {@code --execstack} option for the 2356assembler and {@code -z execstack} for the linker.</li> 2357 <li>Disable hardening of internal data by setting the {@code -z norelro} and 2358{@code -z lazy} options for the linker.</li> 2359 <li>Disable these protections in the NDK {@code jni/Android.mk} by setting the 2360following options: 2361<pre> 2362LOCAL_DISABLE_NO_EXECUTE=true # disable "--noexecstack" and "-z noexecstack" 2363DISABLE_RELRO=true # disable "-z relro" and "-z now" 2364</pre> 2365 </li> 2366 </ol> 2367 <p>See {@code docs/ANDROID-MK.html} for more details.</p> 2368 </li> 2369 </ul> 2370 </li> 2371 2372 <li>Added branding for Android executables with the {@code .note.ABI-tag} section (in 2373{@code crtbegin_static/dynamic.o}) so that debugging tools can act accordingly. The structure 2374member and values are defined as follows: 2375<pre> 2376static const struct { 2377 int32_t namesz; /* = 4, sizeof ("GNU") */ 2378 int32_t descsz; /* = 6 * sizeof(int32_t) */ 2379 int32_t type; /* = 1 */ 2380 char name[sizeof "GNU"]; /* = "GNU" */ 2381 int32_t os; /* = 0 */ 2382 int32_t major; /* = 2 */ 2383 int32_t minor; /* = 6 */ 2384 int32_t teeny; /* = 15 */ 2385 int32_t os_variant; /* = 1 */ 2386 int32_t android_api; /* = 3, 4, 5, 8, 9, 14 */ 2387}</pre> 2388 </li> 2389 </ul> 2390 </dd> 2391 </dl> 2392 2393 <dl> 2394 <dt>Other bug fixes:</dt> 2395 2396 <dd> 2397 <ul> 2398 <li>Fixed {@code mips-linux-gnu} relocation truncated to fit {@code R_MIPS_TLS_LDM} issue. 2399 (<a href="http://sourceware.org/bugzilla/show_bug.cgi?id=12637">more info</a>)</li> 2400 <li>Fixed {@code ld} tool segfaults when using {@code --gc-sections}. 2401 (<a href="http://sourceware.org/bugzilla/show_bug.cgi?id=12845">more info</a>) 2402 </li> 2403 <li>Fixed MIPS {@code GOT_PAGE} counting issue. 2404 (<a href="http://sourceware.org/ml/binutils/2011-05/msg00198.html">more info</a>)</li> 2405 <li>Fixed follow warning symbol link for {@code mips_elf_count_got_symbols}.</li> 2406 <li>Fixed follow warning symbol link for {@code mips_elf_allocate_lazy_stub}.</li> 2407 <li>Moved MIPS {@code .dynamic} to the data segment, so that it is writable.</li> 2408 <li>Replaced hard-coded values for symbols with correct segment sizes for MIPS.</li> 2409 <li>Removed the {@code -mno-shared} option from the defaults in the MIPS toolchain. 2410The default for Android toolchain is {@code -fPIC} (or {@code -fpic} if supported). If you do not 2411explicitly specify {@code -mshared}, {@code -fpic}, {@code -fPIC}, {@code -fpie}, or {@code -fPIE}, 2412the MIPS compiler adds {@code -mno-shared} that turns off PIC. Fixed compiler not to add 2413{@code -mno-shared} in this case.</li> 2414 <li>Fixed wrong package names in samples {@code hello-jni} and {@code two-libs} so that 2415the {@code tests} project underneath it can compile.</li> 2416 </ul> 2417 </dd> 2418 </dl> 2419 2420 <dl> 2421 <dt>Other Changes:</dt> 2422 2423 <dd> 2424 <ul> 2425 <li>Changed locations of binaries: 2426 <ul> 2427 <li>Moved {@code gdbserver} from 2428{@code toolchain/<arch-os-ver>/prebuilt/gdbserver} to 2429{@code prebuilt/android-<arch>/gdbserver/gdbserver}.</li> 2430 <li>Renamed x86 toolchain prefix from {@code i686-android-linux-} to 2431{@code i686-linux-android-}.</li> 2432 <li>Moved {@code sources/cxx-stl/gnu-libstdc++/include} and {@code lib} to 2433{@code sources/cxx-stl/gnu-libstdc++/4.6} when compiled with GCC 4.6, or 2434{@code sources/cxx-stl/gnu-libstdc++/4.4.3} when compiled with GCC 4.4.3.</li> 2435 <li>Moved {@code libbfd.a} and {@code libintl.a} from {@code lib/} to {@code 2436lib32/}.</li> 2437 </ul> 2438 </li> 2439 2440 <li>Added and improved various scripts in the rebuild and test NDK toolchain: 2441 <ul> 2442 <li>Added {@code build-mingw64-toolchain.sh} to generate a new Linux-hosted toolchain 2443that generates Win32 and Win64 executables.</li> 2444 <li>Improved speed of {@code download-toolchain-sources.sh} by using the {@code 2445clone} command and only using {@code checkout} for the directories that are needed to build the NDK 2446toolchain binaries.</li> 2447 <li>Added {@code build-host-gcc.sh} and {@code build-host-gdb.sh} scripts.</li> 2448 <li>Added {@code tests/check-release.sh} to check the content of a given NDK 2449installation directory, or an existing NDK package.</li> 2450 <li>Rewrote the {@code tests/standalone/run.sh} standalone tests .</li> 2451 </ul> 2452 </li> 2453 <li>Removed {@code if_dl.h} header from all platforms and architectures. The {@code 2454AF_LINK} and {@code sockaddr_dl} elements it describes are specific to BSD (i.e., they don't exist 2455in Linux).</li> 2456 </ul> 2457 </dd> 2458 </dl> 2459 2460 </div> 2461</div> 2462 2463<div class="toggle-content closed"> 2464 <p><a href="#" onclick="return toggleContent(this)"> 2465 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 2466 alt="">Android NDK, Revision 8</a> <em>(May 2012)</em> 2467 </p> 2468 2469 <div class="toggle-content-toggleme"> 2470 <p>This release of the NDK includes support for MIPS ABI and a few additional fixes.</p> 2471 2472 <dl> 2473 <dt>New features:</dt> 2474 2475 <dd> 2476 <ul> 2477 <li>Added support for the MIPS ABI, which allows you to generate machine code that runs on 2478 compatible MIPS-based Android devices. Major features for MIPS include MIPS-specific 2479 toolchains, system headers, libraries and debugging support. For more details regarding 2480 MIPS support, see {@code docs/CPU-MIPS.html} in the NDK package. 2481 2482 <p>By default, code is generated for ARM-based devices. You can add {@code mips} to 2483 your {@code APP_ABI} definition in your {@code Application.mk} file to build 2484 for MIPS platforms. For example, the following line instructs {@code ndk-build} 2485 to build your code for three distinct ABIs:</p> 2486 2487 <pre>APP_ABI := armeabi armeabi-v7a <strong>mips</strong></pre> 2488 2489 <p>Unless you rely on architecture-specific assembly sources, such as ARM assembly 2490 code, you should not need to touch your {@code Android.mk} files to build MIPS 2491 machine code.</p> 2492 </li> 2493 2494 <li>You can build a standalone MIPS toolchain using the {@code --arch=mips} 2495 option when calling <code>make-standalone-toolchain.sh</code>. See 2496 {@code docs/STANDALONE-TOOLCHAIN.html} for more details. 2497 </li> 2498 </ul> 2499 2500 <p class="note"><strong>Note:</strong> To ensure that your applications are available 2501to users only if their devices are capable of running them, Google Play filters applications based 2502on the instruction set information included in your application ? no action is needed on your part 2503to enable the filtering. Additionally, the Android system itself also checks your application at 2504install time and allows the installation to continue only if the application provides a library that 2505is compiled for the device's CPU architecture.</p> 2506 </dd> 2507 2508 <dt>Important bug fixes:</dt> 2509 2510 <dd> 2511 <ul> 2512 <li>Fixed a typo in GAbi++ implementation where the result of {@code 2513 dynamic_cast<D>(b)} of base class object {@code b} to derived class {@code D} is 2514 incorrectly adjusted in the opposite direction from the base class. 2515 (<a href="http://b.android.com/28721">Issue 28721</a>) 2516 </li> 2517 <li>Fixed an issue in which {@code make-standalone-toolchain.sh} fails to copy 2518 {@code libsupc++.*}.</li> 2519 </ul> 2520 </dd> 2521 2522 <dt>Other bug fixes:</dt> 2523 2524 <dd> 2525 <ul> 2526 <li>Fixed {@code ndk-build.cmd} to ensure that {@code ndk-build.cmd} works correctly even 2527 if the user has redefined the {@code SHELL} environment variable, which may be changed 2528 when installing a variety of development tools in Windows environments. 2529 </li> 2530 </ul> 2531 </dd> 2532 </dl> 2533 </div> 2534</div> 2535 2536<div class="toggle-content closed"> 2537 <p><a href="#" onclick="return toggleContent(this)"> 2538 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 2539 alt="">Android NDK, Revision 7c</a> <em>(April 2012)</em> 2540 </p> 2541 2542 <div class="toggle-content-toggleme"> 2543 <p>This release of the NDK includes an important fix for Tegra2-based devices, and a few 2544additional fixes and improvements:</p> 2545 2546 <dl> 2547 <dt>Important bug fixes:</dt> 2548 2549 <dd> 2550 <ul> 2551 <li>Fixed GNU STL armeabi-v7a binaries to not crash on non-NEON 2552 devices. The files provided with NDK r7b were not configured properly, 2553 resulting in crashes on Tegra2-based devices and others when trying to use 2554 certain floating-point functions (e.g., {@code cosf}, {@code sinf}, {@code expf}).</li> 2555 </ul> 2556 </dd> 2557 2558 <dt>Important changes:</dt> 2559 2560 <dd> 2561 <ul> 2562 <li>Added support for custom output directories through the {@code NDK_OUT} 2563 environment variable. When defined, this variable is used to store all 2564 intermediate generated files, instead of {@code $PROJECT_PATH/obj}. The variable is 2565 also recognized by {@code ndk-gdb}. </li> 2566 <li>Added support for building modules with hundreds or even thousands of source 2567 files by defining {@code LOCAL_SHORT_COMMANDS} to {@code true} in your {@code Android.mk}. 2568 <p>This change forces the NDK build system to put most linker or archiver options 2569 into list files, as a work-around for command-line length limitations. 2570 See {@code docs/ANDROID-MK.html} for details.</p> 2571 </li> 2572 </ul> 2573 </dd> 2574 2575 <dt>Other bug fixes:</dt> 2576 2577 <dd> 2578 <ul> 2579 <li>Fixed {@code android_getCpuCount()} implementation in the {@code cpufeatures} 2580helper library. On certain devices, where cores are enabled dynamically by the system, the previous 2581implementation would report the total number of <em>active</em> cores the first time the function 2582was called, rather than the total number of <em>physically available</em> cores.</li> 2583 </ul> 2584 </dd> 2585 </dl> 2586 </div> 2587</div> 2588 2589 2590<div class="toggle-content closed"> 2591 <p><a href="#" onclick="return toggleContent(this)"> 2592 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 2593 alt="">Android NDK, Revision 7b</a> <em>(February 2012)</em> 2594 </p> 2595 2596 <div class="toggle-content-toggleme"> 2597 <p>This release of the NDK includes fixes for native Windows builds, Cygwin and many other 2598 improvements:</p> 2599 2600 <dl> 2601 <dt>Important bug fixes:</dt> 2602 2603 <dd> 2604 <ul> 2605 <li>Updated {@code sys/atomics.h} to avoid correctness issues 2606 on some multi-core ARM-based devices. Rebuild your unmodified sources with this 2607 version of the NDK and this problem should be completely eliminated. 2608 For more details, read {@code docs/ANDROID-ATOMICS.html}.</li> 2609 <li>Reverted to {@code binutils} 2.19 to fix debugging issues that 2610 appeared in NDK r7 (which switched to {@code binutils} 2.20.1).</li> 2611 <li>Fixed {@code ndk-build} on 32-bit Linux. A packaging error put a 64-bit version 2612 of the {@code awk} executable under {@code prebuilt/linux-x86/bin} in NDK r7.</li> 2613 <li>Fixed native Windows build ({@code ndk-build.cmd}). Other build modes were not 2614 affected. The fixes include: 2615 <ul> 2616 <li>Removed an infinite loop / stack overflow bug that happened when trying 2617 to call {@code ndk-build.cmd} from a directory that was <em>not</em> the top of 2618 your project path (e.g., in any sub-directory of it).</li> 2619 <li>Fixed a problem where the auto-generated dependency files were ignored. This 2620 meant that updating a header didn't trigger recompilation of sources that included 2621 it.</li> 2622 <li>Fixed a problem where special characters in files or paths, other than spaces and 2623 quotes, were not correctly handled.</li> 2624 </ul> 2625 </li> 2626 <li>Fixed the standalone toolchain to generate proper binaries when using 2627 {@code -lstdc++} (i.e., linking against the GNU {@code libstdc++} C++ runtime). You 2628 should use {@code -lgnustl_shared} if you want to link against the shared library 2629 version or {@code -lstdc++} for the static version. 2630 2631 <p>See {@code docs/STANDALONE-TOOLCHAIN.html} for more details about this fix.</p> 2632 </li> 2633 <li>Fixed {@code gnustl_shared} on Cygwin. The linker complained that it couldn't find 2634 {@code libsupc++.a} even though the file was at the right location.</li> 2635 <li>Fixed Cygwin C++ link when not using any specific C++ runtime through 2636 {@code APP_STL}.</li> 2637 </ul> 2638 </dd> 2639 </dl> 2640 2641 <dl> 2642 <dt>Other changes:</dt> 2643 2644 <dd> 2645 <ul> 2646 <li>When your application uses the GNU {@code libstdc++} runtime, the compiler will 2647 no longer forcibly enable exceptions and RTTI. This change results in smaller code. 2648 <p>If you need these features, you must do one of the following:</p> 2649 <ul> 2650 <li>Enable exceptions and/or RTTI explicitly in your modules or 2651 {@code Application.mk}. (recommended)</li> 2652 <li>Define {@code APP_GNUSTL_FORCE_CPP_FEATURES} to {@code 'exceptions'}, 2653 {@code 'rtti'} or both in your {@code Application.mk}. See 2654 {@code docs/APPLICATION-MK.html} for more details.</li> 2655 </ul> 2656 </li> 2657 <li>{@code ndk-gdb} now works properly when your application has private services 2658 running in independent processes. It debugs the main application process, instead of the 2659 first process listed by {@code ps}, which is usually a service process.</li> 2660 <li>Fixed a rare bug where NDK r7 would fail to honor the {@code LOCAL_ARM_MODE} value 2661 and always compile certain source files (but not all) to 32-bit instructions.</li> 2662 <li>{@code STLport}: Refresh the sources to match the Android platform version. This 2663 update fixes a few minor bugs: 2664 <ul> 2665 <li>Fixed instantiation of an incomplete type</li> 2666 <li>Fixed minor "==" versus "=" typo</li> 2667 <li>Used {@code memmove} instead of {@code memcpy} in {@code string::assign}</li> 2668 <li>Added better handling of {@code IsNANorINF}, {@code IsINF}, {@code IsNegNAN}, 2669 etc.</li> 2670 </ul> 2671 <p>For complete details, see the commit log.</p> 2672 </li> 2673 <li>{@code STLport}: Removed 5 unnecessary static initializers from the library.</li> 2674 <li>The GNU libstdc++ libraries for armeabi-v7a were mistakenly compiled for 2675 armeabi instead. This change had no impact on correctness, but using the right 2676 ABI should provide slightly better performance.</li> 2677 <li>The {@code cpu-features} helper library was updated to report three optional 2678 x86 CPU features ({@code SSSE3}, {@code MOVBE} and {@code POPCNT}). See 2679 {@code docs/CPU-FEATURES.html} for more details.</li> 2680 <li>{@code docs/NDK-BUILD.html} was updated to mention {@code NDK_APPLICATION_MK} instead 2681 of {@code NDK_APP_APPLICATION_MK} to select a custom {@code Application.mk} file.</li> 2682 <li>Cygwin: {@code ndk-build} no longer creates an empty "NUL" file in the current 2683 directory when invoked.</li> 2684 <li>Cygwin: Added better automatic dependency detection. In the previous version, it 2685 didn't work properly in the following cases: 2686 <ul> 2687 <li>When the Cygwin drive prefix was not {@code /cygdrive}.</li> 2688 <li>When using drive-less mounts, for example, when Cygwin would translate 2689 {@code /home} to {@code \\server\subdir} instead of {@code C:\Some\Dir}.</li> 2690 </ul> 2691 </li> 2692 <li>Cygwin: {@code ndk-build} does not try to use the native Windows tools under 2693 {@code $NDK/prebuilt/windows/bin} with certain versions of Cygwin and/or GNU Make.</li> 2694 </ul> 2695 </dd> 2696 </dl> 2697 </div> 2698</div> 2699 2700 2701<div class="toggle-content closed"> 2702 <p><a href="#" onclick="return toggleContent(this)"> 2703 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 2704 alt="">Android NDK, Revision 7</a> <em>(November 2011)</em> 2705 </p> 2706 2707 <div class="toggle-content-toggleme"> 2708 <p>This release of the NDK includes new features to support the Android 4.0 platform as well 2709 as many other additions and improvements:</p> 2710 2711 <dl> 2712 <dt>New features</dt> 2713 2714 <dd> 2715 <ul> 2716 <li>Added official NDK APIs for Android 4.0 (API level 14), which adds the following 2717 native features to the platform: 2718 2719 <ul> 2720 <li>Added native multimedia API based on the Khronos Group OpenMAX AL? 1.0.1 2721 standard. The new <code><OMXAL/OpenMAXAL.h></code> and 2722 <code><OMXAL/OpenMAXAL_Android.h></code> headers allow applications targeting 2723 API level 14 to perform multimedia output directly from native code by using a new 2724 Android-specific buffer queue interface. For more details, see 2725 <code>docs/openmaxal/index.html</code> and <a href= 2726 "http://www.khronos.org/openmax/">http://www.khronos.org/openmax/</a>.</li> 2727 2728 <li>Updated the native audio API based on the Khronos Group OpenSL ES 1.0.1? 2729 standard. With API Level 14, you can now decode compressed audio (e.g. MP3, AAC, 2730 Vorbis) to PCM. For more details, see <code>docs/opensles/index.html</code> and 2731 <a href= 2732 "http://www.khronos.org/opensles">http://www.khronos.org/opensles/</a>.</li> 2733 </ul> 2734 </li> 2735 2736 <li>Added CCache support. To speed up large rebuilds, define the 2737 <code>NDK_CCACHE</code> environment variable to <code>ccache</code> (or the path to 2738 your <code>ccache</code> binary). When declared, the NDK build system automatically 2739 uses CCache when compiling any source file. For example: 2740 <pre> 2741export NDK_CCACHE=ccache 2742</pre> 2743 <p class="note"><strong>Note:</strong> CCache is not included in the NDK release 2744 so you must have it installed prior to using it. For more information about CCache, see 2745 <a href="http://ccache.samba.org">http://ccache.samba.org</a>.</p> 2746 </li> 2747 2748 <li>Added support for setting <code>APP_ABI</code> to <code>all</code> to indicate that 2749 you want to build your NDK modules for all the ABIs supported by your given NDK 2750 release. This means that either one of the following two lines in your 2751 <code>Application.mk</code> are equivalent with this release: 2752 <pre> 2753APP_ABI := all 2754APP_ABI := armeabi armeabi-v7a x86 2755</pre> 2756 2757 <p>This also works if you define <code>APP_ABI</code> when calling 2758 <code>ndk-build</code> from the command-line, which is a quick way to check that your 2759 project builds for all supported ABIs without changing the project's 2760 <code>Application.mk file</code>. For example:</p> 2761 <pre> 2762ndk-build APP_ABI=all 2763</pre> 2764 </li> 2765 2766 <li>Added a <code>LOCAL_CPP_FEATURES</code> variable in <code>Android.mk</code> that 2767 allows you to declare which C++ features (RTTI or Exceptions) your module uses. This 2768 ensures that the final linking works correctly if you have prebuilt modules that depend 2769 on these features. See <code>docs/ANDROID-MK.html</code> and 2770 <code>docs/CPLUSPLUS-SUPPORT.html</code> for more details.</li> 2771 2772 <li>Shortened paths to source and object files that are used in build commands. When 2773 invoking <code>$NDK/ndk-build</code> from your project path, the paths to the source, 2774 object, and binary files that are passed to the build commands are significantly 2775 shorter now, because they are passed relative to the current directory. This is useful 2776 when building projects with a lot of source files, to avoid limits on the maximum 2777 command line length supported by your host operating system. The behavior is unchanged 2778 if you invoke <code>ndk-build</code> from a sub-directory of your project tree, or if 2779 you define <code>NDK_PROJECT_PATH</code> to point to a specific directory.</li> 2780 </ul> 2781 </dd> 2782 2783 <dt>Experimental features</dt> 2784 2785 <dd> 2786 You can now build your NDK source files on Windows <em>without</em> Cygwin by calling the 2787 <code>ndk-build.cmd</code> script from the command line from your project path. The 2788 script takes exactly the same arguments as the original <code>ndk-build</code> script. 2789 The Windows NDK package comes with its own prebuilt binaries for GNU Make, Awk and other 2790 tools required by the build. You should not need to install anything else to get a 2791 working build system. 2792 2793 <p class="caution"><strong>Important:</strong> <code>ndk-gdb</code> does not work on 2794 Windows, so you still need Cygwin to debug.</p> 2795 2796 <p>This feature is still experimental, so feel free to try it and report issues on the 2797 <a href="http://b.android.com">public bug database</a> or <a href= 2798 "http://groups.google.com/group/android-ndk">public forum</a>. All samples and unit tests 2799 shipped with the NDK succesfully compile with this feature.</p> 2800 </dd> 2801 2802 <dt>Important bug fixes</dt> 2803 2804 <dd> 2805 <ul> 2806 <li>Imported shared libraries are now installed by default to the target installation 2807 location (<code>libs/<abi></code>) if <code>APP_MODULES</code> is not defined in 2808 your <code>Application.mk</code>. For example, if a top-level module <code>foo</code> 2809 imports a module <code>bar</code>, then both <code>libfoo.so</code> and 2810 <code>libbar.so</code> are copied to the install location. Previously, only 2811 <code>libfoo.so</code> was copied, unless you listed <code>bar</code> in your 2812 <code>APP_MODULES</code> too. If you define <code>APP_MODULES</code> explicitly, the 2813 behavior is unchanged.</li> 2814 2815 <li><code>ndk-gdb</code> now works correctly for activities with multiple categories in 2816 their MAIN intent filters.</li> 2817 2818 <li>Static library imports are now properly transitive. For example, if a top-level 2819 module <code>foo</code> imports static library <code>bar</code> that imports static 2820 library <code>zoo</code>, the <code>libfoo.so</code> will now be linked against both 2821 <code>libbar.a</code> and <code>libzoo.a</code>.</li> 2822 </ul> 2823 </dd> 2824 2825 <dt>Other changes</dt> 2826 2827 <dd> 2828 <ul> 2829 <li><code>docs/NATIVE-ACTIVITY.HTML</code>: Fixed typo. The minimum API level should be 2830 9, not 8 for native activities.</li> 2831 2832 <li><code>docs/STABLE-APIS.html</code>: Added missing documentation listing EGL as a 2833 supported stable API, starting from API level 9.</li> 2834 2835 <li><code>download-toolchain-sources.sh</code>: Updated to download the toolchain 2836 sources from <a href="http://android.googlesource.com">android.googlesource.com</a>, 2837 which is the new location for the AOSP servers.</li> 2838 2839 <li>Added a new C++ support runtime named <code>gabi++</code>. More details about it 2840 are available in the updated <code>docs/CPLUSPLUS-SUPPORT.html</code>.</li> 2841 2842 <li>Added a new C++ support runtime named <code>gnustl_shared</code> that corresponds 2843 to the shared library version of GNU libstdc++ v3 (GPLv3 license). See more info at 2844 <code>docs/CPLUSPLUS-SUPPORT.html</code></li> 2845 2846 <li>Added support for RTTI in the STLport C++ runtimes (no support for 2847 exceptions).</li> 2848 2849 <li>Added support for multiple file extensions in <code>LOCAL_CPP_EXTENSION</code>. For 2850 example, to compile both <code>foo.cpp</code> and <code>bar.cxx</code> as C++ sources, 2851 declare the following: 2852 <pre> 2853LOCAL_CPP_EXTENSION := .cpp .cxx 2854</pre> 2855 </li> 2856 2857 <li>Removed many unwanted exported symbols from the link-time shared system libraries 2858 provided by the NDK. This ensures that code generated with the standalone toolchain 2859 doesn't risk to accidentally depend on a non-stable ABI symbol (e.g. any libgcc.a 2860 symbol that changes each time the toolchain used to build the platform is changed)</li> 2861 2862 <li>Refreshed the EGL and OpenGLES Khronos headers to support more extensions. Note 2863 that this does <em>not</em> change the NDK ABIs for the corresponding libraries, 2864 because each extension must be probed at runtime by the client application. 2865 2866 <p>The extensions that are available depend on your actual device and GPU drivers, 2867 not the platform version the device runs on. The header changes simply add new 2868 constants and types to make it easier to use the extensions when they have been 2869 probed with <code>eglGetProcAddress()</code> or <code>glGetProcAddress()</code>. The 2870 following list describes the newly supported extensions:</p> 2871 2872 <dl> 2873 <dt>GLES 1.x</dt> 2874 2875 <dd> 2876 <ul> 2877 <li><code>GL_OES_vertex_array_object</code></li> 2878 2879 <li><code>GL_OES_EGL_image_external</code></li> 2880 2881 <li><code>GL_APPLE_texture_2D_limited_npot</code></li> 2882 2883 <li><code>GL_EXT_blend_minmax</code></li> 2884 2885 <li><code>GL_EXT_discard_framebuffer</code></li> 2886 2887 <li><code>GL_EXT_multi_draw_arrays</code></li> 2888 2889 <li><code>GL_EXT_read_format_bgra</code></li> 2890 2891 <li><code>GL_EXT_texture_filter_anisotropic</code></li> 2892 2893 <li><code>GL_EXT_texture_format_BGRA8888</code></li> 2894 2895 <li><code>GL_EXT_texture_lod_bias</code></li> 2896 2897 <li><code>GL_IMG_read_format</code></li> 2898 2899 <li><code>GL_IMG_texture_compression_pvrtc</code></li> 2900 2901 <li><code>GL_IMG_texture_env_enhanced_fixed_function</code></li> 2902 2903 <li><code>GL_IMG_user_clip_plane</code></li> 2904 2905 <li><code>GL_IMG_multisampled_render_to_texture</code></li> 2906 2907 <li><code>GL_NV_fence</code></li> 2908 2909 <li><code>GL_QCOM_driver_control</code></li> 2910 2911 <li><code>GL_QCOM_extended_get</code></li> 2912 2913 <li><code>GL_QCOM_extended_get2</code></li> 2914 2915 <li><code>GL_QCOM_perfmon_global_mode</code></li> 2916 2917 <li><code>GL_QCOM_writeonly_rendering</code></li> 2918 2919 <li><code>GL_QCOM_tiled_rendering</code></li> 2920 </ul> 2921 </dd> 2922 2923 <dt>GLES 2.0</dt> 2924 2925 <dd> 2926 <ul> 2927 <li><code>GL_OES_element_index_uint</code></li> 2928 2929 <li><code>GL_OES_get_program_binary</code></li> 2930 2931 <li><code>GL_OES_mapbuffer</code></li> 2932 2933 <li><code>GL_OES_packed_depth_stencil</code></li> 2934 2935 <li><code>GL_OES_texture_3D</code></li> 2936 2937 <li><code>GL_OES_texture_float</code></li> 2938 2939 <li><code>GL_OES_texture_float_linear</code></li> 2940 2941 <li><code>GL_OES_texture_half_float_linear</code></li> 2942 2943 <li><code>GL_OES_texture_npot</code></li> 2944 2945 <li><code>GL_OES_vertex_array_object</code></li> 2946 2947 <li><code>GL_OES_EGL_image_external</code></li> 2948 2949 <li><code>GL_AMD_program_binary_Z400</code></li> 2950 2951 <li><code>GL_EXT_blend_minmax</code></li> 2952 2953 <li><code>GL_EXT_discard_framebuffer</code></li> 2954 2955 <li><code>GL_EXT_multi_draw_arrays</code></li> 2956 2957 <li><code>GL_EXT_read_format_bgra</code></li> 2958 2959 <li><code>GL_EXT_texture_format_BGRA8888</code></li> 2960 2961 <li><code>GL_EXT_texture_compression_dxt1</code></li> 2962 2963 <li><code>GL_IMG_program_binary</code></li> 2964 2965 <li><code>GL_IMG_read_format</code></li> 2966 2967 <li><code>GL_IMG_shader_binary</code></li> 2968 2969 <li><code>GL_IMG_texture_compression_pvrtc</code></li> 2970 2971 <li><code>GL_IMG_multisampled_render_to_texture</code></li> 2972 2973 <li><code>GL_NV_coverage_sample</code></li> 2974 2975 <li><code>GL_NV_depth_nonlinear</code></li> 2976 2977 <li><code>GL_QCOM_extended_get</code></li> 2978 2979 <li><code>GL_QCOM_extended_get2</code></li> 2980 2981 <li><code>GL_QCOM_writeonly_rendering</code></li> 2982 2983 <li><code>GL_QCOM_tiled_rendering</code></li> 2984 </ul> 2985 </dd> 2986 2987 <dt>EGL</dt> 2988 2989 <dd> 2990 <ul> 2991 <li><code>EGL_ANDROID_recordable</code></li> 2992 2993 <li><code>EGL_NV_system_time</code></li> 2994 </ul> 2995 </dd> 2996 </dl> 2997 </li> 2998 </ul> 2999 </dd> 3000 </dl> 3001 </div> 3002</div> 3003 3004 3005<div class="toggle-content closed"> 3006 <p><a href="#" onclick="return toggleContent(this)"> 3007 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 3008 alt="">Android NDK, Revision 6b</a> <em>(August 2011)</em> 3009 </p> 3010 3011 <div class="toggle-content-toggleme"> 3012 <p>This release of the NDK does not include any new features compared to r6. The r6b release 3013 addresses the following issues in the r6 release:</p> 3014 <dl> 3015 <dt>Important bug fixes</dt> 3016 <dd> 3017 <ul> 3018 <li>Fixed the build when <code>APP_ABI="armeabi x86"</code> is used for 3019 multi-architecture builds.</li> 3020 <li>Fixed the location of prebuilt STLport binaries in the NDK release package. 3021 A bug in the packaging script placed them in the wrong location.</li> 3022 <li>Fixed <code>atexit()</code> usage in shared libraries with the x86standalone 3023 toolchain.</li> 3024 <li>Fixed <code>make-standalone-toolchain.sh --arch=x86</code>. It used to fail 3025 to copy the proper GNU libstdc++ binaries to the right location.</li> 3026 <li>Fixed the standalone toolchain linker warnings about missing the definition and 3027 size for the <code>__dso_handle</code> symbol (ARM only).</li> 3028 <li>Fixed the inclusion order of <code>$(SYSROOT)/usr/include</code> for x86 builds. 3029 See the <a href="http://b.android.com/18540">bug</a> for 3030 more information.</li> 3031 <li>Fixed the definitions of <code>ptrdiff_t</code> and <code>size_t</code> in 3032 x86-specific systems when they are used with the x86 standalone toolchain.</li> 3033 </ul> 3034 </dd> 3035 </dl> 3036 </div> 3037</div> 3038 3039<div class="toggle-content closed"> 3040 <p><a href="#" onclick="return toggleContent(this)"> 3041 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 3042 alt="">Android NDK, Revision 6</a> <em>(July 2011)</em> 3043 </p> 3044 3045 <div class="toggle-content-toggleme"> 3046 <p>This release of the NDK includes support for the x86 ABI and other minor changes. 3047 For detailed information describing the changes in this release, read the 3048 <code>CHANGES.HTML</code> document included in the NDK package. 3049 </p> 3050 <dl> 3051 <dt>General notes:</dt> 3052 <dd> 3053 <ul> 3054 <li>Adds support for the x86 ABI, which allows you to generate machine code 3055 that runs on compatible x86-based Android devices. Major features for x86 3056 include x86-specific toolchains, system headers, libraries and 3057 debugging support. For all of the details regarding x86 support, 3058 see <code>docs/CPU-X86.html</code> in the NDK package. 3059 3060 <p>By default, code is generated for ARM-based devices, but you can add x86 to your 3061 <code>APP_ABI</code> definition in your <code>Application.mk</code> file to build 3062 for x86 platforms. For example, the following line instructs <code>ndk-build</code> 3063 to build your code for three distinct ABIs:</p> 3064 3065 <pre>APP_ABI := armeabi armeabi-v7a x86</pre> 3066 3067 <p>Unless you rely on ARM-based assembly sources, you shouldn't need to touch 3068 your <code>Android.mk</code> files to build x86 machine code.</p> 3069 3070 </li> 3071 3072 <li>You can build a standalone x86 toolchain using the 3073<code>--toolchain=x86-4.4.3</code> 3074 option when calling <code>make-standalone-toolchain.sh</code>. See 3075 <code>docs/STANDALONE-TOOLCHAIN.html</code> for more details. 3076 </li> 3077 <li>The new <code>ndk-stack</code> tool lets you translate stack traces in 3078 <code>logcat</code> that are generated by native code. The tool translates 3079 instruction addresses into a readable format that contains things such 3080 as the function, source file, and line number corresponding to each stack frame. 3081 For more information and a usage example, see <code>docs/NDK-STACK.html</code>. 3082 </li> 3083 </ul> 3084 </dd> 3085 <dt>Other changes:</dt> 3086 <dd><code>arm-eabi-4.4.0</code>, which had been deprecated since NDK r5, has been 3087 removed from the NDK distribution.</dd> 3088 3089 </dl> 3090 </div> 3091 </div> 3092 3093<div class="toggle-content closed"> 3094 <p><a href="#" onclick="return toggleContent(this)"> 3095 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 3096 alt="">Android NDK, Revision 5c</a> <em>(June 2011)</em> 3097 </p> 3098 3099 <div class="toggle-content-toggleme"> 3100 <p>This release of the NDK does not include any new features compared to r5b. The r5c release 3101 addresses the following problems in the r5b release:</p> 3102 <dl> 3103 <dt>Important bug fixes:</dt> 3104 <dd> 3105 <ul> 3106 <li><code>ndk-build</code>: Fixed a rare bug that appeared when trying to perform parallel 3107 builds of debuggable projects.</li> 3108 3109 <li>Fixed a typo that prevented <code>LOCAL_WHOLE_STATIC_LIBRARIES</code> to work 3110 correctly with the new toolchain and added documentation for this in 3111 <code>docs/ANDROID-MK.html</code>.</li> 3112 3113 <li>Fixed a bug where code linked against <code>gnustl_static</code> crashed when run on 3114 platform releases older than API level 8 (Android 2.2).</li> 3115 3116 <li><code>ndk-gdb</code>: Fixed a bug that caused a segmentation fault when debugging 3117Android 3.0 3118 or newer devices.</li> 3119 3120 <li><code><android/input.h></code>: Two functions that were introduced in API level 3121 9 (Android 2.3) were incorrect and are fixed. While this breaks the source API, the 3122 binary interface to the system is unchanged. The incorrect functions were missing a 3123 <code>history_index</code> parameter, and the correct definitions are shown below: 3124<pre> 3125float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, 3126 size_t pointer_index, 3127 size_t history_index); 3128 3129float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, 3130 size_t pointer_index, 3131 size_t history_index); 3132</pre> 3133 </li> 3134 3135 <li>Updated the C library ARM binary for API level 9 (Android 2.3) to correctly expose at 3136 link time new functions that were added in that API level (for example, 3137 <code>pthread_rwlock_init</code>).</li> 3138 3139 </ul> 3140 </dd> 3141 3142 <dt>Minor improvements and fixes:</dt> 3143 <dd> 3144 <ul> 3145 <li>Object files are now always linked in the order they appear in 3146 <code>LOCAL_SRC_FILES</code>. This was not the case previously because the files were 3147 grouped by source extensions instead.</li> 3148 3149 <li>When <code>import-module</code> fails, it now prints the list of directories that 3150 were searched. This is useful to check that the <code>NDK_MODULE_PATH</code> definition 3151 used by the build system is correct.</li> 3152 3153 <li>When <code>import-module</code> succeeds, it now prints the directory where the 3154 module was found to the log (visible with <code>NDK_LOG=1</code>).</li> 3155 3156 <li>Increased the build speed of debuggable applications when there is a very large number 3157 of include directories in the project.</li> 3158 3159 <li><code>ndk-gdb</code>: Better detection of <code>adb shell</code> failures and improved 3160 error messages.</li> 3161 3162 <li><code><pthread.h></code>: Fixed the definition of 3163 <code>PTHREAD_RWLOCK_INITIALIZER</code> for API level 9 (Android 2.3) and higher.</li> 3164 3165 <li>Fixed an issue where a module could import itself, resulting in an infinite loop in 3166 GNU Make.</li> 3167 3168 <li>Fixed a bug that caused the build to fail if <code>LOCAL_ARM_NEON</code> was set to 3169 true (typo in <code>build/core/build-binary.mk</code>).</li> 3170 3171 <li>Fixed a bug that prevented the compilation of <code>.s</code> assembly files 3172 (<code>.S</code> files were okay).</li> 3173 </ul> 3174 </dd> 3175 </dl> 3176 </div> 3177</div> 3178 3179<div class="toggle-content closed"> 3180 <p><a href="#" onclick="return toggleContent(this)"> 3181 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 3182 alt="">Android NDK, Revision 5b</a> <em>(January 2011)</em> 3183 </p> 3184 3185 <div class="toggle-content-toggleme"> 3186 <p>This release of the NDK does not include any new features compared to r5. The r5b release 3187addresses the 3188 following problems in the r5 release: 3189 </p> 3190 <ul> 3191 <li>The r5 binaries required glibc 2.11, but the r5b binaries are generated with a special 3192 toolchain that targets glibc 2.7 or higher instead. The Linux toolchain binaries now run on 3193Ubuntu 8.04 or higher. </li> 3194 <li>Fixes a compiler bug in the arm-linux-androideabi-4.4.3 toolchain. 3195 The previous binary generated invalid thumb instruction sequences when 3196 dealing with signed chars.</li> 3197 <li>Adds missing documentation for the 3198 "gnustl_static" value for APP_STL, that allows you to link against 3199 a static library version of GNU libstdc++. </li> the 3200 <li>Fixed the following <code>ndk-build</code> issues: 3201 <ul> 3202 <li>A bug that created inconsistent dependency files when a 3203 compilation error occured on Windows. This prevented a proper build after 3204 the error was fixed in the source code.</li> 3205 <li>A Cygwin-specific bug where using very short paths for 3206 the Android NDK installation or the project path led to the 3207 generation of invalid dependency files. This made incremental builds 3208 impossible.</li> 3209 <li>A typo that prevented the cpufeatures library from working correctly 3210 with the new NDK toolchain.</li> 3211 <li>Builds in Cygwin are faster by avoiding calls to <code>cygpath -m</code> 3212 from GNU Make for every source or object file, which caused problems 3213 with very large source trees. In case this doesn't work properly, define 3214<code>NDK_USE_CYGPATH=1</code> in your 3215 environment to use <code>cygpath -m</code> again.</li> 3216 <li>The Cygwin installation now notifies the user of invalid installation paths that 3217contain spaces. Previously, an invalid path 3218 would output an error that complained about an incorrect version of GNU Make, even if the 3219right one was installed. 3220 </ul> 3221 </li> 3222 <li>Fixed a typo that prevented the <code>NDK_MODULE_PATH</code> environment variable from 3223working properly when 3224 it contained multiple directories separated with a colon. </li> 3225 <li>The <code>prebuilt-common.sh</code> script contains fixes to check the compiler for 64-bit 3226 generated machine code, instead of relying on the host tag, which 3227 allows the 32-bit toolchain to rebuild properly on Snow Leopard. The toolchain rebuild scripts 3228now also support 3229 using a 32-bit host toolchain.</li> 3230 <li>A missing declaration for <code>INET_ADDRSTRLEN</code> was added to 3231<code><netinet/in.h></code>.</li> 3232 <li>Missing declarations for <code>IN6_IS_ADDR_MC_NODELOCAL</code> and 3233<code>IN6_IS_ADDR_MC_GLOBAL</code> were added to <code><netinet/in6.h></code>.</li> 3234 <li>'asm' was replaced with '__asm__' in <code><asm/byteorder.h></code> to allow 3235compilation with <code>-std=c99</code>.</li> 3236 </ul> 3237 </div> 3238 </div> 3239 3240<div class="toggle-content closed"> 3241 <p><a href="#" onclick="return toggleContent(this)"> 3242 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 3243 alt="">Android NDK, Revision 5</a> <em>(December 2010)</em> 3244 </p> 3245 3246 <div class="toggle-content-toggleme"> 3247 <p>This release of the NDK includes many new APIs, most of which are introduced to 3248 support the development of games and similar applications that make extensive use 3249 of native code. Using the APIs, developers have direct native access to events, audio, 3250 graphics and window management, assets, and storage. Developers can also implement the 3251 Android application lifecycle in native code with help from the new 3252 {@link android.app.NativeActivity} class. For detailed information describing the changes 3253in this 3254 release, read the <code>CHANGES.HTML</code> document included in the downloaded NDK 3255package. 3256 </p> 3257 <dl> 3258 <dt>General notes:</dt> 3259 <dd> 3260 <ul> 3261 <li>Adds support for native activities, which allows you to implement the 3262 Android application lifecycle in native code.</li> 3263 3264 <li>Adds native support for the following: 3265 3266 <ul> 3267 3268 <li>Input subsystem (such as the keyboard and touch screen)</li> 3269 3270 <li>Access to sensor data (accelerometer, compass, gyroscope, etc).</li> 3271 3272 <li>Event loop APIs to wait for things such as input and sensor events.</li> 3273 3274 <li>Window and surface subsystem</li> 3275 3276 <li>Audio APIs based on the OpenSL ES standard that support playback and recording 3277 as well as control over platform audio effects</li> 3278 3279 <li>Access to assets packaged in an <code>.apk</code> file.</li> 3280 3281 </ul> 3282 </li> 3283 3284 <li>Includes a new toolchain (based on GCC 4.4.3), which generates better code, and can 3285also now 3286 be used as a standalone cross-compiler, for people who want to build their stuff with 3287 <code>./configure && make</code>. See 3288 docs/STANDALONE-TOOLCHAIN.html for the details. The binaries for GCC 4.4.0 are still 3289provided, 3290 but the 4.2.1 binaries were removed.</li> 3291 3292 <li>Adds support for prebuilt static and shared libraries (docs/PREBUILTS.html) and 3293module 3294 exports and imports to make sharing and reuse of third-party modules much easier 3295 (docs/IMPORT-MODULE.html explains why).</li> 3296 3297 <li>Provides a default C++ STL implementation (based on STLport) as a helper module. It 3298can be used either 3299 as a static or shared library (details and usage examples are in 3300sources/android/stlport/README). Prebuilt 3301 binaries for STLport (static or shared) and GNU libstdc++ (static only) are also 3302provided if you choose to 3303 compile against those libraries instead of the default C++ STL implementation. 3304 C++ Exceptions and RTTI are not supported in the default STL implementation. For more 3305information, see 3306 docs/CPLUSPLUS-SUPPORT.HTML.</li> 3307 3308 <li>Includes improvements to the <code>cpufeatures</code> helper library that improves 3309reporting 3310 of the CPU type (some devices previously reported ARMv7 CPU when the device really was 3311an ARMv6). We 3312 recommend developers that use this library to rebuild their applications then 3313 upload to Google Play to benefit from the improvements.</li> 3314 3315 <li>Adds an EGL library that lets you create and manage OpenGL ES textures and 3316 services.</li> 3317 3318 <li>Adds new sample applications, <code>native-plasma</code> and 3319<code>native-activity</code>, 3320 to demonstrate how to write a native activity.</li> 3321 3322 <li>Includes many bugfixes and other small improvements; see docs/CHANGES.html for a 3323more 3324 detailed list of changes.</li> 3325 </ul> 3326 </dd> 3327 </dl> 3328 </div> 3329 </div> 3330 3331<div class="toggle-content closed"> 3332 <p><a href="#" onclick="return toggleContent(this)"> 3333 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 3334 alt="">Android NDK, Revision 4b</a> <em>(June 2010)</em> 3335 </p> 3336 3337 <div class="toggle-content-toggleme"> 3338 <dl> 3339 <dt>NDK r4b notes:</dt> 3340 3341 <dd> 3342 <p>Includes fixes for several issues in the NDK build and debugging scripts — if 3343 you are using NDK r4, we recommend downloading the NDK r4b build. For detailed 3344 information describing the changes in this release, read the CHANGES.TXT document 3345 included in the downloaded NDK package.</p> 3346 </dd> 3347 </dl> 3348 3349 <dl> 3350 <dt>General notes:</dt> 3351 3352 <dd> 3353 <ul> 3354 <li>Provides a simplified build system through the new <code>ndk-build</code> build 3355 command.</li> 3356 3357 <li>Adds support for easy native debugging of generated machine code on production 3358 devices through the new <code>ndk-gdb</code> command.</li> 3359 3360 <li>Adds a new Android-specific ABI for ARM-based CPU architectures, 3361 <code>armeabi-v7a</code>. The new ABI extends the existing <code>armeabi</code> ABI to 3362 include these CPU instruction set extensions: 3363 3364 <ul> 3365 <li>Thumb-2 instructions</li> 3366 3367 <li>VFP hardware FPU instructions (VFPv3-D16)</li> 3368 3369 <li>Optional support for ARM Advanced SIMD (NEON) GCC intrinsics and VFPv3-D32. 3370 Supported by devices such as Verizon Droid by Motorola, Google Nexus One, and 3371 others.</li> 3372 </ul> 3373 </li> 3374 3375 <li>Adds a new <code>cpufeatures</code> static library (with sources) that lets your 3376 app detect the host device's CPU features at runtime. Specifically, applications can 3377 check for ARMv7-A support, as well as VFPv3-D32 and NEON support, then provide separate 3378 code paths as needed.</li> 3379 3380 <li>Adds a sample application, <code>hello-neon</code>, that illustrates how to use the 3381 <code>cpufeatures</code> library to check CPU features and then provide an optimized 3382 code path using NEON instrinsics, if supported by the CPU.</li> 3383 3384 <li>Lets you generate machine code for either or both of the instruction sets supported 3385 by the NDK. For example, you can build for both ARMv5 and ARMv7-A architectures at the 3386 same time and have everything stored to your application's final 3387 <code>.apk</code>.</li> 3388 3389 <li>To ensure that your applications are available to users only if their devices are 3390 capable of running them, Google Play now filters applications based on the 3391 instruction set information included in your application — no action is needed on 3392 your part to enable the filtering. Additionally, the Android system itself also checks 3393 your application at install time and allows the installation to continue only if the 3394 application provides a library that is compiled for the device's CPU architecture.</li> 3395 3396 <li>Adds support for Android 2.2, including a new stable API for accessing the pixel 3397 buffers of {@link android.graphics.Bitmap} objects from native code.</li> 3398 </ul> 3399 </dd> 3400 </dl> 3401 </div> 3402 </div> 3403 3404<div class="toggle-content closed"> 3405 <p><a href="#" onclick="return toggleContent(this)"> 3406 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 3407 alt="">Android NDK, Revision 3</a> <em>(March 2010)</em> 3408 </p> 3409 3410 <div class="toggle-content-toggleme"> 3411 <dl> 3412 <dt>General notes:</dt> 3413 3414 <dd> 3415 <ul> 3416 <li>Adds OpenGL ES 2.0 native library support.</li> 3417 3418 <li>Adds a sample application,<code>hello-gl2</code>, that illustrates the use of 3419 OpenGL ES 2.0 vertex and fragment shaders.</li> 3420 3421 <li>The toolchain binaries have been refreshed for this release with GCC 4.4.0, which 3422 should generate slightly more compact and efficient machine code than the previous one 3423 (4.2.1). The NDK also still provides the 4.2.1 binaries, which you can optionally use 3424 to build your machine code.</li> 3425 </ul> 3426 </dd> 3427 </dl> 3428 </div> 3429 </div> 3430 3431<div class="toggle-content closed"> 3432 <p><a href="#" onclick="return toggleContent(this)"> 3433 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 3434 alt="">Android NDK, Revision 2</a> <em>(September 2009)</em> 3435 </p> 3436 3437 <div class="toggle-content-toggleme"> 3438 <p>Originally released as "Android 1.6 NDK, Release 1".</p> 3439 3440 <dl> 3441 <dt>General notes:</dt> 3442 3443 <dd> 3444 <ul> 3445 <li>Adds OpenGL ES 1.1 native library support.</li> 3446 3447 <li>Adds a sample application, <code>san-angeles</code>, that renders 3D graphics 3448 through the native OpenGL ES APIs, while managing activity lifecycle with a {@link 3449 android.opengl.GLSurfaceView} object.</li> 3450 </ul> 3451 </dd> 3452 </dl> 3453 </div> 3454 </div> 3455 3456<div class="toggle-content closed"> 3457 <p><a href="#" onclick="return toggleContent(this)"> 3458 <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" 3459 alt="">Android NDK, Revision 1</a> <em>(June 2009)</em> 3460 </p> 3461 3462 <div class="toggle-content-toggleme"> 3463 <p>Originally released as "Android 1.5 NDK, Release 1".</p> 3464 3465 <dl> 3466 <dt>General notes:</dt> 3467 3468 <dd> 3469 <ul> 3470 <li>Includes compiler support (GCC) for ARMv5TE instructions, including Thumb-1 3471 instructions.</li> 3472 3473 <li>Includes system headers for stable native APIs, documentation, and sample 3474 applications.</li> 3475 </ul> 3476 </dd> 3477 </dl> 3478 </div> 3479 </div> 3480 3481 3482 3483 3484 3485<!-- ####################### END OF RELEASE NOTES ####################### --> 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 <h2 id="Reqs">System and Software Requirements</h2> 3515 3516 <p>The sections below describe the system and software requirements for using the Android NDK, as 3517 well as platform compatibility considerations that affect appplications using libraries produced 3518 with the NDK.</p> 3519 3520 <h4>The Android SDK</h4> 3521 3522 <ul> 3523 <li>A complete Android SDK installation (including all dependencies) is required.</li> 3524 3525 <li>Android 1.5 SDK or later version is required.</li> 3526 </ul> 3527 3528 <h4>Supported operating systems</h4> 3529 3530 <ul> 3531 <li>Windows XP (32-bit) or Vista (32- or 64-bit)</li> 3532 3533 <li>Mac OS X 10.4.8 or later (x86 only)</li> 3534 3535 <li>Linux (32 or 64-bit; Ubuntu 8.04, or other Linux distributions using GLibc 2.7 or 3536later)</li> 3537 </ul> 3538 3539 <h4>Required development tools</h4> 3540 3541 <ul> 3542 <li>For all development platforms, GNU Make 3.81 or later is required. Earlier versions of GNU 3543 Make might work but have not been tested.</li> 3544 3545 <li>A recent version of awk (either GNU Awk or Nawk) is also required.</li> 3546 3547 <li>For Windows, <a href="http://www.cygwin.com">Cygwin</a> 1.7 or higher is required. The NDK 3548 will <em>not</em> work with Cygwin 1.5 installations.</li> 3549 </ul> 3550 3551 <h4 id="platform-compat">Android platform compatibility</h4> 3552 3553 <ul> 3554 <li>The native libraries created by the Android NDK can only be used on devices running 3555 specific minimum Android platform versions. The minimum required platform version depends on 3556 the CPU architecture of the devices you are targeting. The following table details which 3557 Android platform versions are compatible with native code developed for specific CPU 3558 architectures. 3559 3560 <table style="margin:1em;"> 3561 <tr> 3562 <th>Native Code CPU Architecture Used</th> 3563 <th>Compatible Android Platform(s)</th> 3564 </tr> 3565 3566 <tr> 3567 <td>ARM, ARM-NEON</td> 3568 <td>Android 1.5 (API Level 3) and higher</td> 3569 </tr> 3570 3571 <tr> 3572 <td>x86</td> 3573 <td>Android 2.3 (API Level 9) and higher</td> 3574 </tr> 3575 3576 <tr> 3577 <td>MIPS</td> 3578 <td>Android 2.3 (API Level 9) and higher</td> 3579 </tr> 3580 </table> 3581 3582 <p>These requirements mean you can use native libraries produced with the NDK in 3583 applications that are deployable to ARM-based devices running Android 1.5 or later. If you are 3584 deploying native libraries to x86 and MIPS-based devices, your application must target Android 3585 2.3 or later.</p> 3586 </li> 3587 3588 <li>To ensure compatibility, an application using a native library produced with the NDK 3589 <em>must</em> declare a <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html"><code> 3590 <uses-sdk></code></a> element in its manifest file, with an 3591 <code>android:minSdkVersion</code> attribute value of "3" or higher. For example: 3592 3593<pre style="margin:1em;"> 3594<manifest> 3595 <uses-sdk android:minSdkVersion="3" /> 3596 ... 3597</manifest> 3598</pre> 3599 </li> 3600 3601 <li>If you use this NDK to create a native library that uses the OpenGL ES APIs, the 3602 application containing the library can be deployed only to devices running the minimum platform 3603 versions described in the table below. To ensure compatibility, make sure that your application 3604 declares the proper <code>android:minSdkVersion</code> attribute value, as shown in the 3605 following table.</li> 3606 3607 <li style="list-style: none; display: inline"> 3608 <table style="margin:1em;"> 3609 <tr> 3610 <th>OpenGL ES Version Used</th> 3611 3612 <th>Compatible Android Platform(s)</th> 3613 3614 <th>Required uses-sdk Attribute</th> 3615 </tr> 3616 3617 <tr> 3618 <td>OpenGL ES 1.1</td> 3619 3620 <td>Android 1.6 (API Level 4) and higher</td> 3621 3622 <td><code>android:minSdkVersion="4"</code></td> 3623 </tr> 3624 3625 <tr> 3626 <td>OpenGL ES 2.0</td> 3627 3628 <td>Android 2.0 (API Level 5) and higher</td> 3629 3630 <td><code>android:minSdkVersion="5"</code></td> 3631 </tr> 3632 </table> 3633 3634 <p>For more information about API Level and its relationship to Android platform versions, 3635 see <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">Android API 3636Levels</a>.</p> 3637 </li> 3638 3639 <li>Additionally, an application using the OpenGL ES APIs should declare a 3640 <code><uses-feature></code> element in its manifest, with an 3641 <code>android:glEsVersion</code> attribute that specifies the minimum OpenGl ES version 3642 required by the application. This ensures that Google Play will show your application only 3643 to users whose devices are capable of supporting your application. For example: 3644 <pre style="margin:1em;"> 3645<manifest> 3646<!-- Declare that the application uses the OpenGL ES 2.0 API and is designed 3647 to run only on devices that support OpenGL ES 2.0 or higher. --> 3648 <uses-feature android:glEsVersion="0x00020000" /> 3649 ... 3650</manifest> 3651</pre> 3652 3653 <p>For more information, see the <a href= 3654 3655"{@docRoot}guide/topics/manifest/uses-feature-element.html"><code><uses-feature></code></a> 3656 documentation.</p> 3657 </li> 3658 3659 <li>If you use this NDK to create a native library that uses the API to access Android {@link 3660 android.graphics.Bitmap} pixel buffers or utilizes native activities, the application 3661 containing the library can be deployed only to devices running Android 2.2 (API level 8) or 3662 higher. To ensure compatibility, make sure that your application declares <code><uses-sdk 3663 android:minSdkVersion="8" /></code> attribute value in its manifest.</li> 3664 </ul> 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 <h2 id="Installing">Installing the NDK</h2> 3693 <p>Installing the NDK on your development computer is straightforward and involves extracting the 3694 NDK from its download package.</p> 3695 3696 <p>Before you get started make sure that you have downloaded the latest <a href= 3697 "{@docRoot}sdk/index.html">Android SDK</a> and upgraded your applications and environment as 3698 needed. The NDK is compatible with older platform versions but not older versions of the SDK 3699tools. 3700 Also, take a moment to review the <a href="#Reqs">System and 3701Software Requirements</a> 3702 for the NDK, if you haven't already.</p> 3703 3704 <p>To install the NDK, first download the appropriate package from the table at the top of this 3705 page. Then, follow the procedure for your development platform:</p> 3706 <ul> 3707 <li>On Linux and Mac OS X (Darwin): 3708 <ul> 3709 <ol> 3710 <li>Download the appropriate package from this page.</li> 3711 <li>Open a terminal window.</li> 3712 <li>Go to the directory to which you downloaded the package.</li> 3713 <li>Run <code>chmod a+x</code> on the downloaded package.</li> 3714 <li>Execute the package. For example:</li> 3715 <pre> 3716ndk$ chmod a+x android-ndk-r10c-darwin-x86_64.bin 3717ndk$ ./android-ndk-r10c-darwin-x86_64.bin 3718 </pre> 3719 <p>The folder containing the NDK extracts itself.</p> 3720 <p>Note that you can also use a program like 7z to extract the package.</p> 3721 </ol> 3722 </ul> 3723 <li>On Windows:</li> 3724 <ul> 3725 <ol> 3726 <li>Download the appropriate package from this page.</li> 3727 <li>Navigate to the folder to which you downloaded the package.</li> 3728 <li>Double-click the downloaded file. The folder containing the NDK extracts itself.</li> 3729 </ol> 3730 </ul> 3731 </ul>When uncompressed, the NDK files are contained in a directory called 3732 <code>android-ndk-<version></code>. You can rename the NDK directory if necessary and you 3733 can move it to any location on your computer. This documentation refers to the NDK directory as 3734 <code><ndk></code>. 3735 3736 3737 <p>You are now ready to start working with the NDK.</p> 3738 3739 3740<h2 id="GetStarted">Getting Started with the NDK</h2> 3741 3742<p>Once you've installed the NDK successfully, take a few minutes to read the documentation 3743included in the NDK. You can find the documentation in the <code><ndk>/docs/</code> 3744directory. In particular, please read the OVERVIEW.HTML document completely, so that you 3745understand the intent of the NDK and how to use it.</p> 3746 3747<p>If you used a previous version of the NDK, take a moment to review the list of NDK changes in 3748the CHANGES.HTML document.</p> 3749 3750<p>Here's the general outline of how you work with the NDK tools:</p> 3751 3752<ol> 3753 <li>Place your native sources under <code><project>/jni/...</code></li> 3754 3755 <li>Create <code><project>/jni/Android.mk</code> to describe your native sources to the 3756 NDK build system</li> 3757 3758 <li>Optional: Create <code><project>/jni/Application.mk</code>.</li> 3759 3760 <li>Build your native code by running the 'ndk-build' script from your project's directory. It 3761 is located in the top-level NDK directory: 3762 <pre class="no-pretty-print">cd <project> 3763<ndk>/ndk-build 3764</pre> 3765 3766 <p>The build tools copy the stripped, shared libraries needed by your application to the 3767 proper location in the application's project directory.</p> 3768 </li> 3769 3770 <li>Finally, compile your application using the SDK tools in the usual way. The SDK build tools 3771 will package the shared libraries in the application's deployable <code>.apk</code> file.</li> 3772</ol> 3773 3774<p>For complete information on all of the steps listed above, please see the documentation 3775included with the NDK package.</p> 3776 3777 3778<h3 id="Using">Using the NDK</h3> 3779 3780<p>The Android framework provides two ways to use native code:</p> 3781 3782<ul> 3783 <li>Write your application using the Android framework and use JNI to access the APIs provided 3784 by the Android NDK. This technique allows you to take advantage of the convenience of the 3785 Android framework, but still allows you to write native code when necessary. If you use this 3786 approach, your application must target specific, minimum Android platform levels, see <a 3787 href="#platform-compat">Android platform compatibility</a> for more information.</li> 3788 3789 <li> 3790 <p>Write a native activity, which allows you to implement the lifecycle callbacks in native 3791 code. The Android SDK provides the {@link android.app.NativeActivity} class, which is a 3792 convenience class that notifies your 3793 native code of any activity lifecycle callbacks (<code>onCreate()</code>, 3794<code>onPause()</code>, 3795 <code>onResume()</code>, etc). You can implement the callbacks in your native code to handle 3796 these events when they occur. Applications that use native activities must be run on Android 3797 2.3 (API Level 9) or later.</p> 3798 3799 <p>You cannot access features such as Services and Content Providers natively, so if you want 3800 to use them or any other framework API, you can still write JNI code to do so.</p> 3801 </li> 3802</ul> 3803 3804 3805 3806 3807 3808 <h2 id="Contents">Contents of the NDK</h2> 3809 3810 <p>The NDK contains the APIs, documentation, and sample 3811 applications that help you write your native code. Specifically:</p> 3812 3813 <ul> 3814 <li>A set of tools and build files used to generate native code libraries from C and C++ 3815 sources</li> 3816 3817 <li>A way to embed the corresponding native libraries into an application package file 3818 (<code>.apk</code>) that can be deployed on Android devices</li> 3819 3820 <li>A set of native system headers and libraries that will be supported in all future versions 3821 of the Android platform, starting from Android 1.5. Applications that use native activities 3822 must be run on Android 2.3 or later.</li> 3823 3824 <li>Documentation, samples, and tutorials</li> 3825 </ul> 3826 3827 <p>The latest release of the NDK supports the following instruction sets:</p> 3828 3829 <ul> 3830 <li>ARMv5TE, including Thumb-1 instructions (see {@code docs/CPU-ARCH-ABIS.html} for more 3831information)</li> 3832 3833 <li>ARMv7-A, including Thumb-2 and VFPv3-D16 instructions, with optional support for 3834 NEON/VFPv3-D32 instructions (see {@code docs/CPU-ARM-NEON.html} for more information)</li> 3835 3836 <li>x86 instructions (see {@code docs/CPU-X86.html} for more information)</li> 3837 3838 <li>MIPS instructions (see {@code docs/CPU-MIPS.html} for more information)</li> 3839 </ul> 3840 3841 <p>ARMv5TE machine code will run on all ARM-based Android devices. ARMv7-A will run only on 3842 devices such as the Verizon Droid or Google Nexus One that have a compatible CPU. The main 3843 difference between the two instruction sets is that ARMv7-A supports hardware FPU, Thumb-2, and 3844 NEON instructions. You can target either or both of the instruction sets — ARMv5TE is the 3845 default, but switching to ARMv7-A is as easy as adding a single line to the application's 3846 <code>Application.mk</code> file, without needing to change anything else in the file. You can 3847also build for 3848 both architectures at the same time and have everything stored in the final <code>.apk</code>. 3849 Complete information is provided in the CPU-ARCH-ABIS.HTML in the NDK package.</p> 3850 3851 <p>The NDK provides stable headers for libc (the C library), libm (the Math library), OpenGL ES 3852 (3D graphics library), the JNI interface, and other libraries, as listed in the <a href= 3853 "#Tools">Development tools</a> section.</p> 3854 3855 3856 <h3 id="Tools">Development tools</h3> 3857 3858 <p>The NDK includes a set of cross-toolchains (compilers, linkers, etc.) that can generate 3859 native ARM binaries on Linux, OS X, and Windows (with Cygwin) platforms.</p> 3860 3861 <p>It provides a set of system headers for stable native APIs that are guaranteed to be supported 3862 in all later releases of the platform:</p> 3863 3864 <ul> 3865 <li>libc (C library) headers</li> 3866 3867 <li>libm (math library) headers</li> 3868 3869 <li>JNI interface headers</li> 3870 3871 <li>libz (Zlib compression) headers</li> 3872 3873 <li>liblog (Android logging) header</li> 3874 3875 <li>OpenGL ES 1.1 and OpenGL ES 2.0 (3D graphics libraries) headers</li> 3876 3877 <li>libjnigraphics (Pixel buffer access) header (for Android 2.2 and above).</li> 3878 3879 <li>A Minimal set of headers for C++ support</li> 3880 3881 <li>OpenSL ES native audio libraries</li> 3882 3883 <li>Android native application APIS</li> 3884 </ul> 3885 3886 <p>The NDK also provides a build system that lets you work efficiently with your sources, without 3887 having to handle the toolchain/platform/CPU/ABI details. You create very short build files to 3888 describe which sources to compile and which Android application will use them — the build 3889 system compiles the sources and places the shared libraries directly in your application 3890 project.</p> 3891 3892 <p class="caution"><strong>Important:</strong> With the exception of the libraries listed above, 3893 native system libraries in the Android platform are <em>not</em> stable and may change in future 3894 platform versions. Your applications should <em>only</em> make use of the stable native system 3895 libraries provided in this NDK.</p> 3896 3897 3898 3899 <h3 id="Docs">Documentation</h3> 3900 3901 <p>The NDK package includes a set of documentation that describes the capabilities of the NDK and 3902 how to use it to create shared libraries for your Android applications. In this release, the 3903 documentation is provided only in the downloadable NDK package. You can find the documentation in 3904 the <code><ndk>/docs/</code> directory. Included are these files (partial listing):</p> 3905 3906 <ul> 3907 <li> 3908 INSTALL.HTML — describes how to install the NDK and configure it for your host 3909 system</li> 3910 3911 <li>OVERVIEW.HTML — provides an overview of the NDK capabilities and usage</li> 3912 3913 <li>ANDROID-MK.HTML — describes the use of the Android.mk file, which defines the native 3914 sources you want to compile</li> 3915 3916 <li>APPLICATION-MK.HTML — describes the use of the Application.mk file, which describes 3917 the native sources required by your Android application</li> 3918 <li>CPLUSPLUS-SUPPORT.HTML — describes the C++ support provided in the Android NDK</li> 3919 <li>CPU-ARCH-ABIS.HTML — a description of supported CPU architectures and how to target 3920 them.</li> 3921 3922 <li>CPU-FEATURES.HTML — a description of the <code>cpufeatures</code> static library that 3923 lets your application code detect the target device's CPU family and the optional features at 3924 runtime.</li> 3925 3926 <li>CHANGES.HTML — a complete list of changes to the NDK across all releases.</li> 3927 3928 <li>DEVELOPMENT.HTML — describes how to modify the NDK and generate release packages for 3929it</li> 3930 3931 <li>HOWTO.HTML — information about common tasks associated with NDK development</li> 3932 3933 <li>IMPORT-MODULE.HTML — describes how to share and reuse modules</li> 3934 3935 <li>LICENSES.HTML — information about the various open source licenses that govern the 3936Android NDK</li> 3937 3938 <li>NATIVE-ACTIVITY.HTML — describes how to implement native activities</li> 3939 3940 <li>NDK-BUILD.HTML — describes the usage of the ndk-build script</li> 3941 3942 <li>NDK-GDB.HTML — describes how to use the native code debugger</li> 3943 3944 <li>PREBUILTS.HTML — information about how shared and static prebuilt libraries work </li> 3945 3946 <li>STANDALONE-TOOLCHAIN.HTML — describes how to use Android NDK toolchain as a standalone 3947 compiler (still in beta).</li> 3948 3949 <li>SYSTEM-ISSUES.HTML — known issues in the Android system images that you should be 3950 aware of, if you are developing using the NDK.</li> 3951 3952 <li>STABLE-APIS.HTML — a complete list of the stable APIs exposed by headers in the 3953 NDK.</li> 3954 3955 </ul> 3956 3957 <p>Additionally, the package includes detailed information about the "bionic" C library provided 3958 with the Android platform that you should be aware of, if you are developing using the NDK. You 3959 can find the documentation in the <code><ndk>/docs/system/libc/</code> directory:</p> 3960 3961 <ul> 3962 <li>OVERVIEW.HTML — provides an overview of the "bionic" C library and the features it 3963 offers.</li> 3964 </ul> 3965 3966 3967 3968 3969 3970<h3 id="Samples">Sample apps</h3> 3971 3972<p>The NDK includes sample applications that illustrate how to use native code in your Android 3973 applications:</p> 3974 3975 <ul> 3976 <li><code>hello-jni</code> — a simple application that loads a string from a native 3977 method implemented in a shared library and then displays it in the application UI.</li> 3978 3979 <li><code>two-libs</code> — a simple application that loads a shared library dynamically 3980 and calls a native method provided by the library. In this case, the method is implemented in a 3981 static library imported by the shared library.</li> 3982 3983 <li><code>san-angeles</code> — a simple application that renders 3D graphics through the 3984 native OpenGL ES APIs, while managing activity lifecycle with a {@link 3985 android.opengl.GLSurfaceView} object.</li> 3986 3987 <li><code>hello-gl2</code> — a simple application that renders a triangle using OpenGL ES 3988 2.0 vertex and fragment shaders.</li> 3989 3990 <li><code>hello-neon</code> — a simple application that shows how to use the 3991 <code>cpufeatures</code> library to check CPU capabilities at runtime, then use NEON intrinsics 3992 if supported by the CPU. Specifically, the application implements two versions of a tiny 3993 benchmark for a FIR filter loop, a C version and a NEON-optimized version for devices that 3994 support it.</li> 3995 3996 <li><code>bitmap-plasma</code> — a simple application that demonstrates how to access the 3997 pixel buffers of Android {@link android.graphics.Bitmap} objects from native code, and uses 3998 this to generate an old-school "plasma" effect.</li> 3999 4000 <li><code>native-activity</code> — a simple application that demonstrates how to use the 4001 native-app-glue static library to create a native activity</li> 4002 4003 <li><code>native-plasma</code> — a version of bitmap-plasma implemented with a native 4004 activity.</li> 4005 </ul> 4006 4007 <p>For each sample, the NDK includes the corresponding C source code and the necessary Android.mk 4008 and Application.mk files. There are located under <code><ndk>/samples/<name>/</code> 4009 and their source code can be found under <code><ndk>/samples/<name>/jni/</code>.</p> 4010 4011 <p>You can build the shared libraries for the sample apps by going into 4012 <code><ndk>/samples/<name>/</code> then calling the <code>ndk-build</code> command. 4013 The generated shared libraries will be located under 4014 <code><ndk>/samples/<name>/libs/armeabi/</code> for (ARMv5TE machine code) and/or 4015 <code><ndk>/samples/<name>/libs/armeabi-v7a/</code> for (ARMv7 machine code).</p> 4016 4017 <p>Next, build the sample Android applications that use the shared libraries:</p> 4018 4019 <ul> 4020 <li>If you are developing in Eclipse with ADT, use the New Project Wizard to create a new 4021 Android project for each sample, using the "Import from Existing Source" option and importing 4022 the source from <code><ndk>/samples/<name>/</code>. Then, set up an AVD, 4023 if necessary, and build/run the application in the emulator.</li> 4024 4025 <li>If you are developing with Ant, use the <code>android</code> tool to create the build file 4026 for each of the sample projects at <code><ndk>/samples/<name>/</code>. 4027 Then set up an AVD, if necessary, build your project in the usual way, and run it in the 4028 emulator.</li> 4029 4030 </ul> 4031 4032 <p>For more information about developing with the Android SDK tools and what 4033 you need to do to create, build, and run your applications, see 4034 the <a href="{@docRoot}tools/workflow/index.html">Overview</a> 4035 section for developing on Android.</p> 4036 4037 4038 4039 <h4 id="hello-jni">Exploring the hello-jni Sample</h4> 4040 4041 <p>The hello-jni sample is a simple demonstration on how to use JNI from an Android application. 4042 The HelloJni activity receives a string from a simple C function and displays it in a 4043 TextView.</p> 4044 4045 <p>The main components of the sample include:</p> 4046 4047 <ul> 4048 <li>The familiar basic structure of an Android application (an <code>AndroidManifest.xml</code> 4049 file, a <code>src/</code> and <code>res</code> directories, and a main activity)</li> 4050 4051 <li>A <code>jni/</code> directory that includes the implemented source file for the native code 4052 as well as the Android.mk file</li> 4053 4054 <li>A <code>tests/</code> directory that contains unit test code.</li> 4055 </ul> 4056 4057 <ol> 4058 <li>Create a new project in Eclipse from the existing sample source or use the 4059 <code>android</code> tool to update the project so it generates a build.xml file that you can 4060 use to build the sample. 4061 4062 <ul> 4063 <li>In Eclipse: 4064 4065 <ol type="a"> 4066 <li>Click <strong>File > New Android Project...</strong></li> 4067 4068 <li>Select the <strong>Create project from existing source</strong> radio button.</li> 4069 4070 <li>Select any API level above Android 1.5.</li> 4071 4072 <li>In the <strong>Location</strong> field, click <strong>Browse...</strong> and select 4073 the <code><ndk-root>/samples/hello-jni</code> directory.</li> 4074 4075 <li>Click <strong>Finish</strong>.</li> 4076 </ol> 4077 </li> 4078 4079 <li>On the command line: 4080 4081 <ol type="a"> 4082 <li>Change to the <code><ndk-root>/samples/hello-jni</code> directory.</li> 4083 4084 <li>Run the following command to generate a build.xml file: 4085 <pre class="no-pretty-print">android update project -p . -s</pre> 4086 </li> 4087 </ol> 4088 </li> 4089 </ul> 4090 </li> 4091 4092 <li>Compile the native code using the <code>ndk-build</code> command. 4093 <pre class="no-pretty-print"> 4094cd <ndk-root>/samples/hello-jni 4095<ndk_root>/ndk-build 4096</pre> 4097 </li> 4098 4099 <li>Build and install the application as you would a normal Android application. If you are 4100 using Eclipse, run the application to build and install it on a device. If you are using Ant, 4101 run the following commands from the project directory: 4102 <pre class="no-pretty-print"> 4103ant debug 4104adb install bin/HelloJni-debug.apk 4105</pre> 4106 </li> 4107 </ol> 4108 4109 <p>When you run the application on the device, the string <code>Hello JNI</code> should appear on 4110 your device. You can explore the rest of the samples that are located in the 4111 <code><ndk-root>/samples</code> directory for more examples on how to use the JNI.</p> 4112 4113 4114 4115 <h4 id="native-activity">Exploring the native-activity Sample Application</h4> 4116 4117 <p>The native-activity sample provided with the Android NDK demonstrates how to use the 4118 android_native_app_glue static library. This static library makes creating a native activity 4119 easier by providing you with an implementation that handles your callbacks in another thread, so 4120 you do not have to worry about them blocking your main UI thread. The main parts of the sample 4121 are described below:</p> 4122 4123 <ul> 4124 <li>The familiar basic structure of an Android application (an <code>AndroidManifest.xml</code> 4125 file, a <code>src/</code> and <code>res</code> directories). The AndroidManifest.xml declares 4126 that the application is native and specifies the .so file of the native activity. See {@link 4127 android.app.NativeActivity} for the source or see the 4128 <code><ndk_root>/platforms/samples/native-activity/AndroidManifest.xml</code> file.</li> 4129 4130 <li>A <code>jni/</code> directory contains the native activity, main.c, which uses the 4131 <code>android_native_app_glue.h</code> interface to implement the activity. The Android.mk that 4132 describes the native module to the build system also exists here.</li> 4133 </ul> 4134 4135 <p>To build this sample application:</p> 4136 4137 <ol> 4138 <li>Create a new project in Eclipse from the existing sample source or use the 4139 <code>android</code> tool to update the project so it generates a build.xml file that you can 4140 use to build the sample. 4141 4142 <ul> 4143 <li>In Eclipse: 4144 4145 <ol type="a"> 4146 <li>Click <strong>File > New Android Project...</strong></li> 4147 4148 <li>Select the <strong>Create project from existing source</strong> radio button.</li> 4149 4150 <li>Select any API level above Android 2.3.</li> 4151 4152 <li>In the <strong>Location</strong> field, click <strong>Browse...</strong> and select 4153 the <code><ndk-root>/samples/native-activity</code> directory.</li> 4154 4155 <li>Click <strong>Finish</strong>.</li> 4156 </ol> 4157 </li> 4158 4159 <li>On the command line: 4160 4161 <ol type="a"> 4162 <li>Change to the <code><ndk-root>/samples/native-activity</code> directory.</li> 4163 4164 <li>Run the following command to generate a build.xml file: 4165 <pre class="no-pretty-print"> 4166android update project -p . -s 4167</pre> 4168 </li> 4169 </ol> 4170 </li> 4171 </ul> 4172 </li> 4173 4174 <li>Compile the native code using the <code>ndk-build</code> command. 4175 <pre class="no-pretty-print"> 4176cd <ndk-root>/platforms/samples/android-9/samples/native-activity 4177<ndk_root>/ndk-build 4178</pre> 4179 </li> 4180 4181 <li>Build and install the application as you would a normal Android application. If you are 4182 using Eclipse, run the application to build and install it on a device. If you are using Ant, 4183 run the following commands in the project directory, then run the application on the device: 4184 <pre class="no-pretty-print"> 4185ant debug 4186adb install bin/NativeActivity-debug.apk 4187</pre> 4188 </li> 4189 </ol> 4190