在不同的编译器中编译NDK代码

时间:2012-08-03 04:31:12

标签: android android-ndk

我在尝试进行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  

2 个答案:

答案 0 :(得分:0)

尝试添加

- Android.mk文件中LOCAL_CXXFLAGS的功能

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

APP_STL:= gnustl_static APP_ABI:=全部

我认为在添加-fexceptions

之前我遇到了同样的错误

答案 1 :(得分:0)

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

以下是我修复它的方法(适用于Linux以及我的一个盲人开发人员并且必须使用Cygwin)...

- 从您的Application.mk中删除显示APP_STL := gnustl_static的行(它在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”的内容。