Saturday, December 7, 2013

NDK and c++11 and GPL issue

According to "https://vilimpoc.org/blog/2013/10/05/c11-support-on-android-with-g-4-8/", ndk supports c++11 very well with gcc 4.8 and gnustl_static. I also compile my code with clang3.3, it works so far. So I assume clang works as well.

Note that, modern c++11 works only with gnustl. stlport is free, but does not support c++11. At least, my c++11 can not compile without gnustl.

You could set up the environment manually with ndk-build or put them in your Application.mk like this

APP_STL := gnustl_static
APP_ABI := armeabi
NDK_TOOLCHAIN_VERSION := clang
#NDK_TOOLCHAIN_VERSION := 4.8
APP_CPPFLAGS += -std=c++11

There is a little GPL license trick here. gnustl is with GPL. I am to lazy to read the license line by line. So, correct me if I am wrong. To my understanding, you should be fine with static link to gnustl. This means your stuff has not to be GPL via only static linking to gnustl, due to GPLv3 run time exception. However, you would better not use dynamic link to it.

No comments:

Post a Comment