Skip to content

Instantly share code, notes, and snippets.

@Nathaniel100
Created June 22, 2016 03:19
Show Gist options
  • Save Nathaniel100/89a6261be29d7a987a69d7c7469f60d9 to your computer and use it in GitHub Desktop.
Save Nathaniel100/89a6261be29d7a987a69d7c7469f60d9 to your computer and use it in GitHub Desktop.
NDK uses clang

libc++_static isn't a proper value for APP_STL, it should be c++_static here.

NDK_TOOLCHAIN_VERSION has no effect when set inside Android.mk, it should be set inside Application.mk

LOCAL_CLANG is a variable used inside system modules from AOSP, not when using the NDK.

Since you're setting APP_STL as c++_static, the NDK toolchain will correctly tell the linker what lib to use, you shouldn't add LOCAL_LDLIBS := -lc++_static.

Also, you set APP_ABI to only armeabi-v7a, is it on purpose ? Android runs on other architectures as well and you'll get better performance on these if you also compile your libraries accordingly. You can either set APP_ABI to all or to a list of architectures armeabi-v7a x86...

In summary:

  • Android.mk
LOCAL_CFLAGS := -std=c++11
  • Application.mk
NDK_TOOLCHAIN_VERSION := clang

APP_PLATFORM    := android-9
APP_STL         := c++_static
APP_CPPFLAGS    := -fexceptions -frtti
APP_ABI         := all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment