message: Trying out a more sensible fix for the C++11 problems with macOS. Solution inspired by MDAnalysis.
diff: -import os
  +import sys
  import platform
  -from distutils.sysconfig import get_config_var
  -from distutils.version import LooseVersion
  +from distutils.ccompiler import new_compiler
  +from distutils.sysconfig import customize_compiler
  from setuptools import setup, find_packages, Extension
  +if sys.version_info[0] >= 3:
  + from subprocess import getoutput
  +else:
  + from commands import getoutput
  +
  +def using_clang():
  + """Will we be using a clang compiler?
  + """
  + compiler = new_compiler()
  + customize_compiler(compiler)
  + compiler_ver = getoutput("{0} -v".format(compiler.compiler[0]))
  + return 'clang' in compiler_ver
  +
  +cpp_extra_link_args = []
  cpp_extra_compile_args = ['-std=c++11']
  -# Taken from the setup.py file in the pandas-library, see the following issue
  -# for more details: https://github.com/pandas-dev/pandas/issues/23424. For mac,
  -# ensure extensions are built for macos 10.9 when compiling on a 10.9 system or
  -# above, overriding distutils behaviour which is to target the version that
  -# python was built for. This may be overridden by setting
  -# MACOSX_DEPLOYMENT_TARGET before calling setup.py
  -if platform.system() == "Darwin":
  - if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ:
  - current_system = LooseVersion(platform.mac_ver()[0])
  - python_target = LooseVersion(
  - get_config_var('MACOSX_DEPLOYMENT_TARGET'))
  - if python_target < '10.9' and current_system >= '10.9':
  - os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
  +# Needed to specify X++ runtime library on OSX. This solution is replicated
  +# from the setup.py of mdanalysis
  +if platform.system() == 'Darwin' and using_clang():
  + cpp_extra_compile_args.append('-stdlib=libc++')
  + cpp_extra_compile_args.append('-mmacosx-version-min=10.9')
  + cpp_extra_link_args.append('-stdlib=libc++')
  + cpp_extra_link_args.append('-mmacosx-version-min=10.7')
  extensions = [
  # The ACSF C++ extension, wrapped with cython
  @@ -30,6 +38,7 @@ extensions = [
  language='c++',
  include_dirs=["dscribe/libacsf"],
  extra_compile_args=cpp_extra_compile_args,
  + extra_link_args=cpp_extra_link_args,
  ),
  # The MBTR C++ extension, wrapped with cython
  Extension(
  @@ -40,6 +49,7 @@ extensions = [
  language='c++',
  include_dirs=["dscribe/libmbtr"],
  extra_compile_args=cpp_extra_compile_args,
  + extra_link_args=cpp_extra_link_args,
  ),
  ]
  