NDK error .... when running ndk-build

I get the following error when trying to do an NDK build ... Can someone help me?

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 

My application .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 

And my 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) 
+1
source share
2 answers

Add this to your Application.mk :

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

It seems your FreeImage was created with a different runtime than your application.

+1
source

Are you sure you do not want APP_STL: = stlport_static? If I grep for, say, "__cxa_end_catch", I see this in $ (NDK_ROOT) / sources / cxx-stl / gabi ++ / ..., which indicates the need to use stlport, as well as for gnustl_static (which is broken in NDK (from 8c to 8e) BTW)

0
source

Source: https://habr.com/ru/post/921366/


All Articles