How To Create A .dylib C Extension On Mac Os X With Distutils And/or Setuptools?
I need to make a C extension with distutils (and/or setuptools) that can be used BOTH dynamically at runtime, and at compile time (for different purposes). This isn't a problem on
Solution 1:
Here's what worked for me (added lines in my setup.py
):
if sys.platform == 'darwin':
from distutils import sysconfig
vars = sysconfig.get_config_vars()
vars['LDSHARED'] = vars['LDSHARED'].replace('-bundle', '-dynamiclib')
This configuration seems to be hard-wired in the module _sysconfigdata
. It's also overridable using environment variables, so this works as well:
LDSHARED="cc -dynamiclib -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F." python setup.py install
Post a Comment for "How To Create A .dylib C Extension On Mac Os X With Distutils And/or Setuptools?"