I am trying to cross-compile our C ++ code base (using CMake) for the Android platform using r5b NDK on Ubuntu 10.10. The compilation phase succeeds, however, during the last phase of the link for .so there are many unresolved symbol references that are in the libsupC ++ file. (Which I quote for reference). I also tried -supC ++ no difference.
I tried as closely as possible to follow the command line created by the official ndk-build system when creating the test application gnustl-1 NDK.
Run the arm-linux-androideabi-nm tool on the arm-linux-androideabi / lib / libsup ++ file. The file shows the characters defined (T) indicated in the error output.
An example of a symbol defined in libsupC ++ that it cannot find: __gxx_personality_v0
Here is my sample link line and the resulting error pattern.
/home/user/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-g++ -fPIC -Wall -Wextra -Wno-unused -Wno-multichar -fno-rtti -MMD -MP -MF -ffunction-sections -fexceptions -funwind-tables -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wa,--noexecstack -DANDROID -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -O0 -DDEBUG -D_DEBUG -g --sysroot=/home/user/android-ndk-r5b/platforms/android-9/arch-arm -Wl,--gc-sections -Wl,-z,nocopyreloc -Wl,--no-undefined,-z,noexecstack -L/home/user/android-ndk-r5b/platforms/android-9/arch-arm/usr/lib -L/home/user/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/arm-linux-androideabi/lib -Wl,-rpath-link=/home/user/android-ndk-r5b/platforms/android-9/arch-arm/usr/lib /home/user/android-ndk-r5b/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a -lc -lsupc++ -shared -o ../../lib/Debug/libFoo.so CMakeFiles/Foo.dir/Foo.co CMakeFiles/Foo.dir/Bar.cpp.o CMakeFiles/Foo.dir/Baz.cpp.o
`CMakeFiles/Foo.dir/Foo.cpp.o: In function 'myFunc': /home/user/myroj/src/native/modules/libFoo/Foo.cpp:292: undefined reference to '__cxa_end_cleanup' CMakeFiles/Foo.dir/Foo.cpp.o:(.ARM.extab.text.myFunc+0x0): undefined reference to '__gxx_personality_v0' ... /home/user/android-ndk-r5b/toolchains/android/sources/cxx-stl/gnu-libstdc++/include/bits/vector.tcc:350: undefined reference to '__cxa_begin_catch' /home/user/android-ndk-r5b/toolchains/android/sources/cxx-stl/gnu-libstdc++/include/bits/vector.tcc:357: undefined reference to '__cxa_rethrow' /home/user/android-ndk-r5b/toolchains/android/sources/cxx-stl/gnu-libstdc++/include/bits/stl_vector.h:1153: undefined reference to 'std::__throw_length_error(char const*)' /home/user/android-ndk-r5b/toolchains/android/sources/cxx-stl/gnu-libstdc++/include/bits/stl_tree.h:199: undefined reference to 'std::_Rb_tree_decrement(std::_Rb_tree_node_base*)' ...
I tried to create a simple hello-world application that uses exceptions and links in a simple .a file. I got the same errors until I linked in libsupC ++. The library directly, instead of using '-supC ++'. However, the same method did not work at a larger stage of the project link. The NDK docs also indicate that β-supC ++β should be used when using external build tools.
I have no idea how to solve this communication problem. I tried reordering the link line in as many ways as possible. I know that binding can generally be a volatile process. Any help is appreciated.
android-ndk android-ndk-r5
androider
source share