I would like to build a static, monolithic library suitable for embedding via MinGW. This is a multiplatform project and I want to avoid switching my entire toolchain over to MSVC. All answers on StackOverflow, Google Groups and the v8 wiki refer to SCons, GYP or MinGW build generation files that no longer exist. I have:
- Followed the instructions here to install depot_tools and fetch v8.
- Added
[User Directory]\depot_toolsto the front of my PATH variable. - Set
DEPOT_TOOLS_WIN_TOOLCHAIN=0in my environment variables.
Instructions here suggest bypassing the manual workflow by outputting build files yourself. When I run gn args out/mingw I get a python stack trace ending with:
Exception: No supported Visual Studio can be found. Supported versions are: 16.0 (2019), 17.0 (2022), 15.0 (2017).
ERROR at //build/config/win/visual_studio_version.gni:27:7: Script returned non-zero exit code.
exec_script("../../vs_toolchain.py", [ "get_toolchain_dir" ], "scope")
^----------
I'm not sure if this answers your question, since you mentioned
gnspecifically. But a few months ago I managed to compile V8 usinggm.pyand following these instructions.This is what I did (I keep all git repos in
~/repos):If you need to set some specific V8 compile-time flags, I think you cannot use
gm.pythough. You need to generate build files using either gn orv8gen.py:After you have managed to generate the build files, you can finally compile V8 using ninja.
A completely different route could be to use zig-v8, which uses the Zig toolchain to build V8. For example, Cosmic is a JS/WASM runtime that uses zig-v8 to embed V8.