Build of a c++ library for armeabi-v7a
using standalone toolchain is successful.
However, when loaded in Unity I get missing symbol error:
05-11 17:05:32.029 12064 12082 D Unity : Unable to load library '/data/app/com.xxx.yyy.app-geDNMNRtyT09WKhCcElqhg==/lib/arm/lib***.so', native render plugin support disabled: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZNSsD1Ev" referenced by "/data/app/com.xxx.yyy.app-geDNMNRtyT09WKhCcElqhg==/lib/arm/lib***.so"...
which is std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
.
When checked compiled library with nm
, I see this symbol indeed undefined:
$ nm lib***.so
U _ZNSsD1Ev
I also can see that the library depends on shared libstdc++.so
:
$ readelf -d build/lib/lib***.so
...
0x00000001 (NEEDED) Shared library: [libsqlite3.so]
0x00000001 (NEEDED) Shared library: [libopenssl.so]
0x00000001 (NEEDED) Shared library: [libndn-cpp.so]
0x00000001 (NEEDED) Shared library: [liblog.so]
0x00000001 (NEEDED) Shared library: [libOpenSLES.so]
0x00000001 (NEEDED) Shared library: [libstdc++.so]
0x00000001 (NEEDED) Shared library: [libm.so]
0x00000001 (NEEDED) Shared library: [libc.so]
0x00000001 (NEEDED) Shared library: [libdl.so]
...
even though I setup autotools with -static-libstdc++
:
CFLAGS="-isystem $TOOLCHAIN/include/c++/4.9.x/ --sysroot=$TOOLCHAIN/sysroot -I$TOOLCHAIN/sysroot/usr/include -I$TOOLCHAIN/include"
CPPFLAGS="-isystem $TOOLCHAIN/include/c++/4.9.x/ --sysroot=$TOOLCHAIN/sysroot -I$TOOLCHAIN/sysroot/usr/include -I$TOOLCHAIN/include -DWEBRTC_POSIX -DBOOST_ASIO_DISABLE_STD_CHRONO $CPPFLAGS -DWEBRTC_POSIX -DBOOST_ASIO_DISABLE_STD_CHRONO -g -O0"
CXXFLAGS="$CXXFLAGS -DWEBRTC_POSIX -DBOOST_ASIO_DISABLE_STD_CHRONO -g -O0"
LDFLAGS="-static-libstdc++ -L$TOOLCHAIN/sysroot/usr/lib -L$TOOLCHAIN/arm-linux-androideabi/lib -L$TOOLCHAIN/arm-linux-androideabi/lib/armv7-a -lOpenSLES -lm -lsqlite3 -lopenssl"
What's interesting, is that when I search toolchain's libraries, the missing symbol shows up only in libgnustl_shared.so
:
$ nm $TOOLCHAIN/arm-linux-androideabi/lib/armv7-a/libgnustl_shared.so | grep "_ZNSsD1Ev"
00096568 W _ZNSsD1Ev
Not quite sure why is this happening, as there is no (obvious) dependency on libgnustl_shared.so
as far as I can tell.
User contributions licensed under CC BY-SA 3.0