Std :: ndk r8c card linker error with APP_STL: = gnustl_static

I have an STL issue in my native application. The binding fails with the map :: operator [] and map :: insert functions, as well as with other map functions. My Application.mk:

APP_STL := gnustl_static APP_CPPFLAGS := -fexceptions -frtti APP_CPPFLAGS += -g3 APP_CPPFLAGS += -DDEBUG APP_ABI := armeabi-v7a APP_PLATFORM:=android-14 NDK_TOOLCHAIN_VERSION:=4.6 

The native code contains two levels of the folder. I created an Android.mk file for each internal folder to compile and create a static library. I use std :: map in the deepest folder. Android.mk looks like this:

 TEMP_PATH_REG := $(call my-dir) LOCAL_PATH := $(TEMP_PATH_REG) include $(call all-subdir-makefiles) LOCAL_PATH := $(TEMP_PATH_REG) include $(CLEAR_VARS) LOCAL_MODULE := registration LOCAL_C_INCLUDES := $(LOCAL_PATH)/../glm/ LOCAL_SRC_FILES := registration_factory.cpp \ inertial.cpp LOCAL_LDLIBS := -llog -landroid -lEGL LOCAL_STATIC_LIBRARIES := android_native_app_glue include $(BUILD_STATIC_LIBRARY) $(call import-module,android/native_app_glue) 

When I create a project, I get the following errors:

 ~/.android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/libregistration.a(registration_factory.o): in function std::_Rb_tree<int, std::pair<int const, xmar::IRegistration*>, std::_Select1st<std::pair<int const, xmar::IRegistration*> >, std::less<int>, std::allocator<std::pair<int const, xmar::IRegistration*> > >::_M_insert_(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base const*, std::pair<int const, xmar::IRegistration*> const&):~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h:1013: error: undefined reference to 'std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)' StaticLibrary : libandroid_native_app_glue.a rm -f obj/local/armeabi-v7a/libandroid_native_app_glue.a ~/.android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/libregistration.a(registration_factory.o): in function std::_Rb_tree_const_iterator<std::pair<int const, xmar::IRegistration*> >::operator--():~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h:284: error: undefined reference to 'std::_Rb_tree_decrement(std::_Rb_tree_node_base const*)' ~/.android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-ar crs ./obj/local/armeabi-v7a/libandroid_native_app_glue.a ./obj/local/armeabi-v7a/objs-debug/android_native_app_glue/android_native_app_glue.o ~/.android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/libregistration.a(registration_factory.o): in function std::_Rb_tree_const_iterator<std::pair<int const, xmar::IRegistration*> >::operator++():~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h:269: error: undefined reference to 'std::_Rb_tree_increment(std::_Rb_tree_node_base const*)' Prebuilt : libgnustl_static.a <= <NDK>/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/ ~/.android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/libregistration.a(registration_factory.o): in function std::_Rb_tree_iterator<std::pair<int const, xmar::IRegistration*> >::operator--():~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h:203: error: undefined reference to 'std::_Rb_tree_decrement(std::_Rb_tree_node_base*)' 

How am I wrong?

Thank you very much.

+4
source share
1 answer

I found a workaround to compile the project.

 LOCAL_LDLIBS += ~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libsupc++.a LOCAL_LDLIBS += ~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a 
+4
source

All Articles