Skip to content

Commit 8820241

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

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

.DS_Store

-10 KB
Binary file not shown.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.DS_Store
12
*~
23
*.o
34
*.so

build_pynng.py

Lines changed: 11 additions & 2 deletions
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)