Developers Club geek daily blog

1 year, 1 month ago
The new CrystaX NDK 10.3.0 version is available to downloading.

The most important changes in this release:

  • New GCC and LLVM/clang.
  • Support of Objective-C v2 is strongly improved.
  • Support of Python (2.7 and 3.5) for Android is added.


Besides, many errors are repaired and the huge number of improvements is made. Below you can study more detailed information.


New GCC and LLVM/clang



In this release we added the new tulcheyna based on gcc-5.3 and llvm-3.7. Old gcc-4.9 and llvm-3.6 are also present for compatibility, but will be deleted in the following release.

Needless to say that it means to developers, especially in the light of actively developing gcc and clang in respect of support of the new C, C standards ++ and Objective-C. Now you can use the most advanced language features and for Android.

Also, in this release we passed completely to own branches of GCC and LLVM/clang which are based on upstream with the minimum point changes (before gcc and clang in CrystaX NDK were branched off from Google's gcc and clang). The fact that at us quite big "test weight" allowing to claim with a certain degree of confidence that the compiler coping with all our tests is a suitable, working compiler collected helped to make such decision.

This solution, though was difficult, nevertheless it was very correct since now process of the gcc and clang updating to new versions is very simple and occurs in a semi-automatic mode. So, updating to gcc-5.3 took only three days from which 20 minutes merge from upstream-ohms took, the next 20 hours — assembly of a new bild and two more days — complete run of automatic tests. From them only the first part demanded handwork.

$ $NDK/toolchains/arm-linux-androideabi-5/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc --version
arm-linux-androideabi-gcc (GCC) 5.3 20151204
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ $NDK/toolchains/llvm-3.7/prebuilt/linux-x86_64/bin/clang -target armv7-none-linux-androideabi --version
clang version 3.7
Target: armv7-none-linux-android
Thread model: posix


The improved Objective-C v2



We very strongly improved rantaym Objective-C v2 and it allowed us to include all language opportunities of modern Objective-C — Automatic Reference Counting, Objective-C Literals syntax, etc. Also, in this release we added Objective-C frameworks of CoreData, CoreText, CoreGraphics and CoreVideo, in addition to earlier added Foundation and CoreFoundation.

For convenience the example showing how it is possible to use Objective-C for development of the project for iOS and Android at once was created.

ATTENTION! All declared possibilities of modern Objective-C v2 are available only when using LLVM/clang. If you use ndk-build, by the elementary method it will be to specify adding of the next lines in Application.mk:

# Application.mk
NDK_TOOLCHAIN_VERSION := clang


Python for Android



We provide the collected binarnik of python-2.7 and python-3.5 (the performed files, libraries and heading files) for all supported Android ABI. As well as all other similar packets in CrystaX NDK, Python it was built from official source codes, without uniform change in its code. This direct consequence of our approach: when something does not gather, we do not govern the collected code. Instead we repair CrystaX NDK, doing behavior of nizhneurovnevy libraries to the conforming standards (to POSIX and de facto standards, it as GNU/Linux).

Python in CrystaX NDK is in an experimental status so far though it also works quite well as far as we see. Nevertheless, it it is still not so good ottestirovan as other components therefore in it there can be errors or partially absent functionality. If you will find similar flaws, do not hesitate to report to us about them!

We want to tell many thanks to Vitaly Murashev (@vitaly-murashev) — Python appeared in CrystaX NDK mainly thanks to its help. It also is how open source works: to make something for pleasure and to share results with community. Vitaly, once again thanks!

Collected binarnik of Python lie in directories of $NDK/sources/python/2.7 and $NDK/sources/python/3.5. If you use ndk-build, here an example of use of Python in your project:

# Android.mk
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE           := mymodule
LOCAL_SRC_FILES        := ...
LOCAL_SHARED_LIBRARIES := python_shared
include $(BUILD_SHARED_LIBRARY)

# Replace 3.5 by 2.7 if needed
$(call import-module,python/3.5)


Support of POSIX



We continue to improve support of POSIX in CrystaX NDK. In this release we transferred to libcrystax.so (CrystaX NDK heart) even more POSIX of interfaces therefore now it depends on Google libc even less. Actually, the only most part of POSIX which is not implemented in libcrystax.so yet is POSIX threads. It — what we are going to correct in the following release. Thereby we will be able to get rid of dependence on Google libc, having completely replaced it with libcrystax.so.

Within our work on improvement of support of POSIX, we integrated Open POSIX Test Suite into process of automatic testing of CrystaX NDK. Thanks to it, we can be sure that libcrystax.so provides implementation, really corresponding POSIX.

Boost 1.59.0



We included collected libraries and the heading Boost 1.59.0 files in structure of CrystaX NDK. Now they gather in two options — with use of GNU libstdc ++ and LLVM libc ++ implementations of standard library C ++. Earlier we provided the Boost libraries which are brought together only with GNU libstdc ++ thereby forcing users to specify gnustl in the projects. Now you can specify any of two: ndk-build will automatically determine a preferred choice and will connect the correct versions of Boost libraries.

Also, because we have Python for Android now, we began to collect and test Boost.Python. This work is not finished yet, but we continue to work on it and over time the situation will improve.

CrystaX — officially approved tester for the Boost project. It means that we in a continuous mode test Boost libraries, publishing results on the official site (master, develop). It works for advantage both Boost, and CrystaX NDK. Users of Boost have an opportunity to use ottestirovanny libraries Boost on Android, and users of CrystaX NDK win because that CrystaX NDK is in turn tested by Boost tests and by that good degree of compliance to the POSIX and C standards ++ is practically proved.

Total



Besides, in this release a large number of small improvements and corrections was made. The complete list of the closed tiket is here.

This article is a translation of the original post at habrahabr.ru/post/273053/
If you have any questions regarding the material covered in the article above, please, contact the original author of the post.
If you have any complaints about this article or you want this article to be deleted, please, drop an email here: sysmagazine.com@gmail.com.

We believe that the knowledge, which is available at the most popular Russian IT blog habrahabr.ru, should be accessed by everyone, even though it is poorly translated.
Shared knowledge makes the world better.
Best wishes.

comments powered by Disqus