Error while compiling it for Android

codesnooker
edited March 2013 in Native
Hi Guys,

I am using Photon Cloud server and Cocos2d-x for game development on Android and iOS platform.

Currently I have managed to run the multiplayer game on iOS and now trying to compile it for Android. I followed the blog: http://codebygeorgeguy.wordpress.com/20 ... 2-android/

However, I am getting following error. Any idea what's going wrong?


/obj/local/armeabi/libcommon-c-static_release_android_armeabi.a(platformLayer-unix.o): In function `std::vector<unsigned char, std::allocator<unsigned char> >::_M_insert_overflow(unsigned char*, unsigned char const&, std::__true_type const&, unsigned int, bool) [clone .clone.0]':
platformLayer-unix.cpp:(.text+0x3b0): undefined reference to `std::__node_alloc::_M_deallocate(void*, unsigned int)'
platformLayer-unix.cpp:(.text+0x3cc): undefined reference to `std::__stl_throw_length_error(char const*)'
platformLayer-unix.cpp:(.text+0x42c): undefined reference to `std::__node_alloc::_M_allocate(unsigned int&)'
./obj/local/armeabi/libcommon-c-static_release_android_armeabi.a(platformLayer-unix.o): In function `std::vector<wchar_t, std::allocator<wchar_t> >::_M_insert_overflow(wchar_t*, wchar_t const&, std::__true_type const&, unsigned int, bool) [clone .clone.1]':
platformLayer-unix.cpp:(.text+0x4d0): undefined reference to `std::__node_alloc::_M_deallocate(void*, unsigned int)'
platformLayer-unix.cpp:(.text+0x504): undefined reference to `std::__node_alloc::_M_allocate(unsigned int&)'
./obj/local/armeabi/libcommon-c-static_release_android_armeabi.a(platformLayer-unix.o): In function `UTF82Unicode':
platformLayer-unix.cpp:(.text+0x63c): undefined reference to `std::__node_alloc::_M_deallocate(void*, unsigned int)'
./obj/local/armeabi/libcommon-c-static_release_android_armeabi.a(platformLayer-unix.o): In function `Unicode2UTF8':
platformLayer-unix.cpp:(.text+0x7c8): undefined reference to `std::__node_alloc::_M_deallocate(void*, unsigned int)'
./obj/local/armeabi/libcommon-c-static_release_android_armeabi.a(platformLayer-unix.o): In function `SizeOfWStrAsUTF8':
platformLayer-unix.cpp:(.text+0x930): undefined reference to `std::__node_alloc::_M_deallocate(void*, unsigned int)'
collect2: ld returned 1 exit status

Comments

  • Just to be sure, I am using following variable in Application.mk

    APP_STL := gnustl_static
    APP_CPPFLAGS := -frtti
  • Hi codesnooker.

    We could not reproduce this. It works fine for us with demo-realtime from the SDK, although that demo also uses gnu static stl as stl setting.

    As the linked tuorial is about that version, I would guess that you are using 3.0.4.0 or above of the client SDK, correct? We have had a similar issue in the past, but that has been resolved some time around version 3.0.1.x, already.

    I would suggest, that you check, if you can reproduce this issue with the realtime demo and if not, track down the differences between that demo and your app to see whats causing it.
  • It solved by changing following variable:-

    APP_STL := stlport_static
  • It should definitely also work with APP_STL := gnustl_static, but if you can also use stlport, that's fine, too.
  • I don't think this is Photon issue.
    Many of others not using Photon saying about this problems.

    anyway, gnustl_static and stlport_static neither not works for me.
    But I solved it by, stlport_shared.
    I don't know why, but it works.
  • In SDK v3-2-0-0
    I got no compile issue.

    It compiled both gnustl_static and stlport_static with no error.
  • Nice to know, that the new version fixes this issue. Thanks.