1

I am trying to develop an application for android using VTK for android. I have compile all the sources so far everything have worked just fine.

Now I'm stuck here, an undefined reference error which is:

Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 8 in /Users/lonnibesancon/Documents/workspace/TestNativecopy/AndroidManifest.xml    
[armeabi-v7a] Compile++ thumb: ndk1 <= native.cxx
[armeabi-v7a] Compile thumb  : android_native_app_glue <= android_native_app_glue.c
[armeabi-v7a] StaticLibrary  : libandroid_native_app_glue.a
[armeabi-v7a] SharedLibrary  : libndk1.so
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkNew.h:66: error: undefined reference to 'vtkRenderWindow::New()'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkNew.h:66: error: undefined reference to 'vtkRenderer::New()'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkNew.h:66: error: undefined reference to 'vtkAndroidRenderWindowInteractor::New()'
/Users/lonnibesancon/Documents/workspace/TestNativecopy/jni/native.cxx:61: error: undefined reference to 'vtkRenderWindowInteractor::SetRenderWindow(vtkRenderWindow*)'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkNew.h:66: error: undefined reference to 'vtkSphereSource::New()'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkNew.h:66: error: undefined reference to 'vtkPolyDataMapper::New()'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkAlgorithm.h:391: error: undefined reference to 'vtkAlgorithm::GetOutputPort(int)'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkNew.h:66: error: undefined reference to 'vtkActor::New()'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkNew.h:66: error: undefined reference to 'vtkConeSource::New()'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkNew.h:66: error: undefined reference to 'vtkGlyph3D::New()'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkAlgorithm.h:391: error: undefined reference to 'vtkAlgorithm::GetOutputPort(int)'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkAlgorithm.h:391: error: undefined reference to 'vtkAlgorithm::GetOutputPort(int)'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkGlyph3D.h:131: error: undefined reference to 'vtkGlyph3D::SetSourceConnection(int, vtkAlgorithmOutput*)'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkNew.h:66: error: undefined reference to 'vtkPolyDataMapper::New()'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkAlgorithm.h:391: error: undefined reference to 'vtkAlgorithm::GetOutputPort(int)'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkNew.h:66: error: undefined reference to 'vtkActor::New()'
/Users/lonnibesancon/Documents/workspace/TestNativecopy/jni/native.cxx:88: error: undefined reference to 'vtkRenderer::AddActor(vtkProp*)'
/Users/lonnibesancon/Documents/workspace/TestNativecopy/jni/native.cxx:89: error: undefined reference to 'vtkRenderer::AddActor(vtkProp*)'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkDebugLeaksManager.h:39: error: undefined reference to 'vtkDebugLeaksManager::vtkDebugLeaksManager()'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkDebugLeaksManager.h:39: error: undefined reference to 'vtkDebugLeaksManager::~vtkDebugLeaksManager()'
/Users/lonnibesancon/android-ndk-r10e/sources/android/native_app_glue/android_native_app_glue.c:190: error: undefined reference to 'AInputQueue_getEvent'
/Users/lonnibesancon/android-ndk-r10e/sources/android/native_app_glue/android_native_app_glue.c:192: error: undefined reference to 'AInputQueue_preDispatchEvent'
/Users/lonnibesancon/android-ndk-r10e/sources/android/native_app_glue/android_native_app_glue.c:197: error: undefined reference to 'AInputQueue_finishEvent'
/Users/lonnibesancon/android-ndk-r10e/sources/android/native_app_glue/android_native_app_glue.c:211: error: undefined reference to 'AConfiguration_new'
/Users/lonnibesancon/android-ndk-r10e/sources/android/native_app_glue/android_native_app_glue.c:212: error: undefined reference to 'AConfiguration_fromAssetManager'
/Users/lonnibesancon/android-ndk-r10e/sources/android/native_app_glue/android_native_app_glue.c:66: error: undefined reference to 'AConfiguration_getLanguage'
/Users/lonnibesancon/android-ndk-r10e/sources/android/native_app_glue/android_native_app_glue.c:67: error: undefined reference to 'AConfiguration_getCountry'
/Users/lonnibesancon/android-ndk-r10e/sources/android/native_app_glue/android_native_app_glue.c:223: error: undefined reference to 'ALooper_prepare'
/Users/lonnibesancon/android-ndk-r10e/sources/android/native_app_glue/android_native_app_glue.c:224: error: undefined reference to 'ALooper_addFd'
/Users/lonnibesancon/android-ndk-r10e/sources/android/native_app_glue/android_native_app_glue.c:179: error: undefined reference to 'AInputQueue_detachLooper'
/Users/lonnibesancon/android-ndk-r10e/sources/android/native_app_glue/android_native_app_glue.c:181: error: undefined reference to 'AConfiguration_delete'
/Users/lonnibesancon/android-ndk-r10e/sources/android/native_app_glue/android_native_app_glue.c:95: error: undefined reference to 'AInputQueue_detachLooper'
/Users/lonnibesancon/android-ndk-r10e/sources/android/native_app_glue/android_native_app_glue.c:100: error: undefined reference to 'AInputQueue_attachLooper'
/Users/lonnibesancon/android-ndk-r10e/sources/android/native_app_glue/android_native_app_glue.c:134: error: undefined reference to 'AConfiguration_fromAssetManager'
/Users/lonnibesancon/android-ndk-r10e/sources/android/native_app_glue/android_native_app_glue.c:66: error: undefined reference to 'AConfiguration_getLanguage'
/Users/lonnibesancon/android-ndk-r10e/sources/android/native_app_glue/android_native_app_glue.c:67: error: undefined reference to 'AConfiguration_getCountry'
collect2: error: ld returned 1 exit status
make: *** [/Users/lonnibesancon/Documents/workspace/TestNativecopy/obj/local/armeabi-v7a/libndk1.so] Error 1

