Skip to content

Commit 00b02f2

Browse files
committed
Ensure that native addons on Mac does not export symbols see: nodejs/node-addon-api#460
1 parent 6c2ba94 commit 00b02f2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

binding.gyp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,18 @@
1818
},
1919
}],
2020
['OS=="mac"', {
21+
# OSX symbols are exported by default
22+
# if 2 different copies of the same symbol appear in a process
23+
# it can cause a conflict
24+
# this prevents exporting the symbols
25+
# the `+` prepends these flags
26+
'cflags+': [ '-fvisibility=hidden' ],
27+
'cflags_cc+': [ '-fvisibility=hidden' ],
2128
'xcode_settings': {
2229
# Minimum mac osx target version (matches node v16.14.2)
2330
'MACOSX_DEPLOYMENT_TARGET': '10.13',
31+
# This is also needed to prevent exporting of symbols
32+
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',
2433
'OTHER_CFLAGS': [
2534
'-std=c99',
2635
'-arch x86_64',

0 commit comments

Comments
 (0)