How to build V8 without “external startup data”?

99封情书 提交于 2020-01-02 09:09:13

问题


I want a standalone JavaScript library for embedding. I already build V8 and its working correctly, but binary needs two "external data" files. I don want this files.

I was trying to build V8 without "external startup data". I tried to set v8_use_external_startup_data : 0, in build.common.gypi and build/standalone.gypi, but then make is reporting failure at some point.

I'm using following code to build v8:

git clone https://chromium.googlesource.com/chromium/tool/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"
fetch v8
gclient sync
cd v8
git checkout branch-heads/5.1
# ... modifying gyni files
make x64.release -j 20

I'm using default, static linking. How I can build V8 without need of natives_blob.bin and snapshot_blog.bin ?


回答1:


When using the GYP build process (as you seem to be), pass the argument -Dv8_use_snapshot=false when invoking gyp. That turns off building snapshot data, and you won't need "natives_blob.bin" and "snapshot_blob.bin". My command-line looks like this (for V8 5.3, n.b. the GYP scripts have moved recently):

python.exe gypfiles\gyp_v8 -Dtarget_arch=x64 -Dcomponent=shared_library -Dv8_enable_i18n_support=false -Dv8_use_snapshot=false -G msvs_version=2013



回答2:


edit: Since this was posted, V8 now takes ~20-30s to start up without snapshot files. This is up from 2-3s before. It is a known behavior and is not considered to be a bug by the V8 developers, per the v8-users mailing list.

static:

make snapshot=off x64.debug

dynamic:

make snapshot=off library=shared x64.debug

I don't know how to do it for visual studio.

It's important to remember that the build process is constantly being changed by google and that it is optimized for google employees and often horrendously esoteric for anyone outside of google.



来源:https://stackoverflow.com/questions/38048888/how-to-build-v8-without-external-startup-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!