|
| 1 | +# @node-versions: v24.10.0+ |
| 2 | +# @description: Fix abseil duplicate symbol errors on Windows |
| 3 | +# |
| 4 | +# Disables standalone abseil.lib build on Windows by changing the abseil |
| 5 | +# target type from 'static_library' to 'none'. This prevents LNK2005 |
| 6 | +# linker errors where absl::Mutex::Dtor and other symbols are defined |
| 7 | +# in both abseil.lib and v8_libbase.lib. |
| 8 | +# |
| 9 | +# Root cause: Node.js v24 extracted abseil to a separate build target |
| 10 | +# (tools/v8_gypfiles/abseil.gyp) to share code between V8 and perfetto. |
| 11 | +# On Windows with MSVC, this creates duplicate symbol errors because |
| 12 | +# V8's libbase already includes the necessary abseil implementations. |
| 13 | +# |
| 14 | +# Solution: On Windows only, configure abseil as type 'none' so headers |
| 15 | +# are available but no separate static library is built. V8's libbase |
| 16 | +# continues to provide the abseil implementations it needs. |
| 17 | +# |
| 18 | +# Error: abseil.lib(abseil.mutex.obj) : error LNK2005: absl::Mutex::Dtor |
| 19 | +# already defined in v8_libbase.lib(v8_libbase.mutex.obj) |
| 20 | +# |
| 21 | +# References: |
| 22 | +# - https://github.com/nodejs/node/pull/57289 (abseil extraction) |
| 23 | +# - https://github.com/nodejs/node/pull/57582 (abseil deadlock detection) |
| 24 | + |
| 25 | +--- a/tools/v8_gypfiles/abseil.gyp |
| 26 | ++++ b/tools/v8_gypfiles/abseil.gyp |
| 27 | +@@ -3,7 +3,15 @@ |
| 28 | + 'targets': [ |
| 29 | + { |
| 30 | + 'target_name': 'abseil', |
| 31 | +- 'type': 'static_library', |
| 32 | ++ 'conditions': [ |
| 33 | ++ ['OS=="win"', { |
| 34 | ++ # On Windows, abseil symbols are already included in v8_libbase. |
| 35 | ++ # Building a separate abseil.lib causes LNK2005 duplicate symbol errors. |
| 36 | ++ 'type': 'none', |
| 37 | ++ }, { |
| 38 | ++ 'type': 'static_library', |
| 39 | ++ }], |
| 40 | ++ ], |
| 41 | + 'toolsets': ['host', 'target'], |
| 42 | + 'variables': { |
| 43 | + 'ABSEIL_ROOT': '../../deps/v8/third_party/abseil-cpp', |
0 commit comments