1
votes

After reading a lot of post about Make and NDK, i still not able to have c++11 support.

In My Application.mk file :

NDK_TOOLCHAIN_VERSION := clang
APP_CPPFLAGS += -std=c++11
APP_STL := gnustl_static
APP_BUILD_SCRIPT := Android.mk 

Then in my Android.mk file :

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := Core

# =======================================================================
#                       Includes Directories
# =======================================================================
LOCAL_C_INCLUDES := ${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.8/include
LOCAL_C_INCLUDES += ${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/Include

# Boost:
LOCAL_C_INCLUDES += $(BOOST_PATH)

# Python:
LOCAL_C_INCLUDES += $(PYTHON_PATH)

# Core Includes: 
LOCAL_C_INCLUDES += $(LOCAL_PATH)/Core

LOCAL_SRC_FILES :=  /Sources/FluxV3/Sources/DotFlux/Core/Application/AppBase.cpp

include $(BUILD_STATIC_LIBRARY)

Then in th ndk-build log i have this message :

In file included from /Sources/Android/SDK/android-ndk-r10b/sources/cxx-stl/gnu-libstdc++/4.8/include/initializer_list:36:0, from /Sources/Boost-for-Android-master/boost_1_53_0/boost/smart_ptr/make_shared_array.hpp:18, from /Sources/Boost-for-Android-master/boost_1_53_0/boost/smart_ptr/make_shared.hpp:18, from /Sources/Boost-for-Android-master/boost_1_53_0/boost/make_shared.hpp:15, from /Sources/FluxV3/Sources/DotFlux/Core/OSMin.hpp:114, from /Sources/FluxV3/Sources/DotFlux/CoreDef.hpp:34, from /Sources/FluxV3/Sources/DotFlux/CoreMin.hpp:26, from /Sources/FluxV3/Sources/DotFlux/CoreBase.hpp:26, from /Sources/FluxV3/Sources/DotFlux/Core.hpp:26, from /Sources/FluxV3/Sources/DotFlux/Core/PCH/pch.hpp:24, from /Sources/FluxV3/Sources/DotFlux/Core/Application/AppBase.cpp:21: /Sources/Android/SDK/android-ndk-r10b/sources/cxx-stl/gnu-libstdc++/4.8/include/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options..

Another thing is that i do not have the Android preprocessor raised into my code.

Any help would be nice. Thanks.

EDIT :

/Sources/Android/SDK/android-ndk-r10b/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++ -MMD -MP -MF ./obj/local/armeabi/objs/Core//Sources/FluxV3/Sources/DotFlux/Core/Application/AppBase.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I/Sources/FluxV3/Sources/DotFlux/Core -I/Sources/FluxV3/Sources/DotFlux/Core/PCH -I/Sources/Boost-for-Android-master/boost_1_53_0 -I/Sources/Android/SDK/android-ndk-r10b/sources/cxx-stl/gnu-libstdc++/4.8/include -I/Sources/Android/SDK/android-ndk-r10b/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/Include -I/Sources/Android/SDK/android-ndk-r10b/sources/cxx-stl/system/include -I/Sources/FluxV3/Sources/DotFlux -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -pthread -I/Sources/Android/SDK/android-ndk-r10b/platforms/android-3/arch-arm/usr/include -c /Sources/FluxV3/Sources/DotFlux/Core/Application/AppBase.cpp -o ./obj/local/armeabi/objs/Core//Sources/FluxV3/Sources/DotFlux/Core/Application/AppBase.o

We see that std=c++11 and -pthread are set.

1
Check your Application.mk file. Even though it set clang as the toolchain, the compiler being used is GCC 4.6 (from your last Edit). Try setting the toolchain to 4.8 and see if it changes anything. - user1906
Got it! thanks for the tips. Effectively Clang is not suitable. - Ziggy
Got it! thanks for the tips. Effectively Clang is not suitable. GCC4.6 did the job. - Ziggy
Use an NDK with GCC 4.8 or 4.9 and above. If you need to switch to STLport due to contractual obligations, then see Issue 216331: STLport does not support C++11 on the AOSP bug tracker. - jww

1 Answers

1
votes

I answer from user1906 :

"Check your Application.mk file. Even though it set clang as the toolchain, the compiler being used is GCC 4.6 (from your last Edit). Try setting the toolchain to 4.8 and see if it changes anything. "