The content of my android.mk file is the following:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
# VTK Libs
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkalglib-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkalglib-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkCommonColor-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkCommonColor-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkCommonComputationalGeometry-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkCommonComputationalGeometry-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkCommonCore-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkCommonCore-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkCommonMath-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkCommonMath-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkCommonMisc-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkCommonMisc-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkCommonSystem-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkCommonSystem-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkCommonTransforms-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkCommonTransforms-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkDICOMParser-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkDICOMParser-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkexpat-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkexpat-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkFiltersCore-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkFiltersCore-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkFiltersExtraction-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkFiltersExtraction-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkFiltersGeneral-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkFiltersGeneral-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkFiltersGeometry-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkFiltersGeometry-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkFiltersModeling-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkFiltersModeling-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkFiltersSources-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkFiltersSources-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkFiltersStatistics-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkFiltersStatistics-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkglew-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkglew-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkImagingCore-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkImagingCore-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkImagingFourier-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkImagingFourier-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkImagingHybrid-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkImagingHybrid-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkInfovisCore-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkInfovisCore-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkInteractionStyle-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkInteractionStyle-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkIOCore-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkIOCore-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkIOGeometry-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkIOGeometry-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS) 
LOCAL_MODULE := libvtkIOImage-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkIOImage-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvtkIOInfovis-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkIOInfovis-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvtkIOLegacy-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkIOLegacy-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvtkIOPLY-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkIOPLY-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvtkIOXML-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkIOXML-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvtkIOXMLParser-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkIOXMLParser-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvtkjpeg-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkjpeg-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvtkjsoncpp-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkjsoncpp-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvtklibxml2-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtklibxml2-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvtkmetaio-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkmetaio-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvtkParallelCore-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkParallelCore-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvtkpng-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkpng-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvtkRenderingCore-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkRenderingCore-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvtkRenderingOpenGL2-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkRenderingOpenGL2-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvtksys-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtksys-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvtktiff-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtktiff-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvtkzlib-6.3
LOCAL_SRC_FILES = /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/lib/libvtkzlib-6.3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)


LOCAL_C_INCLUDES := /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/
LOCAL_C_INCLUDES += /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/alglib/
LOCAL_C_INCLUDES += /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkexpat/
LOCAL_C_INCLUDES += /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkglew/
LOCAL_C_INCLUDES += /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkjpeg/
LOCAL_C_INCLUDES += /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkjsoncpp/
LOCAL_C_INCLUDES += /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtklibxml2/
LOCAL_C_INCLUDES += /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkmetaio/
LOCAL_C_INCLUDES += /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkpng/
LOCAL_C_INCLUDES += /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtksys/
LOCAL_C_INCLUDES += /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtktiff/
LOCAL_C_INCLUDES += /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkzlib/

LOCAL_STATIC_LIBRARIES := cpufeatures android_native_app_glue ndk_helper
LOCAL_CPP_FEATURES := rtti exceptions
LOCAL_CPPFLAGS += --std=c++11


