运行V8 javascript引擎的示例代码时出错

时间:2014-07-02 05:22:58

标签: node.js google-chrome v8 embedded-v8

尝试在链接1上运行代码时出现以下错误。请帮助解决此问题

  

链接1:https://developers.google.com/v8/get_started#audience

------------------------------------错误开始--------- -----------------------------

amit-macbook:v8 amit.sood$ g++ -Iinclude hello_world.cpp -o hello_world -Wl,--start-group out/x64.release/obj.target/{tools/gyp/libv8_{base,libbase.x64,snapshot},third_party/icu/libicu{uc,i18n,data}}.a -Wl,--end-group -lrt

clang: error: no such file or directory: 'out/x64.release/obj.target/tools/gyp/libv8_base.a'

clang: error: no such file or directory: 'out/x64.release/obj.target/tools/gyp/libv8_libbase.x64.a'

clang: error: no such file or directory: 'out/x64.release/obj.target/tools/gyp/libv8_snapshot.a'

clang: error: no such file or directory: 'out/x64.release/obj.target/third_party/icu/libicuuc.a'

clang: error: no such file or directory: 'out/x64.release/obj.target/third_party/icu/libicui18n.a'

clang: error: no such file or directory: 'out/x64.release/obj.target/third_party/icu/libicudata.a'

------------------------------------错误结束--------- -----------------------------

我在链接2下面安装了V8。我安装了64位版本

  

链接2:https://code.google.com/p/v8/wiki/BuildingWithGYP

2 个答案:

答案 0 :(得分:1)

我在我的机器上成功完成了在Mac OSX上构建v8的指南 - 请告诉我这是否对您有用,我很乐意反馈:https://gist.github.com/netpoetica/28ce31478cfc43edcaa7

此外,特别针对您的问题:这里有几种可能性。首先,确保你确实有一个/ out目录 - 在调用make之后会出现这个目录。接下来,当您调用make时,您可能实际上没有创建一个名为out / x64的文件夹。相反,您可能(可能)已经调用了make nativemake ia32 -j 2或类似的东西 - 文件夹名称x64.release应该仅在您使用make时才存在:

make x64 // or make x64.release

答案 1 :(得分:0)

您需要构建v8,并将静态库标志设置为True。这可以按如下方式完成。

  

通过运行gn args out.gn/x64.release来编辑默认的构建配置。在配置中添加两行:is_component_build = false和v8_static_library = true

在该步骤之后,常规ninja -C out.gn/x64.release应该为您提供所需的库

来源:https://github.com/v8/v8/wiki/Getting%20Started%20with%20Embedding#run-the-example