Building V8 on Windows with Visual Studio 2017

1,518 views
Skip to first unread message

Mike Moening

unread,
Jul 3, 2018, 2:45:31 PM7/3/18
to v8-users
I'm trying to build V8 as a static library using Visual Studio 2017 (apparently 2017 is now required). I've done it in the past with VC 2015 successfully.
After setting many environment variables and paths and following all the instructions multiple times it still won't work.

I've got this in my PATH:
C:\utility\depot_tools;C:\Utility\depot_tools\win_tools-2_7_6_bin\python\bin\

And these variables set:
DEPOT_TOOLS_WIN_TOOLCHAIN = 0
GYP_MSVS_OVERRIDE_PATH = C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional
GYP_MSVS_VERSION = 2017
WINDOWSSDKDIR = C:\Program Files (x86)\Windows Kits\10

My args.gn file contains this:
is_debug = false
target_cpu = "x64"
is_component_build = false
v8_static_library = true

I think the build process seems to be looking for this:
../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe

Which was not installed, and I don't have.
See build errors below.  This repeats quite a few times for different .obj files.

C:\Dev\common\v8>ninja -C out.gn/x64.release
ninja: Entering directory `out.gn/x64.release'
[1/1711] CXX obj/v8_libbase/bits.obj
FAILED: obj/v8_libbase/bits.obj
../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo /showIncludes  "-imsvc..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.14.26428\ATLMFC\include" "-imsvc..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.14.26428\include" "-imsvc..\..\..\..\..\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-imsvc..\..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-imsvc..\..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-imsvc..\..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-imsvc..\..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-imsvc..\..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt" -D_CRT_RAND_S -DV8_DEPRECATION_WARNINGS -DUSE_AURA=1 -DNO_TCMALLOC -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED "-DCR_CLANG_REVISION=\"335608-1\"" -D_HAS_NODISCARD -D_HAS_EXCEPTIONS=0 -D__STD_C -D_CRT_RAND_S -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -D_ATL_NO_OPENGL -D_WINDOWS -DCERT_CHAIN_PARA_HAS_EXTRA_FIELDS -DPSAPI_VERSION=1 -DWIN32 -D_SECURE_ATL -D_USING_V110_SDK71_ -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_UNICODE -DUNICODE -DNTDDI_VERSION=0x0A000002 -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 -DENABLE_MINOR_MC -DV8_INTL_SUPPORT -DENABLE_HANDLE_ZAPPING -DV8_USE_SNAPSHOT -DV8_USE_EXTERNAL_STARTUP_DATA -DV8_CONCURRENT_MARKING -DV8_EMBEDDED_BUILTINS -DV8_TARGET_ARCH_X64 -I../.. -Igen -I../.. -Igen /utf-8 /X -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -fcolor-diagnostics -fmerge-all-constants -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0 -no-canonical-prefixes -fcomplete-member-pointers /Gy /FS /bigobj /d2FastFail /Zc:sizedDealloc- -fmsc-version=1911 -m64 /Brepro /W4 -Wimplicit-fallthrough -Wthread-safety /WX /wd4091 /wd4127 /wd4251 /wd4275 /wd4312 /wd4324 /wd4351 /wd4355 /wd4503 /wd4589 /wd4611 /wd4100 /wd4121 /wd4244 /wd4505 /wd4510 /wd4512 /wd4610 /wd4838 /wd4995 /wd4996 /wd4456 /wd4457 /wd4458 /wd4459 /wd4200 /wd4201 /wd4204 /wd4221 /wd4018 /wd4245 /wd4267 /wd4305 /wd4389 /wd4702 /wd4701 /wd4703 /wd4661 /wd4706 /wd4715 /wd4702 -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-unneeded-internal-declaration -Wno-undefined-var-template -Wno-address-of-packed-member -Wno-nonportable-include-path -Wno-user-defined-warnings -Wno-unused-lambda-capture -Wno-null-pointer-arithmetic -Wno-enum-compare-switch -Wno-ignored-pragma-optimize /Z7 -fno-standalone-debug /MT -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wmissing-field-initializers -Winconsistent-missing-override -Wunreachable-code -Wshorten-64-to-32 /wd4245 /wd4267 /wd4324 /wd4701 /wd4702 /wd4703 /wd4709 /wd4714 /wd4715 /wd4718 /wd4723 /wd4724 /wd4800 /O2 /Ob2 /Oy- /Zc:inline /Gw /TP /wd4577 /GR- /c ../../src/base/bits.cc /Foobj/v8_libbase/bits.obj /Fd"obj/v8_libbase_cc.pdb"CreateProcess failed: The system cannot find the file specified.

How do I fix this?
Do I need third_party/llvm-build/Release+Asserts/bin/clang-cl.exe ??
or is there some other magic switch I need to set?

Thanks,

Mike

Mike Moening

unread,
Jul 3, 2018, 2:52:56 PM7/3/18
to v8-users
Oh and I've tried running: gclient sync from my v8 directory:

C:\Dev\common\v8>gclient sync
C:\Dev\common\.gclient_entries missing, .gclient file in parent directory C:\Dev\common might not be the file you want to use.

and it doesn't seem to bring down third_party/llvm-build
Should it??
What am I missing?

Jakob Gruber

unread,
Jul 4, 2018, 3:00:00 AM7/4/18
to v8-u...@googlegroups.com
See https://github.com/v8/v8/wiki/Using-Git. Since something seems messed up with your gclient install (which will fetch clang-cl.exe), try the steps in 'How to start' for a clean checkout. Hope that helps.

Mike Moening

unread,
Jul 9, 2018, 11:26:44 AM7/9/18
to v8-users
I didn't see you post until now.
I solved the issue running this:

C:\Dev\common\v8\tools\clang\scripts>python.bat update.py

Which brought down all the bin files I needed into third_party/llvm-build and now it's compiling!

Mike Moening

unread,
Jul 9, 2018, 11:44:06 AM7/9/18
to v8-users
At the very end of the build I received this error:

C:\Dev\common\v8>ninja -C out.gn/x64.release
ninja: Entering directory `out.gn/x64.release'
[1/7] LINK cctest.exe cctest.exe.pdb
FAILED: cctest.exe cctest.exe.pdb
ninja -t msvc -e environment.x64 -- ../../third_party/llvm-build/Release+Asserts/bin/lld-link.exe /nologo /OUT:./cctest.exe /PDB:.
/cctest.exe.pdb @./cctest.exe.rsp ../../third_party/llvm-build/Release+Asserts/bin\lld-link.exe: error: <root>: undefined symbol: mainCRTStartup
ninja: build stopped: subcommand failed.

Looks like the tests are broken somehow...
Any ideas?

Mike Moening

unread,
Jul 9, 2018, 11:48:27 AM7/9/18
to v8-users
Also the v8_base.lib or any other .lib files we not created.

Kevin Cook

unread,
Aug 14, 2018, 3:58:40 PM8/14/18
to v8-users
Did you ever come up with a solution?

Quan Chen

unread,
Aug 29, 2018, 4:06:33 AM8/29/18
to v8-users
I'm building V8 static libs using VS2017 too and I'm having the same issue. Have you worked out any solution?

Quan Chen

unread,
Aug 29, 2018, 9:52:57 AM8/29/18
to v8-users
"mainCRTStartup is where Windows tries to call to start a program.  It is in the C runtime library ("CRT") and that is the thing that calls main() or winMain(). "
So it's because of the wrong settings of those projects? I'm starting a new fresh sync of the v8 source and will try again as my current source are dirty and I'm not sure I can revert the changes done in .gn and .gni files back to original. 
Reply all
Reply to author
Forward
0 new messages