2011-07-08 23 views
-1

最近,我尝试构建并运行谷歌v8的示例hello世界程序。 我的xcode版本是4.0.2GA,x86_64。问题在V8引擎的Mac Pro X86_64中运行示例?

该指南的链接:get Started

但是,当运行命令: G ++ -Iinclude hello_world.cpp -o程序hello_world libv8.a -lpthread

的错误显示:

ld: warning: ignoring file libv8.a, file was built for archive which is not the architecture being linked (x86_64) 
Undefined symbols for architecture x86_64: 
"v8::Context::Enter()", referenced from: 
     v8::Context::Scope::Scope(v8::Handle<v8::Context>)in ccJsmYlc.o 
    "v8::V8::DisposeGlobal(v8::internal::Object**)", referenced from: 
     v8::Persistent<v8::Context>::Dispose()  in ccJsmYlc.o 
    "v8::Context::Exit()", referenced from: 
     v8::Context::Scope::~Scope()in ccJsmYlc.o 
    "v8::HandleScope::HandleScope()", referenced from: 
     _main in ccJsmYlc.o 
    "v8::Context::New(v8::ExtensionConfiguration*, v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::Value>)", referenced from: 
     _main in ccJsmYlc.o 
    "v8::String::New(char const*, int)", referenced from: 
     _main in ccJsmYlc.o 
    "v8::Script::Compile(v8::Handle<v8::String>, v8::ScriptOrigin*, v8::ScriptData*, v8::Handle<v8::String>)", referenced from: 
     _main in ccJsmYlc.o 
    "v8::Script::Run()", referenced from: 
     _main in ccJsmYlc.o 
    "v8::String::AsciiValue::AsciiValue(v8::Handle<v8::Value>)", referenced from: 
     _main in ccJsmYlc.o 
    "v8::String::AsciiValue::~AsciiValue()", referenced from: 
     _main in ccJsmYlc.o 
    "v8::HandleScope::~HandleScope()", referenced from: 
     _main in ccJsmYlc.o 

ld: symbol(s) not found for architecture x86_64 
collect2: ld returned 1 exit status. 

回答

2

它应该是显而易见的,你正试图链接一个为另一个架构而建立的.a。查看How do I determine the target architecture of static library (.a) on Mac OS X?了解如何检查.a的目标架构。一旦你知道你可以重定向你的项目,或者为x86_64架构创建一个新的libv8.a。

+0

我检查默认是a32,然后我用scons arch = x64重建,效果很好。谢谢! – kennyeric

+0

好听 - 请花时间接受答案 - http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – fvu