本机代码:不能将-id与-fno-rtti一起使用

时间:2015-06-17 09:39:01

标签: c++ macos gcc android-ndk vtk

我试图在Android上构建本机代码,因为我想在我的Android平板电脑上使用VTK。但是,在构建其中一个vtk示例时,我遇到了一些问题。 我知道这个问题已经在这里讨论了一个客观的问题,但我想这对我来说是不同的。

我从ndk-build获得

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
In file included from /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkTypedDataArray.h:34:0,
                 from /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkDataArrayTemplate.h:25,
                 from /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkIntArray.h:35,
                 from /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkCellTypes.h:39,
                 from /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkPolyData.h:60,
                 from /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkPolyDataAlgorithm.h:33,
                 from /Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkConeSource.h:31,
                 from /Users/lonnibesancon/Documents/workspace/TestNativecopy/jni/native.cxx:25:
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkTypeTemplate.h: In static member function 'static const char* vtkTypeTemplate<ThisT, BaseT>::GetClassNameInternalCachedName()':
/Users/lonnibesancon/Desktop/VTK/build4/CMakeExternals/Install/vtk-android/include/vtk-6.3/vtkTypeTemplate.h:94:45: error: cannot use typeid with -fno-rtti
     static std::string thisType(typeid(ThisT).name());
                                             ^
make: *** [/Users/lonnibesancon/Documents/workspace/TestNativecopy/obj/local/armeabi-v7a/objs/ndk1/native.o] Error 1

现在我使用的是MacOS Yosemite,ndk10e,vtk 6.3。

这是我的Application.mk:

# Build both ARMv5TE and ARMv7-A machine code.

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

APP_PLATFORM := android-14

这是我的android.mk:

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
GCC_ENABLE_CPP_RTTI := YES


LOCAL_LDLIBS := -llog

LOCAL_MODULE    := ndk1
LOCAL_SRC_FILES := native.cxx

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

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:3)

要在NDK中启用C ++,请将LOCAL_CPP_FEATURES := rtti exceptionsLOCAL_CPPFLAGS += --std=c++11添加到jni/Android.mk文件中。默认情况下,NDK仅支持类似C ++的语言。

请注意,CPP和FLAGS之间没有下划线。此外,我使用了+=,因为这不会覆盖其他标志,例如-Wall