V8 11.2 fails to compile on VS2022, with conflicting C++20 and C++17 compiler arguments

56 views
Skip to first unread message

Ben Ernst

unread,
Feb 27, 2023, 9:14:57 PM2/27/23
to v8-dev
I am having difficulty building V8 on VS2022 (on Windows x64).

I'm using the following build settings passed to "gn":

treat_warnings_as_errors=false
v8_enable_i18n_support=false
v8_monolithic=true
is_component_build=false
use_custom_libcxx=false
is_clang=false
v8_use_external_startup_data=false


The build fails, with a warning citing conflicting switches for C++20 and C++17, then failing to find a standard library header. The following compiler error is detailed below. Could anyone offer some advice diagnosing this issue? I have tried V8 11.2, 11.0 and 10.9, each with the same result. My previous version 10.3 is working fine. Thank you very much in advance!

     [exec] **********************************************************************
     [exec] ** Visual Studio 2022 Developer Command Prompt v17.4.5
     [exec] ** Copyright (c) 2022 Microsoft Corporation
     [exec] **********************************************************************
     [exec] [vcvarsall.bat] Environment initialized for: 'x64'
     [exec] ninja: Entering directory `out.gn/x64.optdebug'
     [exec] [0/1] Regenerating ninja files
     [exec] [1/1418] CXX obj/cppgc_base/allocation.obj
     [exec] FAILED: obj/cppgc_base/allocation.obj
     [exec] ninja -t msvc -e environment.x64 -- "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\cl.exe" /c ../../src/heap/cppgc/allocation.cc /Foobj/cppgc_base/allocation.obj /nologo /showIncludes -DUSE_AURA=1 -D_CRT_NONSTDC_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -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=2 -DWIN32 -D_SECURE_ATL -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_UNICODE -DUNICODE -DNTDDI_VERSION=NTDDI_WIN10_FE -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -D_DEBUG -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DCPPGC_VERIFY_HEAP -DENABLE_DISASSEMBLER -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 -DOBJECT_PRINT -DVERIFY_HEAP -DV8_TRACE_MAPS -DV8_ENABLE_ALLOCATION_TIMEOUT -DV8_ENABLE_FORCE_SLOW_PATH -DV8_ENABLE_DOUBLE_CONST_STORE_CHECK -DENABLE_HANDLE_ZAPPING -DV8_CODE_COMMENTS -DV8_ENABLE_DEBUG_CODE -DV8_ENABLE_HEAP_SNAPSHOT_VERIFY -DV8_SNAPSHOT_NATIVE_CODE_COUNTERS -DV8_ATOMIC_OBJECT_FIELD_WRITES -DV8_ENABLE_LAZY_SOURCE_POSITIONS -DV8_SHARED_RO_HEAP -DV8_WIN64_UNWINDING_INFO -DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH -DV8_SHORT_BUILTIN_CALLS -DV8_EXTERNAL_CODE_SPACE -DV8_ENABLE_MAGLEV -DV8_ENABLE_TURBOFAN -DV8_ENABLE_SYSTEM_INSTRUMENTATION -DV8_ENABLE_ETW_STACK_WALKING -DV8_ENABLE_WEBASSEMBLY -DV8_ALLOCATION_FOLDING -DV8_ALLOCATION_SITE_TRACKING -DV8_ADVANCED_BIGINT_ALGORITHMS -DV8_USE_ZLIB -DV8_ENABLE_WASM_SIMD256_REVEC -DV8_ENABLE_CHECKS -DV8_COMPRESS_POINTERS -DV8_COMPRESS_POINTERS_IN_SHARED_CAGE -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_ENABLE_SANDBOX -DV8_DEPRECATION_WARNINGS -DV8_IMMINENT_DEPRECATION_WARNINGS -DCPPGC_CAGED_HEAP -DCPPGC_YOUNG_GENERATION -DCPPGC_POINTER_COMPRESSION -DCPPGC_SLIM_WRITE_BARRIER -DV8_TARGET_ARCH_X64 -DV8_HAVE_TARGET_OS -DV8_TARGET_OS_WIN -DDEBUG -DENABLE_SLOW_DCHECKS -DV8_RUNTIME_CALL_STATS -I../.. -Igen -I../../include -Igen/include /wd4244 /Gy /FS /bigobj /utf-8 /Zc:sizedDealloc- /wd4117 /D__DATE__= /D__TIME__= /D__TIMESTAMP__= /Zi /MDd /wd4245 /wd4267 /wd4324 /wd4701 /wd4702 /wd4703 /wd4709 /wd4714 /wd4715 /wd4718 /wd4723 /wd4724 /wd4800 /wd4506 /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 /wd4245 /wd4267 /wd4305 /wd4389 /wd4702 /wd4701 /wd4703 /wd4661 /wd4706 /wd4715 /O2 /Ob2 /Oy- /Zc:inline /Gw /std:c++20 /TP /GR- /std:c++17 /Fd"obj/cppgc_base_cc.pdb"
     [exec] cl : Command line warning D9025 : overriding '/std:c++20' with '/std:c++17'
     [exec] C:\88082ece\v8\include/cppgc/allocation.h(8): fatal error C1083: Cannot open include file: 'atomic': No such file or directory



Ben Noordhuis

unread,
Feb 28, 2023, 5:35:35 AM2/28/23
to v8-...@googlegroups.com
On Tue, Feb 28, 2023 at 3:15 AM Ben Ernst
<ben.ernst....@gmail.com> wrote:
>
> use_custom_libcxx=false
>
> [snip]
>
> [exec] cl : Command line warning D9025 : overriding '/std:c++20' with '/std:c++17'
> [exec] C:\88082ece\v8\include/cppgc/allocation.h(8): fatal error C1083: Cannot open include file: 'atomic': No such file or directory

The warning is probably harmless. The fatal error is most likely
caused by use_custom_libcxx=false. That tells V8 to use your system's
libc++ instead of the bundled one but yours is either missing, not
found, or missing some files.

A caveat to keep in mind: you can't mix different libc++s. If you
switch to V8's copy, you have to use it in your application as well.
(How is left as an exercise; there are several ways to go about it.)

Ben Ernst

unread,
Feb 28, 2023, 10:47:04 PM2/28/23
to v8-dev
I am certain that you are correct, my system libc++ (MSVC) is for some reason not found. It is definitely present. Is there any reason that the V8 build system might fail to find it?
Message has been deleted

Ben Ernst

unread,
Mar 6, 2023, 6:29:05 PM3/6/23
to v8-dev
I was able to build V8 on VS2022 version 17.3 (on another computer). I cannot build V8 on VS2022 version 17.5.1 (tested on multiple co-workers' computers). I wonder if something might have changed between these versions of MSVS that prevents the V8 build system from finding the libraries and headers. If anyone has any advice to help figure this out I would appreciate it.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages