From 57426e1c9f1588845938dfe6277324fc82a5b3bd Mon Sep 17 00:00:00 2001 From: Iblis Lin Date: Wed, 21 Oct 2015 12:42:15 +0800 Subject: [PATCH] BLD: Close #10510, add CFLAGS `-fgnu89-inline` on FreeBSD 10+ --- doc/source/whatsnew/v0.17.1.txt | 4 ++++ setup.py | 25 ++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.17.1.txt b/doc/source/whatsnew/v0.17.1.txt index bdfbf08b37e57..ea26fdd90c4da 100755 --- a/doc/source/whatsnew/v0.17.1.txt +++ b/doc/source/whatsnew/v0.17.1.txt @@ -115,3 +115,7 @@ Bug Fixes - Fixed a bug that prevented the construction of an empty series of dtype ``datetime64[ns, tz]`` (:issue:`11245`). - Bug in ``DataFrame.to_dict()`` produces a ``np.datetime64`` object instead of ``Timestamp`` when only datetime is present in data (:issue:`11327`) + + + +- Bug in the link-time error caused by C ``inline`` functions on FreeBSD 10+ (with ``clang``) (:issue:`10510`) diff --git a/setup.py b/setup.py index 2d1b9374f6c94..cf940cb9e27c4 100755 --- a/setup.py +++ b/setup.py @@ -11,6 +11,7 @@ import shutil import warnings import re +import platform from distutils.version import LooseVersion # versioning @@ -289,7 +290,10 @@ def run(self): class CheckingBuildExt(build_ext): - """Subclass build_ext to get clearer report if Cython is necessary.""" + """ + Subclass build_ext to get clearer report if Cython is necessary. + Also, add some platform based compiler flags. + """ def check_cython_extensions(self, extensions): for ext in extensions: @@ -302,8 +306,27 @@ def check_cython_extensions(self, extensions): def build_extensions(self): self.check_cython_extensions(self.extensions) + self.add_gnu_inline_flag(self.extensions) build_ext.build_extensions(self) + def add_gnu_inline_flag(self, extensions): + ''' + Add CFLAGS `-fgnu89-inline` for clang on FreeBSD 10+ + ''' + if not platform.system() == 'FreeBSD': + return + + try: + bsd_release = float(platform.release().split('-')[0]) + except ValueError: # unknow freebsd version + return + + if bsd_release < 10: # 9 or earlier still using gcc42 + return + + for ext in extensions: + ext.extra_compile_args += ['-fgnu89-inline'] + class CythonCommand(build_ext): """Custom distutils command subclassed from Cython.Distutils.build_ext