Search code examples
v8embedded-v8

V8 : Isolate is incompatible with the embedded blob


I am trying to create custom snapshot from some Javascript file. I was able to create a snapshot using the command

mksnapshot.exe snapshot11.js --startup_blob snap.bin

but when I was trying to create an Isolate with this snap.bin file I got this message

The Isolate is incompatible with the embedded blob. This is usually caused by incorrect usage of mksnapshot. When generating custom snapshots, embedders must ensure they pass the same flags as during the V8 build process (e.g.: --turbo-instruction-scheduling).

I am guessing that I need recreate the snapshot with the proper flags but I couldn't find which flags I need to use.

My args.gn

is_component_build=true 
v8_static_library=false 
is_official_build=false 
is_debug=true 
use_custom_libcxx=false
use_custom_libcxx_for_host=false
target_cpu="x64"
use_goma=false 
v8_use_external_startup_data=false 
v8_enable_i18n_support = false 
symbol_level=2 
v8_enable_fast_mksnapshot=true

Any lead will be helpful.
10x


Solution

  • You can invoke ninja with -v to have it print all the commands it executes; e.g. if you compile V8 with:

    ninja -v -C out/... v8_monolith
    

    then you'll find a line for the mksnapshot invocation in the output, and can copy the flags from there. (If you have already compiled V8, ninja will say "nothing to do"; in that case you can either clean out everything, or just delete snapshot_blob.bin and libv8_monolith.so.)