CrystaX NDK 10

Description

This is a distribution of the CrystaX NDK, which has been developed as a drop-in replacement for Google's Android NDK (Native Development Kit). Compared to Google's NDK, the CrystaX NDK provides the same functionality as well as several great features and tons of fixes and improvements.

The main goal of the CrystaX NDK is to allow Android developers to produce standard conformant code and thus make Android native development more efficient. The CrystaX NDK dramatically decreases development time allowing usage of standard code working on multiple platforms (iOS, OS X, Windows, Linux, etc.) instead of distracting developers with Android's peculiarities and forcing coders to try to workaround them (or even write separate Android-specific implementations of functionality already implemented for another platform if a detected problem cannot be easily worked around).

Unfortunately, Android libc (Bionic) has very limited functionality (which differs from one Android version to another), so developers have been forced to take into account all its peculiarities, detecting in run-time which specific Android version the application is running on and applying specific workarounds. With CrystaX NDK, developers can forget about such problems, since CrystaX NDK provides complementary libcrystax, which is used to hide such differences between Android versions or even re-implement many of libc functions. Most importantly, with the help of libcrystax, the application behaves the same on all Android devices regardless of Android version.

Another goal of CrystaX NDK is to make some great features available for the Android native world. For example, support of Objective-C and another programming languages.

This project was initially started as a personal project of Dmitry Moskalchuk with the intention to just add missing C++ support (C++ exceptions, RTTI, and the Standard C++ Library) to the Google's Android NDK, but with time, many additional needs were discovered, and it turned out that improving the CrystaX NDK step-by-step was in fact the best way to force an evolution of native Android development. Since its beginning in 2009, numerous open-source and commercial projects have used the CrystaX NDK for porting and development for Android with minimal effort.

