I am trying to create a Python package with some C code and a NumPy dependency, and I thought using numpy.distutilswould be the easiest way to achieve this. I still have a setup.pyfile
from numpy.distutils.core import setup
from numpy.distutils.misc_util import Configuration
from distutils.extension import Extension
ext_modules=[
Extension("test",
sources=["test.c"],
libraries=["gmp"],
)
]
configuration = Configuration(
package_name = "test",
ext_modules = ext_modules,
)
setup(**configuration.todict())
and empty test.cin the same directory.
But for some reason, it adds uncomfortable flags -arch i386 -arch x86_64at compile time (Mac OS X system), which leads to
ld: warning: ignoring file /usr/local/lib/libgmp.dylib,
file was built for x86_64 which is not the architecture being linked (i386):
/usr/local/lib/libgmp.dylib
and additional issues when calling C functions.
How can I fix this behavior? Can the target architecture be specified in any way?
UPD . I'm just doing now
ARCHFLAGS="-arch x86_64" python setup.py build_ext --inplace
But I would like it to work on any platform without a priori knowledge of architecture, so that I can deploy it.