[8.7] Compile errors with Visual Studio 2019

373 views
Skip to first unread message

Quinten Lansu

unread,
Jan 27, 2021, 3:47:20 AM1/27/21
to v8-users
Hey there,

I am trying to build V8 version 8.7 on Windows using Visual Studio Professional 2019, but I'm getting compile errors due to what appears to be missing move semantics for an std::unique_ptr:

1>  ninja -t msvc -e environment.x64 -- "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64/cl.exe" /nologo /showIncludes -DUSE_AURA=1 -D_HAS_EXCEPTIONS=0 -DCOMPONENT_BUILD -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 -DENABLE_MINOR_MC -DV8_INTL_SUPPORT -DENABLE_HANDLE_ZAPPING -DV8_USE_EXTERNAL_STARTUP_DATA -DV8_ATOMIC_OBJECT_FIELD_WRITES -DV8_ATOMIC_MARKING_STATE -DV8_ENABLE_LAZY_SOURCE_POSITIONS -DV8_WIN64_UNWINDING_INFO -DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH -DV8_SNAPSHOT_COMPRESSION -DV8_GN_HEADER -DV8_GN_HEADER -DV8_TARGET_ARCH_X64 -DV8_HAVE_TARGET_OS -DV8_TARGET_OS_WIN -DDISABLE_UNTRUSTED_CODE_MITIGATIONS -DBUILDING_V8_SHARED -DV8_GN_HEADER -DV8_GN_HEADER -DUSING_V8_BASE_SHARED -DUSING_V8_PLATFORM_SHARED -DV8_GN_HEADER -DV8_GN_HEADER -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_ENABLE_TRACING=1 -DU_ENABLE_RESOURCE_TRACING=0 -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DUCHAR_TYPE=wchar_t -I../.. -Igen -I../.. -I../../include -Igen -Igen/include -Igen/include -I../../include -I../../include -Igen/include -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -I../../include -I../../third_party/zlib /Gy /FS /bigobj /utf-8 /Zc:sizedDealloc- /wd4117 /D__DATE__= /D__TIME__= /D__TIMESTAMP__= /W4 /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 /wd4245 /wd4267 /wd4305 /wd4389 /wd4702 /wd4701 /wd4703 /wd4661 /wd4706 /wd4715 /Zi /MD /wd4245 /wd4267 /wd4324 /wd4701 /wd4702 /wd4703 /wd4709 /wd4714 /wd4715 /wd4718 /wd4723 /wd4724 /wd4800 /wd5205 /wd4506 /O2 /Ob2 /Oy- /Zc:inline /Gw /TP /wd4577 /GR- /c ../../src/api/api.cc /Foobj/v8_base_without_compiler/api.obj /Fd"obj/v8_base_without_compiler_cc.pdb"
1>  C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\include\xutility(4142): error C2280: 'std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>> &std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>::operator =(const std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>> &)': attempting to reference a deleted function
1>  C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\include\memory(2552): note: see declaration of 'std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>::operator ='
1>  C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\include\memory(2552): note: 'std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>> &std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>::operator =(const std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>> &)': function was explicitly deleted
1>  C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\include\vector(1127): note: see reference to function template instantiation '_OutIt *std::_Copy_unchecked<_Iter,std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>*>(_InIt,_InIt,_OutIt)' being compiled
1>          with
1>          [
1>              _OutIt=std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>> *,
1>              _Iter=std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>> *,
1>              _InIt=std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>> *
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\include\vector(1142): note: see reference to function template instantiation 'void std::vector<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>,std::allocator<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>>>::_Assign_range<_Iter>(_Iter,_Iter,std::forward_iterator_tag)' being compiled
1>          with
1>          [
1>              _Iter=std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>> *
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\include\vector(1142): note: see reference to function template instantiation 'void std::vector<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>,std::allocator<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>>>::_Assign_range<_Iter>(_Iter,_Iter,std::forward_iterator_tag)' being compiled
1>          with
1>          [
1>              _Iter=std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>> *
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\include\vector(1153): note: see reference to function template instantiation 'void std::vector<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>,std::allocator<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>>>::assign<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>*,0>(_Iter,_Iter)' being compiled
1>          with
1>          [
1>              _Iter=std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>> *
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\include\vector(1153): note: see reference to function template instantiation 'void std::vector<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>,std::allocator<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>>>::assign<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>*,0>(_Iter,_Iter)' being compiled
1>          with
1>          [
1>              _Iter=std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>> *
1>          ]
1>  C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\include\vector(1150): note: while compiling class template member function 'void std::vector<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>,std::allocator<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>>>::_Copy_assign(const std::vector<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>,std::allocator<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>>> &,std::false_type)'
1>  C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\include\vector(1169): note: see reference to function template instantiation 'void std::vector<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>,std::allocator<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>>>::_Copy_assign(const std::vector<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>,std::allocator<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>>> &,std::false_type)' being compiled
1>  C:\Users\quintenlansu\Documents\google\v8\include\cppgc/heap.h(124): note: see reference to class template instantiation 'std::vector<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>,std::allocator<std::unique_ptr<cppgc::CustomSpaceBase,std::default_delete<cppgc::CustomSpaceBase>>>>' being compiled

I am using the following generation settings:

gn gen out.gn/x64.release --ide=vs2019 --args="is_debug=false is_component_build=true v8_static_library=false is_clang=false use_custom_libcxx=false target_cpu=\"x64\""

The class that is throwing errors looks like this:

/**
* Top-level base class for custom spaces. Users must inherit from CustomSpace
* below.
*/
class CustomSpaceBase {
public:
  virtual ~CustomSpaceBase() = default;
  virtual CustomSpaceIndex GetCustomSpaceIndex() const = 0;
  virtual bool IsCompactable() const = 0;
};

I have tried applying the rule-of-five to the class, to no avail. 

The project I'm working on requires a specific version of Visual Studio Professional 2019, which is 16.7.7. I'm not sure if that is related to my issues, but it will not be possible for me to upgrade to a newer version of the IDE.

I have tried to isolate the compilation issue, but I'm not sure where the offending copy actually occurs. I will continue to investigate the issue myself and will update the thread with a pull request if I have a fix. But obviously I am hoping that I have overlooked something extremely obvious that will resolve my issues straight away. :)

Best regards,

Quinten Lansu

Ben Ernst

unread,
Feb 1, 2021, 6:24:16 AM2/1/21
to v8-users
Unfortunately the DLL build under MSVC++ breaks constantly and requires smarter people than me to fix it. If you can rearchitect your app to permit static linking to V8, you'll have a much better experience.
Ben.

Quinten Lansu

unread,
Feb 1, 2021, 10:07:35 AM2/1/21
to v8-u...@googlegroups.com
Thanks for getting back to me!

I've looked into fixing the compilation issues with Visual Studio 2019, but the problems range from "explicit move constructors are needed" to "don't use the /Zb:inline flag" and "I don't know why this exported class cannot be found by the linker".

I don't think it's feasible for me to both fix and maintain compiling V8 with Visual Studio. It's clear that the project's use of cutting-edge C++ features is incompatible with the toolchain I'm using on my project.

I will instead be using Duktape (https://duktape.org/), which seems much closer aligned to my project's goals. I will therefore not require any further assistance with V8.

-Quinten

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to a topic in the Google Groups "v8-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/v8-users/iMFNsV_cTEA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to v8-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/8c7aedce-019a-485e-b6c1-3878cc07f4c2n%40googlegroups.com.

Rodrigo Hernandez

unread,
Feb 1, 2021, 11:46:22 PM2/1/21
to v8-users
Is there a reason it MUST be 8.7?

I am the current maintainer for Windows builds on VCPKG and Mingw-w64, the VCPKG version is probably exactly what you need, but it currently sits at 8.6.
I am working on an update to current stable version 8.8, but if it must be 8.7 you may have to see the port and figure it out yourself.
VCPKG: https://github.com/microsoft/vcpkg
Direct link to the port: https://github.com/microsoft/vcpkg/tree/master/ports/v8

Ben Noordhuis

unread,
Feb 2, 2021, 8:18:40 AM2/2/21
to v8-users
On Tue, Feb 2, 2021 at 5:46 AM Rodrigo Hernandez
<kwizatz.ae...@gmail.com> wrote:
>
> Is there a reason it MUST be 8.7?
>
> I am the current maintainer for Windows builds on VCPKG and Mingw-w64, the VCPKG version is probably exactly what you need, but it currently sits at 8.6.
> I am working on an update to current stable version 8.8, but if it must be 8.7 you may have to see the port and figure it out yourself.
> VCPKG: https://github.com/microsoft/vcpkg
> Direct link to the port: https://github.com/microsoft/vcpkg/tree/master/ports/v8

In that vein: I recently updated to
https://github.com/bnoordhuis/v8-cmake and it's known to build with
Visual Studio (tested through GitHub Action's CI.)
Reply all
Reply to author
Forward
0 new messages