首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在不同的编译器中编译NDK代码

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

Stack Overflow用户
提问于 2012-08-03 12:31:12
回答 2查看 555关注 0票数 0

当我尝试执行NDK-build时,我得到了以下错误日志...我怀疑这是因为我使用了错误的C++编译器编译代码,现在我使用的是GNU C++。使用命令

代码语言:javascript
复制
APP_STL := gnustl_static

请告诉我如何使用不同版本的编译器和可用的不同编译器。

代码语言:javascript
复制
./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  
EN

回答 2

Stack Overflow用户

发布于 2012-08-04 14:01:49

尝试添加

指向Android.mk文件中的LOCAL_CXXFLAGS的-fexceptions

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

APP_STL := gnustl_static APP_ABI := all

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

票数 0
EN

Stack Overflow用户

发布于 2013-05-20 23:44:31

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

以下是我修复它的方法(适用于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“的功能。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11789287

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档