Skip to content

Commit 49a15b1

Browse files
committed
Merge pull request #11398 from iblis17/gnu-inline
BLD: add CFLAGS `-fgnu89-inline` on FreeBSD 10+
2 parents ed98629 + 57426e1 commit 49a15b1

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

doc/source/whatsnew/v0.17.1.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,7 @@ Bug Fixes
122122
- Bug in ``to_excel`` with openpyxl 2.2+ and merging (:issue:`11408`)
123123

124124
- Bug in ``DataFrame.to_dict()`` produces a ``np.datetime64`` object instead of ``Timestamp`` when only datetime is present in data (:issue:`11327`)
125+
126+
127+
128+
- Bug in the link-time error caused by C ``inline`` functions on FreeBSD 10+ (with ``clang``) (:issue:`10510`)

setup.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import shutil
1212
import warnings
1313
import re
14+
import platform
1415
from distutils.version import LooseVersion
1516

1617
# versioning
@@ -289,7 +290,10 @@ def run(self):
289290

290291

291292
class CheckingBuildExt(build_ext):
292-
"""Subclass build_ext to get clearer report if Cython is necessary."""
293+
"""
294+
Subclass build_ext to get clearer report if Cython is necessary.
295+
Also, add some platform based compiler flags.
296+
"""
293297

294298
def check_cython_extensions(self, extensions):
295299
for ext in extensions:
@@ -302,8 +306,27 @@ def check_cython_extensions(self, extensions):
302306

303307
def build_extensions(self):
304308
self.check_cython_extensions(self.extensions)
309+
self.add_gnu_inline_flag(self.extensions)
305310
build_ext.build_extensions(self)
306311

312+
def add_gnu_inline_flag(self, extensions):
313+
'''
314+
Add CFLAGS `-fgnu89-inline` for clang on FreeBSD 10+
315+
'''
316+
if not platform.system() == 'FreeBSD':
317+
return
318+
319+
try:
320+
bsd_release = float(platform.release().split('-')[0])
321+
except ValueError: # unknow freebsd version
322+
return
323+
324+
if bsd_release < 10: # 9 or earlier still using gcc42
325+
return
326+
327+
for ext in extensions:
328+
ext.extra_compile_args += ['-fgnu89-inline']
329+
307330

308331
class CythonCommand(build_ext):
309332
"""Custom distutils command subclassed from Cython.Distutils.build_ext

0 commit comments

Comments
 (0)