Does Android NDK SDK support Android NDK r10c and C++11?

iwahara
iwahara
edited December 2014 in Native
Does Photon-Realtime-AndroidNDK-SDK support Android NDK r10c And C++11?
I'm trying to build sources, but always getting the compilation error.
I use cocos2d-x version 3.2 and Android NDK r10c.

Error message is shown below:
jni/../../libs/android/photon/Common-cpp/inc/JString.h:160:10: error: no type named 'basic_ostream' in namespace 'std'
                ::std::basic_ostream<_Elem, _Traits>& operator<<(::std::basic_ostream<_Elem, _Traits>& stream, const JString& string)

jni/../../libs/android/photon/Common-cpp/inc/JString.h:160:23: error: expected unqualified-id
                ::std::basic_ostream<_Elem, _Traits>& operator<<(::std::basic_ostream<_Elem, _Traits>& stream, const JString& string)

my Application.mk:
APP_STL := c++_static
NDK_TOOLCHAIN_VERSION=clang

APP_CPPFLAGS := -fexceptions -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
APP_LDFLAGS := -latomic

Comments

  • Hi iwahara.

    I will have to investigate. The current release has been build with the ndk r8d. I will update my build environment to r10c and test if I can still build against the currently released libs.
  • Hi Kaiserludi.

    The combination of Android NDK and Android Lollipop has a bug.
    It freezes my app when I use sscanf.
    https://code.google.com/p/android/issue ... l?id=77988

    so, I want to use latest Android NDK.
    I'm in trouble. please help me.

    thanks in advance.
  • Hi iwahara.

    I have updated my local build environment to r10c and then unzipped the original 3.2.5.5 package form our download section, navigated to .\Demos\demo_loadBalancing\android\jni, opened debug_android_armeabi.mk, removed all it's previous content and replaced it by the content of your Application.mk.
    Afterwards I have started a cmd instance, naviagated to the path of the just modified file and ran
    C:\NVPACK\android-ndk-r10c/ndk-build NDK_APPLICATION_MK=debug_android_armeabi.mk
    

    That build has been successful. I could not reproduce your issue and all build totally fine for me with rc10c and C++11, so I think the reason of your build errors must be something else.

    Can you reproduce this issue with our demo or does it only happen for your app?

    Do you have to use libc++? Google itself has called it "experimental" in the official release notes when they initially added support for libc++ this March and since then basically each NDK release had to fix critical bugs with libc++ support like the one you have mentioned about sscanf. It may be better to use stdlibc++ (gnu stl) or stlport instead of libc++ (clang stl) on Android NDK for now. They have both been supported by NDK for years and seem to have much less issues.

    If this basic_ostream error is the only one that you get, you may also just out-comment the lines 13-16, 123 and 159-163 in JString.h and see if that helps.
  • Hi Kaiserludi.

    Thanks a lot! You saved my work!!

    It works great when I replace "c++_static" with "gnustl_static" and "NDK_TOOLCHAIN_VERSION=clang" with "NDK_TOOLCHAIN_VERSION=4.9".
  • Great! Thanks for letting us know.