我正在尝试从官方v8 repo运行hello world示例代码。在阅读完文档之后,我可以使它在版本5.8上工作,就像在wiki中描述的那样。但是,我有兴趣使用最新版本的v8进行探索,但是当我这样做时:
g++ -I. -Iinclude samples/hello-world.cc -o hello-world -Wl,--start-group out.gn/x64.release/obj/{libv8_{base,libbase,external_snapshot,libplatform,libsampler},third_party/icu/libicu{uc,i18n},src/inspector/libinspector}.a -Wl,--end-group -lrt -ldl -pthread -std=c++0x
我收到以下错误:
out.gn/x64.release/obj/libv8_libbase.a(random-number-generator.o): In function `std::__1::__hash_table<unsigned long, std::__1::hash<unsigned long>, std::__1::equal_to<unsigned long>, std::__1::allocator<unsigned long> >::rehash(unsigned long)':
random-number-generator.cc:(.text._ZNSt3__112__hash_tableImNS_4hashImEENS_8equal_toImEENS_9allocatorImEEE6rehashEm[_ZNSt3__112__hash_tableImNS_4hashImEENS_8equal_toImEENS_9allocatorImEEE6rehashEm]+0x34): undefined reference to `std::__1::__next_prime(unsigned long)'
random-number-generator.cc:(.text._ZNSt3__112__hash_tableImNS_4hashImEENS_8equal_toImEENS_9allocatorImEEE6rehashEm[_ZNSt3__112__hash_tableImNS_4hashImEENS_8equal_toImEENS_9allocatorImEEE6rehashEm]+0x111): undefined reference to `std::__1::__next_prime(unsigned long)'
out.gn/x64.release/obj/libv8_libbase.a(platform-linux.o): In function `v8::base::OS::GetSharedLibraryAddresses()':
platform-linux.cc:(.text._ZN2v84base2OS25GetSharedLibraryAddressesEv+0x20f): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'
platform-linux.cc:(.text._ZN2v84base2OS25GetSharedLibraryAddressesEv+0x322): undefined reference to `std::__1::__basic_string_common<true>::__throw_length_error() const'
out.gn/x64.release/obj/libv8_libbase.a(platform-linux.o): In function `void std::__1::vector<v8::base::OS::SharedLibraryAddress, std::__1::allocator<v8::base::OS::SharedLibraryAddress> >::__push_back_slow_path<v8::base::OS::SharedLibraryAddress>(v8::base::OS::SharedLibraryAddress&&)':
platform-linux.cc:(.text._ZNSt3__16vectorIN2v84base2OS20SharedLibraryAddressENS_9allocatorIS4_EEE21__push_back_slow_pathIS4_EEvOT_[_ZNSt3__16vectorIN2v84base2OS20SharedLibraryAddressENS_9allocatorIS4_EEE21__push_back_slow_pathIS4_EEvOT_]+0x197): undefined reference to `std::__1::__vector_base_common<true>::__throw_length_error() const'
out.gn/x64.release/obj/libv8_external_snapshot.a(setup-isolate-deserialize.o): In function `v8::internal::SetupIsolateDelegate::SetupInterpreter(v8::internal::interpreter::Interpreter*)': setup-isolate-deserialize.cc:(.text._ZN2v88internal20SetupIsolateDelegate16SetupInterpreterEPNS0_11interpreter11InterpreterE+0x69): undefined reference to `std::__1::ios_base::getloc() const'
setup-isolate-deserialize.cc:(.text._ZN2v88internal20SetupIsolateDelegate16SetupInterpreterEPNS0_11interpreter11InterpreterE+0x70): undefined reference to `std::__1::ctype<char>::id' setup-isolate-deserialize.cc:(.text._ZN2v88internal20SetupIsolateDelegate16SetupInterpreterEPNS0_11interpreter11InterpreterE+0x78): undefined reference to `std::__1::locale::use_facet(std::__1::locale::id&) const'
setup-isolate-deserialize.cc:(.text._ZN2v88internal20SetupIsolateDelegate16SetupInterpreterEPNS0_11interpreter11InterpreterE+0x91): undefined reference to `std::__1::locale::~locale()' setup-isolate-deserialize.cc:(.text._ZN2v88internal20SetupIsolateDelegate16SetupInterpreterEPNS0_11interpreter11InterpreterE+0x9d): undefined reference to `std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char)'
setup-isolate-deserialize.cc:(.text._ZN2v88internal20SetupIsolateDelegate16SetupInterpreterEPNS0_11interpreter11InterpreterE+0xa5): undefined reference to `std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()'
out.gn/x64.release/obj/libv8_external_snapshot.a(natives-external.o): In function `void std::__1::vector<v8::internal::Vector<char const>, std::__1::allocator<v8::internal::Vector<char const> > >::__emplace_back_slow_path<char const*, int&>(char const*&&, int&)':
natives-external.cc:(.text._ZNSt3__16vectorIN2v88internal6VectorIKcEENS_9allocatorIS5_EEE24__emplace_back_slow_pathIJPS4_RiEEEvDpOT_[_ZNSt3__16vectorIN2v88internal6VectorIKcEENS_9allocatorIS5_EEE24__emplace_back_slow_pathIJPS4_RiEEEvDpOT_]+0x12c): undefined reference to `std::__1::__vector_base_common<true>::__throw_length_error() const'
out.gn/x64.release/obj/libv8_external_snapshot.a(natives-external.o): In function `void std::__1::vector<v8::internal::Vector<char const>, std::__1::allocator<v8::internal::Vector<char const> > >::__push_back_slow_path<v8::internal::Vector<char const> >(v8::internal::Vector<char const>&&)':
natives-external.cc:(.text._ZNSt3__16vectorIN2v88internal6VectorIKcEENS_9allocatorIS5_EEE21__push_back_slow_pathIS5_EEvOT_[_ZNSt3__16vectorIN2v88internal6VectorIKcEENS_9allocatorIS5_EEE21__push_back_slow_pathIS5_EEvOT_]+0x11a): undefined reference to `std::__1::__vector_base_common<true>::__throw_length_error() const'
out.gn/x64.release/obj/libv8_libsampler.a(sampler.o): In function `v8::sampler::SamplerManager::AddSampler(v8::sampler::Sampler*)': sampler.cc:(.text._ZN2v87sampler14SamplerManager10AddSamplerEPNS0_7SamplerE[_ZN2v87sampler14SamplerManager10AddSamplerEPNS0_7SamplerE]+0x25b): undefined reference to `std::__1::__vector_base_common<true>::__throw_length_error() const'
collect2: error: ld returned 1 exit status
在5.8分支上运行相同的工作正常。我如何才能使用最新版本?