x86上的Android NDK和STL相关的引用错误

时间:2016-03-10 12:34:12

标签: android c++ android-ndk v8 embedded-v8

我正在构建与V8库的集成。这种构建适用于ARM(armeabi,armeabi-v7a)目标。

我想添加x86支持。今天是我第一次尝试这个。

我通过make ia32.release为x86构建了V8。

我的Application.mk如下:

APP_ABI := armeabi armeabi-v7a x86
APP_PLATFORM := android-14
APP_STL := stlport_static

Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE    := v8_libbase
LOCAL_SRC_FILES := ./libs/$(TARGET_ARCH_ABI)/libv8_libbase.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := v8_base
LOCAL_SRC_FILES := ./libs/$(TARGET_ARCH_ABI)/libv8_base.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := v8_nosnapshot
LOCAL_SRC_FILES :=  ./libs/$(TARGET_ARCH_ABI)/libv8_nosnapshot.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := v8_platform
LOCAL_SRC_FILES :=  ./libs/$(TARGET_ARCH_ABI)/libv8_libplatform.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := v8jsevaluator
LOCAL_SRC_FILES := v8jsevaluator.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/
LOCAL_LDLIBS    := -llog -landroid
LOCAL_STATIC_LIBRARIES := v8_base v8_nosnapshot v8_libbase v8_platform
LOCAL_CPP_FEATURES += exceptions
LOCAL_CFLAGS += -std=c++11
include $(BUILD_SHARED_LIBRARY)

x86组件中的构建失败,并且有很多与STL相关的错误。

12:13:39 **** Incremental Build of configuration Default for project v8jsevaluator ****
"C:\\Development\\android-ndk-r10d\\ndk-build.cmd" all 
Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml    
[armeabi] Install        : libv8jsevaluator.so => libs/armeabi/libv8jsevaluator.so
[armeabi-v7a] Install        : libv8jsevaluator.so => libs/armeabi-v7a/libv8jsevaluator.so
[x86] SharedLibrary  : libv8jsevaluator.so
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) [clone .part.30]: error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function v8::internal::operator<<(std::ostream&, v8::internal::ExternalReference): error: undefined reference to 'std::ostream& std::ostream::_M_insert<void const*>(void const*)'
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function v8::internal::operator<<(std::ostream&, v8::internal::ExternalReference): error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function v8::internal::operator<<(std::ostream&, v8::internal::ExternalReference): error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function v8::internal::operator<<(std::ostream&, v8::internal::ExternalReference): error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
jni/./libs/x86/libv8_base.a(assembler.o):assembler.cc:function v8::internal::operator<<(std::ostream&, v8::internal::ExternalReference): error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
jni/./libs/x86/libv8_base.a(bootstrapper.o):bootstrapper.cc:function std::vector<unsigned char, std::allocator<unsigned char> >::resize(unsigned int): error: undefined reference to 'std::__throw_length_error(char const*)'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) [clone .part.32]: error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::CallFunctionStub::PrintName(std::ostream&) const: error: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::CallFunctionStub::PrintName(std::ostream&) const: error: undefined reference to 'std::ostream::operator<<(int)'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::CodeStub::PrintBaseName(std::ostream&) const: error: undefined reference to 'std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::BinaryOpICStub::GenerateAheadOfTime(v8::internal::Isolate*, v8::internal::BinaryOpICState const&): error: undefined reference to 'VTT for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::BinaryOpICStub::GenerateAheadOfTime(v8::internal::Isolate*, v8::internal::BinaryOpICState const&): error: undefined reference to 'VTT for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::BinaryOpICStub::GenerateAheadOfTime(v8::internal::Isolate*, v8::internal::BinaryOpICState const&): error: undefined reference to 'vtable for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
C:/Development/android-ndk-r10d/toolchains/x86-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.8/../../../../i686-linux-android/bin/ld.exe: the vtable symbol may be undefined because the class is missing its key function
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::BinaryOpICStub::GenerateAheadOfTime(v8::internal::Isolate*, v8::internal::BinaryOpICState const&): error: undefined reference to 'vtable for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
C:/Development/android-ndk-r10d/toolchains/x86-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/i686-linux-android/4.8/../../../../i686-linux-android/bin/ld.exe: the vtable symbol may be undefined because the class is missing its key function
jni/./libs/x86/libv8_base.a(code-stubs.o):code-stubs.cc:function v8::internal::BinaryOpICStub::GenerateAheadOfTime(v8::internal::Isolate*, v8::internal::BinaryOpICState const&): error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage'
<snipped for brevity>
jni/./libs/x86/libv8_libbase.a(platform-posix.o):platform-posix.cc:function v8::base::OS::FPrint(_IO_FILE*, char const*, ...): error: undefined reference to '__vfprintf_chk'
jni/./libs/x86/libv8_libbase.a(platform-posix.o):platform-posix.cc:function v8::base::OS::VFPrint(_IO_FILE*, char const*, char*): error: undefined reference to '__vfprintf_chk'
jni/./libs/x86/libv8_libbase.a(platform-posix.o):platform-posix.cc:function v8::base::OS::SNPrintF(char*, int, char const*, ...): error: undefined reference to '__vsnprintf_chk'
jni/./libs/x86/libv8_libbase.a(platform-posix.o):platform-posix.cc:function v8::base::OS::VSNPrintF(char*, int, char const*, char*): error: undefined reference to '__vsnprintf_chk'
jni/./libs/x86/libv8_libplatform.a(default-platform.o):default-platform.cc:function void std::deque<v8::Task*, std::allocator<v8::Task*> >::_M_push_back_aux<v8::Task* const&>(v8::Task* const&): error: undefined reference to 'std::__throw_bad_alloc()'
collect2.exe: error: ld returned 1 exit status
make.exe: *** [obj/local/x86/libv8jsevaluator.so] Error 1

12:13:41 Build Finished (took 1s.821ms)

正如我所说的,没有尝试构建x86,这一切都没问题。

任何人都可以指出我出错的地方吗?谢谢!

1 个答案:

答案 0 :(得分:0)

我将V8的源代码从4.1.0.22升级到4.9.385.30,并且在解决了很多其他问题之后 - 这个问题就消失了。