question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not build v8 on windows with VS2019

See original GitHub issue

Hi for a few days I’ve been trying to build v8 on windows with MSVC 14.29.30133 and WinSDK 10.0.19041.0

My build commands:

python3 tools/dev/v8gen.py x64.release.sample
ninja -C out.gn/x64.release.sample v8_monolith

it produces this error

FAILED: obj/v8_base_without_compiler/api.obj
..\..\third_party\llvm-build\Release+Asserts\bin\clang-cl.exe /c ../../src/api/api.cc /Foobj/v8_base_without_compiler/api.obj /nologo /showIncludes:user "-imsvcC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\ATLMFC\include" "-imsvcC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include" "-imsvcC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-imsvcC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-imsvcC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-imsvcC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-imsvcC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-imsvcC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" -DUSE_AURA=1 "-DCR_CLANG_REVISION=\"llvmorg-14-init-18258-g9477a308-1\"" -D_HAS_NODISCARD -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_VB -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 -DV8_INTL_SUPPORT -DENABLE_HANDLE_ZAPPING -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_SYSTEM_INSTRUMENTATION -DV8_ENABLE_WEBASSEMBLY -DV8_ALLOCATION_FOLDING -DV8_ALLOCATION_SITE_TRACKING -DV8_ADVANCED_BIGINT_ALGORITHMS -DV8_COMPRESS_POINTERS -DV8_COMPRESS_POINTERS_IN_SHARED_CAGE -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_DEPRECATION_WARNINGS -DV8_IMMINENT_DEPRECATION_WARNINGS -DCPPGC_CAGED_HEAP -DV8_TARGET_ARCH_X64 -DV8_HAVE_TARGET_OS -DV8_TARGET_OS_WIN -DV8_RUNTIME_CALL_STATS -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_ENABLE_TRACING=1 -DU_ENABLE_RESOURCE_TRACING=0 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -I../.. -Igen -I../../include -Igen/include -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -I../../third_party/zlib -fno-delete-null-pointer-checks -fno-ident -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 /clang:-ffp-contract=off -fcomplete-member-pointers /Gy /FS /bigobj /utf-8 /Zc:twoPhase /Zc:sizedDealloc- /D__WRL_ENABLE_FUNCTION_STATICS__ -fmsc-version=1916 -m64 -msse3 /Brepro -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -ffile-compilation-dir=. -no-canonical-prefixes /W4 -Wimplicit-fallthrough -Wunreachable-code-aggressive -Wthread-safety -Wextra-semi /WX -Wno-missing-field-initializers -Wno-unused-parameter -Wloop-analysis -Wno-unneeded-internal-declaration -Wno-nonportable-include-path -Wno-null-pointer-subtraction -Wenum-compare-conditional -Wno-psabi -Wno-ignored-pragma-optimize -Wmax-tokens -Wshadow /Z7 -gcodeview-ghash -Xclang -fuse-ctor-homing /guard:cf /MT -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Winvalid-offsetof -Wno-range-loop-construct -Werror -Wmissing-field-initializers -Wno-shadow -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 -Wexit-time-destructors /std:c++17 -Wno-trigraphs /Zc:alignedNew- /TP /GR- /Fd"obj/v8_base_without_compiler_cc.pdb"
In file included from ../../src/api/api.cc:52:
../..\src/deoptimizer/deoptimizer.h(109,38): error: offset of on non-standard-layout type 'v8::internal::Deoptimizer' [-Werror,-Winvalid-offsetof]
  static int input_offset() { return offsetof(Deoptimizer, input_); }
                                     ^                     ~~~~~~
..\..\third_party\llvm-build\Release+Asserts\lib\clang\14.0.0\include\stddef.h(104,24): note: expanded from macro 'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
                       ^                     ~
In file included from ../../src/api/api.cc:52:
../..\src/deoptimizer/deoptimizer.h(111,12): error: offset of on non-standard-layout type 'v8::internal::Deoptimizer' [-Werror,-Winvalid-offsetof]
    return offsetof(Deoptimizer, output_count_);
           ^                     ~~~~~~~~~~~~~
..\..\third_party\llvm-build\Release+Asserts\lib\clang\14.0.0\include\stddef.h(104,24): note: expanded from macro 'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
                       ^                     ~
In file included from ../../src/api/api.cc:52:
../..\src/deoptimizer/deoptimizer.h(113,39): error: offset of on non-standard-layout type 'v8::internal::Deoptimizer' [-Werror,-Winvalid-offsetof]
  static int output_offset() { return offsetof(Deoptimizer, output_); }
                                      ^                     ~~~~~~~
..\..\third_party\llvm-build\Release+Asserts\lib\clang\14.0.0\include\stddef.h(104,24): note: expanded from macro 'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
                       ^                     ~
In file included from ../../src/api/api.cc:52:
../..\src/deoptimizer/deoptimizer.h(116,12): error: offset of on non-standard-layout type 'v8::internal::Deoptimizer' [-Werror,-Winvalid-offsetof]
    return offsetof(Deoptimizer, caller_frame_top_);
           ^                     ~~~~~~~~~~~~~~~~~
..\..\third_party\llvm-build\Release+Asserts\lib\clang\14.0.0\include\stddef.h(104,24): note: expanded from macro 'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
                       ^                     ~
4 errors generated.
[1090/1772] CXX obj/v8_base_without_compiler/modules.obj
ninja: build stopped: subcommand failed.

I tried added -Winvalid-offsetof to cflags and also to toolchain.ninja, but with no luck.

Can sombody please help me ?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
caoccaocommented, Feb 16, 2022

No. If you go with the MSVC, it should be 100+MB. Please refer to this dockerfile for the complete steps.

v8_monolith

0reactions
SamCZcommented, Feb 16, 2022

So the only question remains if the v8_monolith library should be around 1GB @caoccao Thanks fror the help image

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I embed v8 on Windows? - c++ - Stack Overflow
It seems like the building procedure for v8 changes frequently. There are a few tutorials out there, but they all seem to be...
Read more >
[v8] build failure · Issue #22282 · microsoft/vcpkg - GitHub
OS: Windows 11 Insider Build 22523; Compiler: VS2019 v16.11.8. To Reproduce Steps to reproduce the behavior: ./vcpkg install v8.
Read more >
How to build V8 on Windows and not go mad - Medium
The first one shows how to build V8 from the sources on Windows machine. The second part explains what is required to plug...
Read more >
Building v8 shared library on windows - Google Groups
I'm following the guide. Meanwhile I managed to build dll files, but I can't make them work in a VS2019 project because of...
Read more >
fatal error LNK1107: invalid or corrupt file: cannot read at ...
I just built V8 and wanted to test it by running a Hello World program. But I had the linker error mentioned in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found