1

尝试执行 NDK 构建时出现以下错误...有人可以帮助我吗?

lmImf/ImfHuf.cpp:133: undefined reference to `__cxa_throw'
    ./obj/local/armeabi-v7a/libfreeimage.a(ImfHuf.o): In function `Imf::(anonymous namespace)::invalidTableEntry()':
    D:\Projects.CPP\Engine5\svn\trunk\Dependencies\FreeImage/D:/Projects.CPP/Engine5/svn/trunk/Dependencies/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfHuf.cpp:141: undefined reference to `__cxa_allocate_exception'
    D:\Projects.CPP\Engine5\svn\trunk\Dependencies\FreeImage/D:/Projects.CPP/Engine5/svn/trunk/Dependencies/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfHuf.cpp:141: undefined reference to `__cxa_throw'
    ./obj/local/armeabi-v7a/libfreeimage.a(ImfHuf.o): In function `Imf::(anonymous namespace)::tooMuchData()':
    D:\Projects.CPP\Engine5\svn\trunk\Dependencies\FreeImage/D:/Projects.CPP/Engine5/svn/trunk/Dependencies/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfHuf.cpp:93: undefined reference to `__cxa_allocate_exception'
    D:\Projects.CPP\Engine5\svn\trunk\Dependencies\FreeImage/D:/Projects.CPP/Engine5/svn/trunk/Dependencies/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfHuf.cpp:93: undefined reference to `__cxa_throw'
    ./obj/local/armeabi-v7a/libfreeimage.a(ImfHuf.o): In function `Imf::(anonymous namespace)::invalidCode()':
    D:\Projects.CPP\Engine5\svn\trunk\Dependencies\FreeImage/D:/Projects.CPP/Engine5/svn/trunk/Dependencies/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfHuf.cpp:109: undefined reference to `__cxa_allocate_exception'
    D:\Projects.CPP\Engine5\svn\trunk\Dependencies\FreeImage/D:/Projects.CPP/Engine5/svn/trunk/Dependencies/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfHuf.cpp:109: undefined reference to `__cxa_throw'
    ./obj/local/armeabi-v7a/libfreeimage.a(ImfHuf.o): In function `invalidTableSize':
    D:\Projects.CPP\Engine5\svn\trunk\Dependencies\FreeImage/D:/Projects.CPP/Engine5/svn/trunk/Dependencies/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfHuf.cpp:117: undefined reference to `__cxa_allocate_exception'
    D:\Projects.CPP\Engine5\svn\trunk\Dependencies\FreeImage/D:/Projects.CPP/Engine5/svn/trunk/Dependencies/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfHuf.cpp:117: undefined reference to `__cxa_throw'
    ./obj/local/armeabi-v7a/libfreeimage.a(ImfHuf.o): In function `invalidNBits':
    D:\Projects.CPP\Engine5\svn\trunk\Dependencies\FreeImage/D:/Projects.CPP/Engine5/svn/trunk/Dependencies/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfHuf.cpp:85: undefined reference to `__cxa_allocate_exception'
    D:\Projects.CPP\Engine5\svn\trunk\Dependencies\FreeImage/D:/Projects.CPP/Engine5/svn/trunk/Dependencies/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfHuf.cpp:85: undefined reference to `__cxa_throw'
    ./obj/local/armeabi-v7a/libfreeimage.a(ImfHuf.o): In function `~AutoArray':
    D:\Projects.CPP\Engine5\svn\trunk\Dependencies\FreeImage/D:/Projects.CPP/Engine5/svn/trunk/Dependencies/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfAutoArray.h:61: undefined reference to `__cxa_end_cleanup'
    ./obj/local/armeabi-v7a/libfreeimage.a(ImfHuf.o): In function `Imf::hufUncompress(char const*, int, unsigned short*, int)':
    D:\Projects.CPP\Engine5\svn\trunk\Dependencies\FreeImage/D:/Projects.CPP/Engine5/svn/trunk/Dependencies/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfHuf.cpp:1076: undefined reference to `__cxa_begin_catch'
    D:\Projects.CPP\Engine5\svn\trunk\Dependencies\FreeImage/D:/Projects.CPP/Engine5/svn/trunk/Dependencies/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfHuf.cpp:1079: undefined reference to `__cxa_rethrow'
    D:\Projects.CPP\Engine5\svn\trunk\Dependencies\FreeImage/D:/Projects.CPP/Engine5/svn/trunk/Dependencies/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfHuf.cpp:1076: undefined reference to `__cxa_end_catch'
    ./obj/local/armeabi-v7a/libfreeimage.a(ImfHuf.o):(.ARM.extab.text._ZN3Imf13hufUncompressEPKciPti+0x0): undefined reference to `__gxx_personality_v0'
    ./obj/local/armeabi-v7a/libfreeimage.a(ImfHuf.o): In function `~AutoArray':
    D:\Projects.CPP\Engine5\svn\trunk\Dependencies\FreeImage/D:/Projects.CPP/Engine5/svn/trunk/Dependencies/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfAutoArray.h:61: undefined reference to `__cxa_end_cleanup'
    ./obj/local/armeabi-v7a/libfreeimage.a(ImfHuf.o):(.ARM.extab.text._ZN3Imf11hufCompressEPKtiPc+0x0): undefined reference to `__gxx_personality_v0'
    /home/flock/ANDROID/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a(unwind-arm.o): In function `__gnu_unwind_pr_common':
    /i/ndk-andrewhsieh/src.1-with-cherrypicks//build/../gcc/gcc-4.4.3/libgcc/../gcc/config/arm/unwind-arm.c:1237: undefined reference to `__cxa_call_unexpected'
    collect2: ld returned 1 exit status

我的应用程序.mk

APP_OPTIM := release
APP_PLATFORM := android-8
APP_STL := gnustl_static
APP_CPPFLAGS += -frtti 
APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -DANDROID
APP_ABI := armeabi-v7a

还有我的 android.mk

 LOCAL_PATH := $(call my-dir)
    include $(CLEAR_VARS)
    LOCAL_MODULE:= freeimage
    LOCAL_SRC_FILES :=libfreeimage.a
    APP_STL := gnustl_static
    include $(PREBUILT_STATIC_LIBRARY)

    include $(CLEAR_VARS)
    LOCAL_MODULE:= imageprocessing
    LOCAL_SRC_FILES:= imageprocessing.c
    LOCAL_STATIC_LIBRARIES = freeimage
    LOCAL_EXPORT_C_INCLUDES := freeimage.h
    LOCAL_LDLIBS:= -lm -llog -ljnigraphics
    APP_STL := gnustl_static
    include $(BUILD_SHARED_LIBRARY)
4

2 回答 2

1

将此添加到您的Application.mk

APP_STL := gnustl_static
APP_CPPFLAGS += -frtti 
APP_CPPFLAGS += -fexceptions

您的 FreeImage 似乎是使用与您的应用程序不同的运行时构建的。

于 2012-07-26T09:26:16.757 回答
0

你确定你不想要 APP_STL : = stlport_static 吗?如果我为“__cxa_end_catch” grep,我会在 $(NDK_ROOT)/sources/cxx-stl/gabi++/... ) 顺便提一句)

于 2013-05-21T14:45:48.597 回答