code for article pfeilbr/v8-javascript-engine-playground
project to learn and develop with V8
Root V8 source directory is @
~/dev/v8on local machine
Build Source and Sample(s)
- Follow steps at https://github.com/v8/v8/wiki/Building-from-Source up until, but not inlcuding
tools/dev/v8gen.py ... - generate “debug” build files
tools/dev/v8gen.py x64.debug - change contents of
v8/out.gn/x64.debug/args.gntois_debug = true target_cpu = "x64" v8_enable_backtrace = true v8_enable_slow_dchecks = true v8_optimized_debug = false v8_monolithic = true v8_use_external_startup_data = false is_component_build = falseneeded to enable debugging
- compile with
ninja -C out.gn/x64.debug - compile debug version of
samples/hello-world.ccwithg++ -g -I. -Iinclude samples/hello-world.cc -o out.gn/x64.debug/hello_world -lv8 -lv8_libbase -lv8_libplatform -licuuc -licui18n -Lout.gn/x64.debug/ -pthread -std=c++0x-genables debug version - move into output directory
pushd out.gn/x64.debug - set library path and run
LD_LIBRARY_PATH=./ ./hello_world - return to v8 root
popd
Developing
- configure: modify
script/envfor your setup - build:
./scripts/build src/playground.cc - run:
./scripts/run src/playground.cc - build and run on change (dev):
./scripts/build-and-run-on-change src/playground.cc
vscode debugging
launch.json configuration
{
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/out.gn/x64.debug/hello_world",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/out.gn/x64.debug",
"environment": [{"name": "LD_LIBRARY_PATH", "value": "./"}],
"externalConsole": true,
"MIMode": "lldb"
}
]
}
${workspaceFolder}isv8root directory

Twitter • Reddit