Nowadays, CrystaX NDK offers numerous great features, making native development for Android easier. See below the key features of the CrystaX NDK.

  1. Full support of wide characters

    Wide characters are part of C and C++ languages and their standard libraries. For example, the C standard library provides functions allowing work with wide strings such as wcsnlen, wcsncasecmp, wcsncmp and others; the C++ standard library provides wchar_t specializations of standard C++ classes such as std::basic_string, std::basic_ostream, std::basic_regex etc. Unfortunately, Android libc (Bionic) either doesn't support wide characters at all or supports them in a very limited manner, depending on Android version.

    With the CrystaX NDK, you get fully standard-compliant wide characters support, including multibyte-to-wide and vice versa conversions. You can easily port existing code or write new code that uses wide characters, strings, streams, and regular expressions not distracting on Android's peculiarities.

    Example

  2. Full support of C locales

    Android libc (Bionic) has no native support of locales, so the only way to use localized input/output in native code is to implement localization in Java and refer to it through JNI. Obviously, such an approach adds significant run-time overhead, but it's the only choice if you're using Google's Android NDK.

    Now, with CrystaX NDK, locales are supported natively, so just set a locale with standard setlocale and all further C standard function calls will use that locale for input and output. CrystaX NDK also supports so-called "extended locales" (part of IEEE Std 1003.1, 2013 Edition), providing companion locale-enabled functions for many standard C interfaces, such as printf_l, strftime_l, strfmon_l and others.

    Example

  3. Full math support, including complex and type-generic math functions

    ISO C standard defines headers <tgmath.h> and <complex.h>. In Google's Android NDK, <complex.h> appears only starting from r10 and only for applications targeting Android 5.0 (android-21 platform), whereas type-generic math functions are not supported at all.

    With CrystaX NDK, you get fully working complex and type-generic math regardless of the target Android version. Nothing more to say - just use it as defined in ISO C standard and enjoy!

  4. The most recent toolchains

    The CrystaX NDK includes the most recent versions of GCC and Clang compilers. This allows developers to use new language abilities, such as new C++11/C++14 features. All compilers are built with high- and low-level optimizations, which enable generation of the most efficient code for target hardware.

  5. C++11/C++14 support

    Since the CrystaX NDK includes the most recent versions of GCC and Clang, it supports all C++11/C++14 features listed on C++11 Support in GCC, C++14 Support in GCC and C++ Support in Clang.

  6. Full C++ standard library

    In addition, the CrystaX NDK offers a fully working C++11 standard library, including classes std::thread and std::mutex, functions/classes from std::chrono, and functions std::stol, std::stoul etc. These classes and functions are not available in the Google's Android NDK because of a lack of functionality in Android libc (Bionic). Well, strictly speaking, they are available, but only if you're using LLMV libc++ implementation, which is in an experimental state.

    In the CrystaX NDK, we've taken care of the completeness of the C++ standard library and have fixed all such issues, so the full C++ standard library is available no matter which implementation you're using - GNU libstdc++ or LLVM libc++.

    By the way, LLVM libc++ in CrystaX NDK is a first-class citizen, the same as GNU libstdc++, so you're free to use either one of them, your choice. By default, GNU libstdc++ is used.

    Example

  7. Boost C++ libraries out of the box

    We provide prebuilt Boost C++ libraries (as well as header-only libraries) out of the box. Boost usage become as simple as can be. No need to build Boost libraries on your own anymore; no need to figure out what's wrong when it fails. Most important, Boost C++ libraries works much better with CrystaX NDK than the same libraries built by Google's NDK - because in CrystaX NDK they works on top of the much more standard-conformant base (yes, it's libcrystax, core of the CrystaX NDK).

    Here you can see an example of how to start using Boost C++ libraries in your Android project.

  8. Objective-C and Objective-C++ support

    The only languages Google's NDK supports are C and C++. The CrystaX NDK adds support of Objective-C and Objective-C++ in addition to C and C++. Only the core language is supported as of now; work on Cocoa-like libraries and Objective-C v2 runtime is in progress. To start using Objective-C in your project, just add source files with the extension .m (Objective-C) or .mm (Objective-C++) and specify them in LOCAL_SRC_FILES in Android.mk.

  9. Tons of fixes and improvements of standard C library implementation

    It's a well-known fact that Android libc (Bionic) has many bugs in its implementation of standard C functions. For example, one of the most notorious bugs is strtod implementation, which works properly only for the simplest input string formats and fails for others required by ISO C Standard. Some of these bugs are fixed over time, others aren't. Anyway, even if some bugs are fixed, such fixes don't affect previously released Android versions, so developers are forced to live with them or implement their own workarounds. This significantly increases time for development or porting of native Android applications.

    In CrystaX NDK, we've implemented our own versions of such buggy functions in libcrystax and have done so without altering the typical development work flow. Compilers/linkers use libcrystax transparently for developers so one won't even know that a libcrystax implementation is being used instead of a Bionic (except for the fact that the behaviour has been fixed). Also, using CrystaX NDK, you'll never run into a situation where a bug fix is available only for specific Android versions. When we fix anything in libcrystax, we ensure it works on all Android versions.

  10. To be continued...

    If you don't see a great feature here, don't hesitate to contact us and ask for it. You can also use our issue/bug tracker to report bugs or feature requests. And, of course, your contributions are welcome!

Fundraising

We have plans for the further evolution of CrystaX NDK. We want to make it a comprehensive toolkit for native Android development, providing a solid basis for any POSIX-conforming software to be able run on Android without significant rewriting. To do that, we're asking for help from the community.

We've started a fundraising campaign on BountySource to continue the development of CrystaX NDK and keep it available free to all Android developers. We're asking everyone interested in the further evolution of native development for Android to help us. We would very much appreciate any kind of help - whether it is funding, contributions to the project by sending us patches, or helping to spread the news all over the world.

Please read more about CrystaX NDK’s history and our plans - and help us do that.

License

The content of the CrystaX NDK is covered by various open-source licenses. See the copyright disclaimers in each respective file for details.

Note that the CrystaX NDK release packages also contain prebuilt binaries for the compiler, linker, archiver, etc. The source codes for the toolchains are available at GitHub (you can use the build script to download it automatically).

The prebuilt GCC and companion binaries (GDB, binutils etc) are covered by either the GNU General Public License (GPL) or the GNU Lesser General Public License (LGPL). For details, see the files COPYING and COPYING.LIB under $NDK/toolchains/<toolchain>/prebuilt/<system>.

The prebuilt LLVM/Clang toolchains are covered by the LLVM "BSD" license.

Basically, licensing rules are the same as for Google's Android NDK - i.e., both commercial and non-commercial usage allowed. The only additions are regarding CrystaX parts, which are covered by a permissive BSD 2-clause license.

Download

File Size SHA1
crystax-ndk-10.1.0-windows-x86.exe 800.793 MB 1474fc065311f5cfd40531cba71fcc878ca591d7
crystax-ndk-10.1.0-windows-x86_64.exe 858.172 MB f73a16892dc8f007872c5457a650e9b50969ebe1
crystax-ndk-10.1.0-darwin-x86.7z 560.190 MB d502f57ea314e5a572387b4492c297f77e68a982
crystax-ndk-10.1.0-darwin-x86.tar.bz2 1.422 GB c30724ff738bbcc1906bc2d89114fbe706a05fb5
crystax-ndk-10.1.0-darwin-x86_64.7z 530.204 MB dc125ae803ede7d4b68ac9d57b30909bfcb1a8d6
crystax-ndk-10.1.0-darwin-x86_64.tar.bz2 1.386 GB 505677a7c971fbfeb56e1ba19ea2262aadd439ed
crystax-ndk-10.1.0-linux-x86.7z 790.919 MB 55aa8750e8ed8704e748114f7788dbfe81668737
crystax-ndk-10.1.0-linux-x86.tar.bz2 1.798 GB 07698fe850311c43d14d29f93123a6f6ec69bf9b
crystax-ndk-10.1.0-linux-x86_64.7z 814.350 MB a5a6964e5062239cfa72af37d9147f4577a8f21a
crystax-ndk-10.1.0-linux-x86_64.tar.bz2 1.824 GB 498ebae28243de399bb9a59fbde1d04b24653e64

How to build

You can also build the distribution from sources if you don't want to use the prebuilt versions for some reason. Follow the instructions below.

Setting up the build environment:

Follow the instructions from the AOSP site (except the Java part):

WARNING!!! Building the Windows version of CrystaX NDK is only supported on a Linux host (cross-build used). Building on a Windows host is not tested and not supported.

Building NDK

  • Download the build script and run it.
    Example:
    \curl -sSL https://www.crystax.net/download/ndk-crystax-r10-build.sh | /bin/bash
    It will take a long time - up to many hours. When the script is finished, it will print the directory containing the package with the NDK release.
  • You're done! Use this package as a drop-in replacement for Google's NDK!

Back
Home
Map
Back
Home
Map