Topic Author
Posts: 4
Joined: 08 Oct 2017, 12:45

Undefined references for typeinfo building Native Android NDK client with latest C++ Native SDK v2.0.2f2

16 Oct 2017, 06:59

I'm using the latest C++ Native SDK v2.0.2f2 which includes libNoesis.so libraries for x86 and armeabi.
I'm getting undefined references for typeinfo for three symbols, when building an Android NDK client with these libraries:
  • NoesisGUI-NativeSDK-2.0.2f2/Bin/android_arm/libNoesis.so
  • NoesisGUI-NativeSDK-2.0.2f2/Bin/android_x86/libNoesis.so

I'm concluding that the objects that would have defined these missing references (in libNoesis.so) were built without rtti:
  • Noesis::Render::RenderDevice
  • Noesis::Render::Texture
  • Noesis::Render::RenderTarget

I've spent considerable time ruling out a number of user error scenarios on my side.
  • I have dumped symbol table info for the libNoesis.so's and demangled the names (using the Android toolroots), so I know the symbol definitions are there. Although presumably the typeinfo for the symbol definitions is missing.
    Googling the error indicates that this is typical when certain objects weren't built with rtti enabled.
    I've also verified that my code is built with -frtti
    I get the same errors when building with each ABI (x86 and armeabi).
As a sanity check I'm including my link command output, and my gradle.build file.
Suggestions on what I might be doing wrong are welcome.


This is the link command output for the x86 build. I get pretty much the same output when I build for armeabi.

* What went wrong:
Execution failed for task ':app:externalNativeBuildDebug'.
> Build command failed.
Error while executing '/home/waldo/DevFiles/Android/Sdk/cmake/3.6.4111459/bin/cmake' with arguments {--build /home/waldo/client/proto2-app/app/.externalNativeBuild/cmake/debug/armeabi --target SampleApp}
[1/1] Linking CXX shared library ../../../../build/intermediates/cmake/debug/obj/armeabi/libSampleApp.so
FAILED: : && /home/waldo/DevFiles/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=armv5te-none-linux-androideabi --gcc-toolchain=/home/waldo/DevFiles/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot=/home/waldo/DevFiles/Android/Sdk/ndk-bundle/sysroot -fPIC -isystem /home/waldo/DevFiles/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=18 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -D__arm__ -frtti -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a --sysroot /home/waldo/DevFiles/Android/Sdk/ndk-bundle/platforms/android-18/arch-arm -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libSampleApp.so -o ../../../../build/intermediates/cmake/debug/obj/armeabi/libSampleApp.so CMakeFiles/SampleApp.dir/src/main/cpp/HelloTriangle.cpp.o CMakeFiles/SampleApp.dir/src/main/cpp/GLRenderDevice.cpp.o CMakeFiles/SampleApp.dir/src/main/cpp/pch.cpp.o CMakeFiles/SampleApp.dir/src/main/cpp/Timer.cpp.o ../../../../../../external/NoesisGUI/lib/armeabi/libNoesis.so libapp-glue.a /home/waldo/DevFiles/Android/Sdk/ndk-bundle/platforms/android-18/arch-arm/usr/lib/libandroid.so -lEGL -lGLESv2 /home/waldo/DevFiles/Android/Sdk/ndk-bundle/platforms/android-18/arch-arm/usr/lib/liblog.so -lm "/home/waldo/DevFiles/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/libgnustl_static.a" "-latomic" && :
CMakeFiles/SampleApp.dir/src/main/cpp/GLRenderDevice.cpp.o:/home/waldo/client/proto2-app/app/src/main/cpp/GLRenderDevice.cpp:typeinfo for Noesis::Render::GLRenderDevice: error: undefined reference to 'typeinfo for Noesis::Render::RenderDevice'
CMakeFiles/SampleApp.dir/src/main/cpp/GLRenderDevice.cpp.o:/home/waldo/client/proto2-app/app/src/main/cpp/GLRenderDevice.cpp:typeinfo for GLTexture: error: undefined reference to 'typeinfo for Noesis::Render::Texture'
CMakeFiles/SampleApp.dir/src/main/cpp/GLRenderDevice.cpp.o:/home/waldo/client/proto2-app/app/src/main/cpp/GLRenderDevice.cpp:typeinfo for GLRenderTarget: error: undefined reference to 'typeinfo for Noesis::Render::RenderTarget'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.


This is my gradle.build file:

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.example.hellotriangle"
minSdkVersion 18
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

ndk {
abiFilters 'x86', 'armeabi'
externalNativeBuild {
cmake {
// Using options that presumably match what was used when libNeosis.so was built
cppFlags "-std=c++11 -frtti "
arguments "-DANDROID_STL=gnustl_static"


buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

debug {


sourceSets {
main {
// let gradle pack the shared library into apk
jniLibs.srcDirs = ['../../external/NoesisGUI/lib']

externalNativeBuild {
cmake {
path "CMakeLists.txt"
User avatar
Site Admin
Posts: 3997
Joined: 20 Jan 2012, 17:18

Re: Undefined references for typeinfo building Native Android NDK client with latest C++ Native SDK v2.0.2f2

18 Oct 2017, 04:11

Can you compile without rrti as a workaround? GCC and Clang are not very friendly when mixing rrti and non-rrti modules (Visual Studio is better in this aspect). This is the reason we have noesisGUI compiled with rtti for iOS and macOS and it seems we should be doing the same for Android.

Who is online

Users browsing this forum: No registered users and 8 guests