V8 ABSEIL Build Fails On Windows
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:
- 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 - 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:
- build with MSVC build tools: abseil works, other v8 project fails
- use
/std:c++20,/std:c++17: the same - build only abseil with MSVC (
is_clang=false) and modify v8/BUILD.gn to use that one: other link issues onmksnapsotstep: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 ?
We have the same issue now, and hope for a solution..... @mathiasbynens @RReverser @mirceagoga Do you find any solution?
@quirkyli I used an older version, 11.6, which doesn`t have dependency on this dll.
@mirceagoga Thanks for your comment. But we have to upgrade v8, since security requirement.....So, still for hope for a solution for high version....
Does it work with is_component_build = false? This looks like abseil has symbol export issues.
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.
I always build v8_monolith, then build a DLL on top of it. It works well with v12.x.
The issue seems to be in symbols_x64_rel.def, which attempts to export some unavailable symbols. One possible workaround is:
- remove all unavailable symbols to let the build go
- then you will have the problematic abseil dlls
- build abseil with cmake to generate new abseil dlls
- use the new dlls to replace the problematic ones
@lexusv8ls600h Than you for the istructions. I managed to get the build working (v13.1.131) and after some headaches with linking from a Visual Studio project, I found the configuration that works for me:
python3 tools\dev\v8gen.py -b x64.release clang -- 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
I suspect use_lld=false is a must if you link from a VC project.
I kept the same absl lib since the application seems to work fine, I'll replace with my build if it has issues.
I've attached my /third_party/abseil-cpp/symbols_x64_rel.def
symbols_x64_rel.txt
To build abseil you have to do something like this (using Visual Studio):
cd ./third_party/abseil-cpp/
mkdir .build
cd .build
cmake .. -G "Visual Studio 17 2022" -DABSL_PROPAGATE_CXX_STD=On -DABSL_BUILD_MONOLITHIC_SHARED_LIBS=ON -DBUILD_SHARED_LIBS=ON
Open Solution, set name to match v8 abseil, build tools to clang and std standard to C++20 and build absl_dll
@quirkyli