Skip to content

Commit c7dbc69

Browse files
committed
fix(smol): prevent abseil duplicate symbols on Windows
Disables standalone abseil.lib build on Windows by changing the abseil target type from 'static_library' to 'none'. This prevents LNK2005 linker errors where absl::Mutex::Dtor and other symbols are defined in both abseil.lib and v8_libbase.lib. Root cause: Node.js v24 extracted abseil to a separate build target (tools/v8_gypfiles/abseil.gyp) to share code between V8 and perfetto. On Windows with MSVC, this creates duplicate symbol errors because V8's libbase already includes the necessary abseil implementations. Solution: On Windows only, configure abseil as type 'none' so headers are available but no separate static library is built. V8's libbase continues to provide the abseil implementations it needs. Error: abseil.lib(abseil.mutex.obj) : error LNK2005: absl::Mutex::Dtor already defined in v8_libbase.lib(v8_libbase.mutex.obj) References: - nodejs/node#57289 (abseil extraction) - nodejs/node#57582 (abseil deadlock detection)
1 parent 3891523 commit c7dbc69

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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

Comments
 (0)