0

尝试进行 NDK 构建时出现以下错误日志....我怀疑这是因为我针对错误的 C++ 编译器编译代码,现在我正在使用 GNU C++.. 使用命令

APP_STL := gnustl_static

请让我知道如何使用不同版本的编译器和可用的不同编译器。

./obj/local/x86/libFreeImage.a(ImfPxr24Compressor.o): In function `std::_Rb_tree_const_iterator<std::pair<Imf::Name const, Imf::Channel> >::operator++()':
/home/flock/ANDROID/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_tree.h:259: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base const*)'
./obj/local/x86/libFreeImage.a(ImfPxr24Compressor.o): In function `Imf::Pxr24Compressor::uncompress(char const*, int, Imath::Box<Imath::Vec2<int> >, char const*&)':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfPxr24Compressor.cpp:431: undefined reference to `__cxa_allocate_exception'
./obj/local/x86/libFreeImage.a(ImfPxr24Compressor.o): In function `tooMuchData':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfPxr24Compressor.cpp:173: undefined reference to `__cxa_throw'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfPxr24Compressor.cpp:173: undefined reference to `__cxa_allocate_exception'
./obj/local/x86/libFreeImage.a(ImfPxr24Compressor.o): In function `std::_Rb_tree_const_iterator<std::pair<Imf::Name const, Imf::Channel> >::operator++()':
/home/flock/ANDROID/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_tree.h:259: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base const*)'
./obj/local/x86/libFreeImage.a(ImfPxr24Compressor.o): In function `Imf::Pxr24Compressor::compress(char const*, int, Imath::Box<Imath::Vec2<int> >, char const*&)':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfPxr24Compressor.cpp:404: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfPxr24Compressor.cpp:404: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(ImfPxr24Compressor.o): In function `uiMult<unsigned int>':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:69: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:69: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(ImfPxr24Compressor.o): In function `uiAdd<unsigned int>':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:105: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:105: undefined reference to `__cxa_throw'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:105: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:105: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(ImfPxr24Compressor.o): In function `uiMult<unsigned int>':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:69: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:69: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(ImfPxr24Compressor.o): In function `uiAdd<unsigned int>':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:105: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:105: undefined reference to `__cxa_throw'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:105: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:105: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(ImfPxr24Compressor.o):(.data.rel.ro._ZTIN3Imf15Pxr24CompressorE[typeinfo for Imf::Pxr24Compressor]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
./obj/local/x86/libFreeImage.a(ImfRleCompressor.o): In function `__static_initialization_and_destruction_0':
/home/flock/ANDROID/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/iostream:72: undefined reference to `std::ios_base::Init::Init()'
/home/flock/ANDROID/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/iostream:72: undefined reference to `std::ios_base::Init::~Init()'
./obj/local/x86/libFreeImage.a(ImfRleCompressor.o): In function `Imf::RleCompressor::uncompress(char const*, int, int, char const*&)':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfRleCompressor.cpp:283: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfRleCompressor.cpp:283: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(ImfRleCompressor.o): In function `uiMult<unsigned int>':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:69: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:69: undefined reference to `__cxa_throw'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:69: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:69: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(ImfRleCompressor.o):(.data.rel.ro._ZTIN3Imf13RleCompressorE[typeinfo for Imf::RleCompressor]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
./obj/local/x86/libFreeImage.a(ImfZipCompressor.o): In function `__static_initialization_and_destruction_0':
/home/flock/ANDROID/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/iostream:72: undefined reference to `std::ios_base::Init::Init()'
/home/flock/ANDROID/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/iostream:72: undefined reference to `std::ios_base::Init::~Init()'
./obj/local/x86/libFreeImage.a(ImfZipCompressor.o): In function `Imf::ZipCompressor::uncompress(char const*, int, int, char const*&)':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfZipCompressor.cpp:192: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfZipCompressor.cpp:192: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(ImfZipCompressor.o): In function `Imf::ZipCompressor::compress(char const*, int, int, char const*&)':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfZipCompressor.cpp:159: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmImf/ImfZipCompressor.cpp:159: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(ImfZipCompressor.o): In function `uiMult<unsigned int>':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:69: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:69: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(ImfZipCompressor.o): In function `uiAdd<unsigned int>':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:105: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:105: undefined reference to `__cxa_throw'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:105: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:105: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(ImfZipCompressor.o): In function `uiMult<unsigned int>':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:69: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:69: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(ImfZipCompressor.o): In function `uiAdd<unsigned int>':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:105: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:105: undefined reference to `__cxa_throw'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:105: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h:105: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(ImfZipCompressor.o):(.data.rel.ro._ZTIN3Imf13ZipCompressorE[typeinfo for Imf::ZipCompressor]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
./obj/local/x86/libFreeImage.a(IlmThread.o): In function `IlmThread::Thread::start()':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmThread/IlmThread.cpp:74: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmThread/IlmThread.cpp:74: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(IlmThread.o): In function `~Thread':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmThread/IlmThread.cpp:67: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmThread/IlmThread.cpp:67: undefined reference to `__cxa_throw'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmThread/IlmThread.cpp:67: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmThread/IlmThread.cpp:67: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(IlmThread.o): In function `Thread':
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmThread/IlmThread.cpp:61: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmThread/IlmThread.cpp:61: undefined reference to `__cxa_throw'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmThread/IlmThread.cpp:61: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/OpenEXR/./IlmThread/IlmThread.cpp:61: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(IlmThread.o):(.data.rel.ro._ZTIN9IlmThread6ThreadE[typeinfo for IlmThread::Thread]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
./obj/local/x86/libFreeImage.a(IlmThread.o):(.data.rel.ro._ZTIN3Iex9NoImplExcE[typeinfo for Iex::NoImplExc]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
./obj/local/x86/libFreeImage.a(dcraw_common.o): In function `LibRaw::stretch()':
/home/flock/Desktop/FreeImage/jni/../Source/LibRawLite/./internal/dcraw_common.cpp:9060: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/LibRawLite/./internal/dcraw_common.cpp:9060: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(dcraw_common.o): In function `LibRaw::fuji_rotate()':
/home/flock/Desktop/FreeImage/jni/../Source/LibRawLite/./internal/dcraw_common.cpp:9015: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/LibRawLite/./internal/dcraw_common.cpp:9015: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(dcraw_common.o): In function `LibRaw::median_filter()':
/home/flock/Desktop/FreeImage/jni/../Source/LibRawLite/./internal/dcraw_common.cpp:4429: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/LibRawLite/./internal/dcraw_common.cpp:4429: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(dcraw_common.o): In function `LibRaw::remove_zeroes()':
/home/flock/Desktop/FreeImage/jni/../Source/LibRawLite/./internal/dcraw_common.cpp:337: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/LibRawLite/./internal/dcraw_common.cpp:337: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(dcraw_common.o): In function `LibRaw::recover_highlights()':
/home/flock/Desktop/FreeImage/jni/../Source/LibRawLite/./internal/dcraw_common.cpp:4521: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/LibRawLite/./internal/dcraw_common.cpp:4521: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(dcraw_common.o): In function `LibRaw::blend_highlights()':
/home/flock/Desktop/FreeImage/jni/../Source/LibRawLite/./internal/dcraw_common.cpp:4493: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/LibRawLite/./internal/dcraw_common.cpp:4493: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(dcraw_common.o): In function `LibRaw::scale_colors()':
/home/flock/Desktop/FreeImage/jni/../Source/LibRawLite/./internal/dcraw_common.cpp:3789: undefined reference to `__cxa_allocate_exception'
/home/flock/Desktop/FreeImage/jni/../Source/LibRawLite/./internal/dcraw_common.cpp:3789: undefined reference to `__cxa_throw'
./obj/local/x86/libFreeImage.a(dcraw_common.o): In function  
4

2 回答 2

0

您没有使用错误的编译器,这是 gcc/NDK 中的一个错误,它在 Linux、Cygwin 和 Windows(非 Cygwin)上的表现略有不同。

这是我为修复它所做的工作(适用于 Linux 和我的一位盲人并且必须使用 Cygwin 的开发人员)......

-APP_STL := gnustl_static从您的 Application.mk 中删除该行(它在 NDK 中已损坏,并且在 Linux Cygwin、Windows 上的损坏略有不同)
- 在您的 Android.mk 文件中的 $(LOCAL_LDLIBS) 中添加一行内容:

$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a

还在 Andriod.mk 中添加两行说,
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

上述内容将完成您的 Application.mk 中应该具有的“APP_STL := gnustl_static”。

于 2013-05-20T15:44:30.760 回答
0

尝试添加

-fexceptions 到您的 Android.mk 文件中的 LOCAL_CXXFLAGS

我的 Application.mk 文件中也有这个

APP_STL := gnustl_static APP_ABI := 全部

我想在添加 -fexceptions 之前我遇到了同样的错误

于 2012-08-04T06:01:48.693 回答