LOCAL_LDLIBS := -llog

LOCAL_MODULE    := ndk1
LOCAL_SRC_FILES := native.cxx

include $(BUILD_SHARED_LIBRARY)
$(call import-module,android/native_app_glue)

It might be a really dumb error (still a newbie) but I would like some help here if possible.

EDIT: As suggested in some posts here, I have tried LOCAL_ALLOW_UNDEFINED_SYMBOLS:=true but what it does is just ignore the problem until runtime and when I try to run the application returns with error directly like this one:

dlopen("/data/app-lib/com.example.vtknative-2/libndk1.so") failed: dlopen failed: cannot locate symbol 

"_ZN32vtkAndroidRenderWindowInteractor14HandleKeyEventEbiii" referenced by "libndk1.so"...

EDIT2: as suggested by @samgak I added the prebuilt static libraries to my LOCAL_STATIC_LIBRARIES list. Yet the first error I get is:

/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkAlgorithm.h:391: error: undefined reference to 'vtkAlgorithm::GetOutputPort(int)'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkAlgorithm.h:391: error: undefined reference to 'vtkAlgorithm::GetOutputPort(int)'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkAlgorithm.h:391: error: undefined reference to 'vtkAlgorithm::GetOutputPort(int)'
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkAlgorithm.h:391: error: undefined reference to 'vtkAlgorithm::GetOutputPort(int)'

And here is the corresponding line in the vtkAlgorithm.h (lines 389,390 and 391)

vtkAlgorithmOutput* GetOutputPort(int index);
  vtkAlgorithmOutput* GetOutputPort() {
    return this->GetOutputPort(0); }
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
LBes
  • 3,366
  • 1
  • 32
  • 66
  • I've seen that it's possible to use: LOCAL_ALLOW_UNDEFINED_SYMBOLS:=true but i'm not sure it will solve my problem cause everything might be ignored until runtime and then it will crash no? – LBes Jun 17 '15 at 17:17

2 Answers2

1

Add your prebuilt static libraries to your LOCAL_STATIC_LIBRARIES list:

LOCAL_STATIC_LIBRARIES := cpufeatures android_native_app_glue ndk_helper \
    libvtkalglib-6.3 \
    libvtkCommonColor-6.3 \
    libvtkCommonComputationalGeometry-6.3 \
    libvtkCommonCore-6.3 \
    libvtkCommonMath-6.3 \
    libvtkCommonMisc-6.3 \
    libvtkCommonSystem-6.3 \
    libvtkCommonTransforms-6.3 \
    libvtkDICOMParser-6.3 \
    libvtkexpat-6.3 \
    libvtkFiltersCore-6.3 \
    libvtkFiltersExtraction-6.3 \
    libvtkFiltersGeneral-6.3 \
    libvtkFiltersGeometry-6.3 \
    libvtkFiltersModeling-6.3 \
    libvtkFiltersSources-6.3 \
    libvtkFiltersStatistics-6.3 \
    libvtkglew-6.3 \
    libvtkImagingCore-6.3 \
    libvtkImagingFourier-6.3 \
    libvtkImagingHybrid-6.3 \
    libvtkInfovisCore-6.3 \
    libvtkInteractionStyle-6.3 \
    libvtkIOCore-6.3 \
    libvtkIOGeometry-6.3 \
    libvtkIOImage-6.3 \
    libvtkIOInfovis-6.3 \
    libvtkIOLegacy-6.3 \
    libvtkIOPLY-6.3 \
    libvtkIOXML-6.3 \
    libvtkIOXMLParser-6.3 \
    libvtkjpeg-6.3 \
    libvtkjsoncpp-6.3 \
    libvtklibxml2-6.3 \
    libvtkmetaio-6.3 \
    libvtkParallelCore-6.3 \
    libvtkpng-6.3 \
    libvtkRenderingCore-6.3 \
    libvtkRenderingOpenGL2-6.3 \
    libvtksys-6.3 \
    libvtktiff-6.3 \
    libvtkzlib-6.3
