Skip to content

Commit a961fcb

Browse files
committed
Fix the bug that building process will be broken if add -latomic in Mac with clang. nodejs/node#30099
1 parent 9dfc361 commit a961fcb

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.DS_Store

-4 KB
Binary file not shown.

build_pynng.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# script should ensure that it is built before running. It looks in this file
55
# to see what the expected object file is based on the platform.
66
from cffi import FFI
7-
import os
7+
import os,sysconfig
88
import sys
99

1010
ffibuilder = FFI()
@@ -28,7 +28,16 @@
2828
machine = os.uname().machine
2929
# this is a pretty heuristic... but let's go with it anyway.
3030
# it would be better to get linker information from cmake somehow.
31-
if not ('x86' in machine or 'i386' in machine or 'i686' in machine):
31+
# Building process will be broken if add -latomic in Mac with clang. https://github.com/nodejs/node/pull/30099
32+
clang = False
33+
try:
34+
if os.environ['CC'] == "clang":
35+
clang = True
36+
except KeyError:
37+
clang = False
38+
if sysconfig.get_config_var('CC') == 'clang':
39+
clang = True
40+
if not ('x86' in machine or 'i386' in machine or 'i686' in machine or (clang and 'Darwin' in os.uname().sysname)):
3241
libraries.append('atomic')
3342

3443

0 commit comments

Comments
 (0)