v8 / v8.dev

The source code of v8.dev, the official website of the V8 project.
https://v8.dev/
Apache License 2.0
944 stars 318 forks source link

V8 ABSEIL Build Fails On Windows #766

Open mirceagoga opened 3 months ago

mirceagoga commented 3 months ago

v8 version: 12.7.138 OS: Windows 11 Build Tools: Clang and Visual Studio 2022

Hello,

I'm trying to upgrade from v8 11.6 to the latest 12.7 on Windows but it fails at third_party_abseil-cpp_absl link step.

How to reproduce:

  1. run config: python3 tools\dev\v8gen.py -b x64.release x64.release -- is_debug=false is_clang=true is_component_build=true use_custom_libcxx=false use_lld=false v8_static_library=false v8_monolithic=false v8_use_external_startup_data=true v8_enable_test_features=false v8_enable_i18n_support=false treat_warnings_as_errors=false v8_enable_pointer_compression=false
  2. run ninja -v -C out.gn/x64.release third_party_abseil-cpp_absl.dll

The log is huge but it cosists of "error LNK2001: unresolved external symbol ...":

ninja -C out.gn/x64.release third_party_abseil-cpp_absl.dll ninja: Entering directory 'out.gn/x64.release' [1/1] LINK(DLL) third_party_abseil-cpp_absl.dll third_party_abseil-cpp_absl.dll.lib third_party_abseil-cpp_absl.dll.pdb " FAILED: third_party_abseil-cpp_absl.dll third_party_abseil-cpp_absl.dll.lib third_party_abseil-cpp_absl.dll.pdb "C:/depot_tools/bootstrap-2@3_11_8_chromium_35_bin/python3/bin/python3.exe" ../../build/toolchain/win/tool_wrapper.py link-wrapper environment.x64 False link.exe "/OUT:./third_party_abseil-cpp_absl.dll" /nologo "/IMPLIB:./third_party_abseil-cpp_absl.dll.lib" /DLL "/PDB:./third_party_abseil-cpp_absl.dll.pdb" "@./third_party_abseil-cpp_absl.dll.rsp" third_party_abseil-cpp_absl.dll.exp : error LNK2001: unresolved external symbol "public: __cdecl absl::AlphaNum::AlphaNum<class std::__Cr::allocator<char> >(class std::__Cr::basic_string<char,struct std::__Cr::char_traits<char>,class std::__Cr::allocator<char> > const &)" (??$?0V?$allocator@D@__Cr@std@@@AlphaNum@absl@@QEAA@AEBV?$basic_string@DU?$char_traits@D@__Cr@std@@V?$allocator@D@23@@__Cr@std@@@Z) third_party_abseil-cpp_absl.dll.exp : error LNK2001: unresolved external symbol "public: __cdecl absl::Cord::Cord<class std::__Cr::basic_string<char,struct std::__Cr::char_traits<char>,class std::__Cr::allocator<char> >,0>(class std::__Cr::basic_string<char,struct std::__Cr::char_traits<char>,class std::__Cr::allocator<char> > &&)" (??$?0V?$basic_string@DU?$char_traits@D@__Cr@std@@V?$allocator@D@23@@__Cr@std@@$0A@@Cord@absl@@QEAA@$$QEAV?$basic_string@DU?$char_traits@D@__Cr@std@@V?$allocator@D@23@@__Cr@std@@@Z)

Things I tried:

  1. build with MSVC build tools: abseil works, other v8 project fails
  2. use /std:c++20, /std:c++17: the same
  3. build only abseil with MSVC (is_clang=false) and modify v8/BUILD.gn to use that one: other link issues on mksnapsot step: ninja -C out.gn/release v8 v8_libplatform v8_libbase ninja: Entering directory 'out.gn/x64.release' [1/11] LINK mksnapshot.exe mksnapshot.exe.pdb FAILED: mksnapshot.exe mksnapshot.exe.pdb "C:/depot_tools/bootstrap-2@3_11_8_chromium_35_bin/python3/bin/python3.exe" ../../build/toolchain/win/tool_wrapper.py link-wrapper environment.x64 False link.exe "/OUT:./mksnapshot.exe" /nologo "/PDB:./mksnapshot.exe.pdb" "@./mksnapshot.exe.rsp" wasm-revec-phase.obj : error LNK2001: unresolved external symbol "private: void __cdecl absl::container_internal::HashSetResizeHelper::InitControlBytesAfterSoo(enum absl::container_internal::ctrl_t *,enum absl::container_internal::ctrl_t,unsigned __int64)" (?InitControlBytesAfterSoo@HashSetResizeHelper@container_internal@absl@@AEAAXPEAW4ctrl_t@23@W4423@_K@Z) wasm-gc-optimize-phase.obj : error LNK2001: unresolved external symbol "private: void __cdecl absl::container_internal::HashSetResizeHelper::InitControlBytesAfterSoo(enum absl::container_internal::ctrl_t *,enum absl::container_internal::ctrl_t,unsigned __int64)" (?InitControlBytesAfterSoo@HashSetResizeHelper@container_internal@absl@@AEAAXPEAW4ctrl_t@23@W4423@_K@Z) wasm-gc-typed-optimization-reducer.obj : error LNK2001: unresolved external symbol "private: void __cdecl absl::container_internal::HashSetResizeHelper::InitControlBytesAfterSoo(enum absl::container_internal::ctrl_t *,enum absl::container_internal::ctrl_t,unsigned __int64)" (?InitControlBytesAfterSoo@HashSetResizeHelper@container_internal@absl@@AEAAXPEAW4ctrl_t@23@W4423@_K@Z) wasm-lowering-phase.obj : error LNK2001: unresolved external symbol "private: void __cdecl absl::container_internal::HashSetResizeHelper::InitControlBytesAfterSoo(enum absl::container_internal::ctrl_t *,enum absl::container_internal::ctrl_t,unsigned __int64)" (?InitControlBytesAfterSoo@HashSetResizeHelper@container_internal@absl@@AEAAXPEAW4ctrl_t@23@W4423@_K@Z) wasm-optimize-phase.obj : error LNK2001: unresolved external symbol "private: void __cdecl absl::container_internal::HashSetResizeHelper::InitControlBytesAfterSoo(enum absl::container_internal::ctrl_t *,enum absl::container_internal::ctrl_t,unsigned __int64)" (?InitControlBytesAfterSoo@HashSetResizeHelper@container_internal@absl@@AEAAXPEAW4ctrl_t@23@W4423@_K@Z)

From what I know, Clang compiler is a must on Windows. Does anyone know a workaround for this issue ?

quirkyli commented 2 months ago

We have the same issue now, and hope for a solution..... @mathiasbynens @RReverser @mirceagoga Do you find any solution?

mirceagoga commented 2 months ago

@quirkyli I used an older version, 11.6, which doesn`t have dependency on this dll.

quirkyli commented 1 month ago

@mirceagoga Thanks for your comment. But we have to upgrade v8, since security requirement.....So, still for hope for a solution for high version....

LeszekSwirski commented 1 month ago

Does it work with is_component_build = false? This looks like abseil has symbol export issues.

quirkyli commented 1 month ago

Hi @LeszekSwirski , I also tried this parameter, but still didn't work. I found the same issue in this website https://groups.google.com/g/v8-users/c/NT1_kNtE-hE/m/F8JgWM4EAAAJ. It seems that compiling static library is ok, but compiling version 12.X of dynamic library is failed.

caoccao commented 1 month ago

I always build v8_monolith, then build a DLL on top of it. It works well with v12.x.