samgak
  • 23,944
  • 4
  • 60
  • 82
  • Thanks for the answer. It did change something but now I have even more errors of undefined references somehow... Could that be linked to the order of the import? Should I update my question with the output I get (which is actually really long). Thanks again for helping me so far – LBes Jun 19 '15 at 07:53
  • Are you using every single one of those libraries in your code? Try narrowing it down and including only the ones you need, and then post any errors you may have. And yes, the order can make a difference. Libraries that define functions should come before other libraries that use them. – samgak Jun 19 '15 at 07:59
  • Ok thanks for the advice. My problem is that currently I still don't know what I will be using and to be honest, the vtk library is big that you never really know what you have to include. Even in their makefiles for desktop they actually include everything. I'll try and see what could be the best order for the includes. I definitely thinks it's the order because now the undefined references come from the vtk files directly. A little extra question, does the order matter for `LOCAL_STATIC_LIBRARIES`, `LOCAL_MODULE`, `LOCAL_SRC_FILES` or the 3 of them? – LBes Jun 19 '15 at 08:03
  • I don't think the order matters, but usually the order is LOCAL_MODULE then LOCAL_SRC_FILES then LOCAL_STATIC_LIBRARIES. It's natural to have the source files first and then the libraries you are linking against because you are compiling first and then linking second. – samgak Jun 19 '15 at 08:06
  • Oh actually my question was not really clear, does the order of the "includes"of files matter for the three of them or just for the `LOCAL_SRC_FILE` – LBes Jun 19 '15 at 08:08
  • It can matter for `LOCAL_STATIC_LIBRARIES`, it shouldn't matter for `LOCAL_SRC_FILES` or `LOCAL_MODULE`. Another thing: I'm not familiar with VTK but you should check whether you need to use extern "C" when including the headers. – samgak Jun 19 '15 at 08:11
  • Alright thanks for the advice. I'll come back to you after I've tried a few things :) – LBes Jun 19 '15 at 08:12
  • It is failing again for some reasons. See my edited question. I have corrected the order somehow and I guess it is better now but the output I get is not understandable for me. I mean it should be defined because it was definitely defined 2 lines above. – LBes Jun 19 '15 at 09:01
  • The header *declares* GetOutputPort(int) with an int argument, and *defines* GetOutputPort() with no argument, which calls GetOutputPort(int). So you still need to link against the version that takes an int. According to [this](http://public.kitware.com/pipermail/vtkusers/2011-May/067629.html) it's in the filtering lib, but you seem to have already included all of them...try moving them up the list I guess – samgak Jun 19 '15 at 09:13
  • But the version that takes an int may be defined in the cpp file no? I am kinda lost here I have to admit – LBes Jun 19 '15 at 09:20
  • Yes, and the cpp file will have been compiled into an object file that is inside one of the static libs (.a files) you are trying to link against. – samgak Jun 19 '15 at 09:22
  • Check inside VTK/build4/CMakeExternals/Install/vtk-android/lib to see if there are any .a files in there that you aren't linking against – samgak Jun 19 '15 at 09:30
  • They're all included so I'm really amazed it doesn't work. But you're right the order does change the number of errors. Still this error out the GetOutputPort is bugging me – LBes Jun 19 '15 at 09:36
  • still no idea how to solve that, if you have any other suggestions, I'd be willing to give it a try :) – LBes Jun 23 '15 at 08:02
  • try adding -lm -landroid to your LOCAL_LDLIBS. That might fix some of the android_native_app_glue errors. Then try adding -lstdc++ – samgak Jun 23 '15 at 08:19
  • indeed it does, now I "just" need to understand what is causing these 200 undefined reference errors ^^ – LBes Jun 23 '15 at 08:34
  • Still no answer to that problem. From posts on the VTK mailing list it may be a problem due to VTK itself but I am quite unsure it is. – LBes Jun 24 '15 at 12:27
  • What revision of VTK are you using? According to [this blog post](http://www.kitware.com/blog/home/post/860) there is a bug that will stop VTK versions prior to v6.2.0.rc1 from building successfully. Read the comments especially. – samgak Jun 24 '15 at 12:36
  • I am using a latter revision I guess because I was the one to report this bug to the Kitware team (and Tim Thirion especially). When using a prior version building was always a failure while now I have a built vtk for android but I simply cannot use it because of the errors mentioned above – LBes Jun 24 '15 at 12:43
  • Oh right, I just noticed your name in the comments! – samgak Jun 24 '15 at 12:50
  • Maybe I'll have to start a bounty on that question because it seems I won't get an answer soon otherwise, but well don't want to lose all the rep I got so far. Will wait again a little. – LBes Jun 24 '15 at 12:57
  • Thanks a lot. Don't worry you have helped enough so far and I know you've tried your best. If you have any idea feel free to post again here. I will let you know whenever I find something that can solve this issue – LBes Jun 24 '15 at 13:05
  • Apparently I've found an answer to my problem. Not sure though but now the native code is build by idk-build at least. – LBes Jun 30 '15 at 10:57
0

It would seem that this Android.mk just did the job. I also post the Application.mk just in case, it may help others too.

It seems that I was not linking correctly. The way we did simply does not work while I do not get any errors when using the following files.

Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := ndk1

# Recursive wildcard in pure make, no external commands required
# From: http://stackoverflow.com/a/12959764
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))

