New CrystaX NDK 10.3.2 is available, offering numerous great features and improvements; perhaps you should check it out instead of using old one.
Here is customized distribution of Android NDK r7 which I have rebuilt from official sources. Starting from NDK r5, Google added support of C++ exceptions, RTTI and STL to the official NDK. That's good but not enough for many peoples including me. Starting from r5-crystax-1, main goal of this project will be improvements of official NDK (after all, this is the best way to integrate such improvements into mainline - that's how it was with full C++ support in Google's NDK).
Features supported by CrystaX NDK:
- Wide characters.
Google's NDK doesn't support wide chars properly - neither in C or C++. Using CrystaX NDK you get full standard compliant wide characters support. You can easily port existing code which use wide characters/strings/streams or write new one.
- New 4.6.3 toolchain
Starting from r7-crystax-1, CrystaX NDK contains two versions of compiler toolchain: 4.4.3 (old one, the same as Google use) and 4.6.3 (new one).
New toolchain contains GCC 4.6.3 with enabled Graphite framework allowing gcc do high-level memory optimizations.
By default 4.6.3 toolchain is not enabled. That's done to be compatible with Google's NDK. To enable it for your application, just add following to the app's Application.mk:
APP_TOOLCHAIN_VERSION := 4.6.3
- C++11 support (formerly known as C++0x)
Google's NDK offer GCC 4.4.3 which is good compiler but doesn't support some modern features. One of such features is support of new International Standard known as C++11 (formerly known as C++0x). There is very limited support of C++0x features in GCC 4.4.3.
Using CrystaX NDK you can start use many of new C++0x features right now. Of course, there is no yet full C++11 support in GCC 4.6.3 but GCC team works very intensively on that and it already contains many very usable features (lambdas, decltype, auto and many others). To see full list of C++0x features supported, look to GCC C++ Support page.
To use C++0x features in your project, just add following to the app's Application.mk:
APP_USE_CPP0X := trueNote that in this case new 4.6.3 toolchain implicitly selected.
- Objective-C support
The only languages Google NDK supports are C and C++. Starting from r7-crystax-4, CrystaX NDK support additionally Objective-C. This is experimental feature, but at least core language works fine. Of course, just core language is not enough; peoples who use Objective-C, rely on libraries like Cocoa (formerly known as NeXTSTEP/OpenStep). I understand that and don't stop on this stage. I've planned port GNUStep on Android, but this is not so easy task and it can't be done quickly. In the meantime I suppose many peoples could start using Objective-C as is.
To start using Objective-C in your project, just add source files with extension .m (Objective-C) or .mm (Objective-C++) and specify them in LOCAL_SRC_FILES in Android.mk.
- Static code analysis
Android NDK uses GCC which analyze code pretty good and warn about potential errors (especially with -Wall -Wextra) but, as every developer knows, there could not be reviews enough. Really, sometime we do absolutely dumb mistakes and pass them to the production. To decrease number of such mistakes, experienced developers uses static code analyzers. There are many such tools (open source and proprietary) so choice is not easy.
Clang project offer code analyzer which is pretty good in many situations. This is the same analyzer known to Apple developers through "Build and analyze" XCode's menu item. With CrystaX NDK, you can start use it with Android too. To do that, you need install clang and ensure you have 'scan-build' script from Clang distribution accessible from command-line. Then, start build your project:
ndk-build ANALYZE=1I plan support more static code analyzers but have not specific plans yet.
- To be continued...
Seriously, if you don't see some feature here, request me to do that! Use my issue/bug tracker to report bugs or feature requests. I would be glad to implement such features if many of peoples need them. And, of course, contributes are welcome!
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/$tc/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.
How to build
You can also build your own distribution if you don't want to use my prebuilt versions. To do that, follow instructions below.
Setting up build environment:Follow instructions from AOSP site except Java part.
WARNING!!! Starting from r5, NDK can be built only on Linux/Mac machines. Windows build is not more supported! However, Windows binaries can be built on Linux using so called "cross-canadian build". To do that, you need install mingw32 package; build script will detect it and build Windows binaries automatically.
- Download build script and run it:
wget -O - https://us.crystax.net/download/ndk-crystax-r7-build.sh | /bin/shIt might take long time, up to several hours. When script will be finished, it'll print directory containing package with NDK release.
- Use this package as replacement of Google's NDK!
Thank you for downloading CrystaX NDK!
CrystaX NDK is a fully open source project, free to use in any open-source and commercial environment. We provide it free for use and don't ask our users to pay in exchange. However, we appreciate your support, through sending us pull requests, spreading the news about CrystaX NDK over the world, or just donating:
Who we are
We're a small team of developers who want to make development for Android easier. Our goal is to create a comprehensive toolkit for native development for Android on C, C++, Objective-C, and, potentially, in other programming languages already working on modern POSIX systems (Swift, D, Haskell, Ocaml, Python, Ruby - you name it).
We've already done a lot (as you can see on our main project page), but we want to do even more. We have a long way to go, but we know how to do it and can clearly see the steps required to make it happen. You can read more about us here.
Why we need your support
Since we started working on CrystaX NDK, we have funded ourselves without any sponsorship. That has led us to make money in other ways (such as working as contractors and doing consulting jobs on other projects) and invest our earnings in the CrystaX NDK project. Because of this we have only been able to work on NDK part-time, which means it is not as powerful as it could be.
Having support from the community, we could pay more attention to CrystaX NDK development, without the distraction on paid contracts. This will speed up CrystaX NDK development as well as bug fixing and support.
Optionally, sponsors (those who send us $200/month or more) get in exchange a number of perks - they get priority for consulting or training needs, they can be listed on the front page of the CrystaX website and mentioned in the project README, etc. Please read here for more details about sponsoring options.
When the download is finished, please check that the downloaded file is not corrupted!
The SHA-256 hash must be .
Here is an example of how to check it using OpenSSL:
$ CHECKSUM= && \ FILE= && \ diff <(openssl sha256 $FILE) <(echo "SHA256($FILE)= $CHECKSUM") \ && echo 'OK' || echo '*** CORRUPTED!!!'