A quick update for those who are interested in running a v8-based multi-threaded application in a Node process, but completely isolated from the Node.
I built static v8 libraries using a GN build. This is release arguments file I used (`
args.gn`):
is_debug = false
target_cpu = "x64"
v8_static_library = true
is_component_build = false
The build failed close to the end with this error message:
> ninja -C out.gn/x64.release
ninja: Entering directory `out.gn/x64.release'
[1/1] Regenerating ninja files
[1389/1543] LINK cctest.exe cctest.exe.pdb
FAILED: cctest.exe cctest.exe.pdb
...\depot_tools/win_tools-2_7_6_bin/python/bin/python.exe ../../build/toolchain/win/tool_wrapper.py link-wrapper environment.x64 False link.exe /nologo /OUT:./cctest.exe /PDB:./cctest.exe.pdb @./cctest.exe.rsp
LINK : warning LNK4001: no object files specified; libraries used
LINK : error LNK1218: warning treated as error; no output file generated
[1394/1543] CXX obj/test/unittests/unittests_sources/unoptimized-compile-job-unittest.obj
ninja: build stopped: subcommand failed. , but it did manage to produce all static v8 libraries to link against. This is the resulting list of libraries in `
out.gn/x64.release/obj` and some subdirectories:
icui18n.lib
icuuc.lib
v8_base_0.lib
v8_base_1.lib
v8_external_snapshot.lib
v8_init.lib
v8_initializers.lib
v8_libbase.lib
v8_libplatform.lib
v8_libsampler.lib
v8_nosnapshot.lib
v8_snapshot.lib
As with a non-static v8 build, you will need `snapshot_blob.bin`, `natives_blob.bin` and `icudtl.dat` in the directory where the initialization can find them.
My test setup was to run Node v6.9.1, which called a C++ modules every 50ms and created a couple of objects (a string and a function) and a couple of threads making a ton of v8 calls against multiple isolates from a static v8 library v6.6, which used most commonly-used v8 functionality, including first and second level weak pointer callbacks.