# Recursively find all *.cpp files under LOCAL_PATH
LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(call rwildcard,$(LOCAL_PATH),*.cpp))

# Compiler flags
# LOCAL_CFLAGS += -Ofast -Wall -Wextra -pedantic -Wno-unused-parameter -DNDEBUG
LOCAL_CFLAGS += -Ofast -Wall -Wextra -pedantic -Wno-unused-parameter -UNDEBUG
# LOCAL_CFLAGS += -O0 -g -Wall -Wextra -pedantic -Wno-unused-parameter

# (optional) Silence warnings in the NDK headers
LOCAL_CFLAGS += -isystem ${NDK_ROOT}/platforms/$(TARGET_PLATFORM)/arch-arm/usr/include

# Enable NEON instructions
LOCAL_ARM_NEON := true

# Use the more efficient 32-bit instructions, at the expense
# of a larger code size
LOCAL_ARM_MODE := arm

# Logging library (__android_log_* functions)
LOCAL_LDLIBS += -llog

# OpenGL ES 2.0
LOCAL_LDLIBS += -lGLESv2
# LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES

LOCAL_LDFLAGS += -L /Users/lonnibesancon/Desktop/VTK/buildandroid2/CMakeExternals/Build/vtk-android/lib/

# NOTE: the link order is important!
LOCAL_LDFLAGS += -lvtkIOXML-6.3 -lvtkIOLegacy-6.3 -lvtkIOPLY-6.3 -lvtkIOGeometry-6.3 -lvtkFiltersModeling-6.3 -lvtkImagingCore-6.3 -lvtkRenderingCore-6.3 -lvtkIOImage-6.3 -lvtkDICOMParser-6.3 -lvtkmetaio-6.3 -lvtkpng-6.3 -lvtktiff-6.3 -lvtkjpeg-6.3 -lvtkFiltersSources-6.3 -lvtkFiltersGeometry-6.3 -lvtkIOXMLParser-6.3 -lvtkIOCore-6.3 -lvtkexpat-6.3 -lvtkFiltersExtraction-6.3 -lvtkFiltersGeneral-6.3 -lvtkFiltersCore-6.3 -lvtkCommonExecutionModel-6.3 -lvtkCommonComputationalGeometry-6.3 -lvtkCommonDataModel-6.3 -lvtkCommonMisc-6.3 -lvtkCommonTransforms-6.3 -lvtkCommonSystem-6.3 -lvtkCommonMath-6.3 -lvtkCommonCore-6.3 -lvtksys-6.3 -lvtkzlib-6.3
#notfound : -lvtkRenderingFreeType-6.3

# Use -isystem to silence warnings in the VES headers
#LOCAL_CFLAGS += -isystem $(LOCAL_PATH)/../../thirdparty/VES/Apps/Android/CMakeBuild/build/CMakeExternals/Install/eigen
#LOCAL_CFLAGS += -isystem $(LOCAL_PATH)/../../thirdparty/VES/Apps/Android/CMakeBuild/build/CMakeExternals/Install/vtk-android/include/vtk-6.3/

# LOCAL_C_INCLUDES += ${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.6/include
# LOCAL_C_INCLUDES += ${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include

#LOCAL_SHARED_LIBRARIES := artoolkit
# LOCAL_SHARED_LIBRARIES := artoolkitplus

include $(BUILD_SHARED_LIBRARY)

Application.mk:

APP_ABI := armeabi-v7a 
APP_STL := gnustl_shared
GCC_ENABLE_CPP_RTTI := YES
# Set target Android API level to the application's minimum SDK version.

APP_PLATFORM := android-14

It builds just fine even though I still get some warnings about the android version and the shared librairies.

LBes
  • 3,366
  • 1
  • 32
  • 66