osx - Use Cython to link python to a shared library in Mac OS -
i'm try integrate others give me shared library .so
files , .h
files.
in mac os, shared library should .dylib
, don't how set environment or other way solve problems when want try link shared library .so
files in mac.
i have pyd/pyx
file created manually. example, have named hellopy.so
shared library. distutils setup.py files:
from setuptools import setup, find_packages cython.build import cythonize cython.distutils import build_ext, extension other_dir='' cython_header_dir ='' common_args = { "include_dirs": [other_dir], "library_dirs": [other_dir], "language": "c++", "cython_include_dirs": [cython_header_dir], } extensions = [ extension(name="api.api", sources=["api/api.pyx"], extra_compile_args=[], extra_link_args=[], # todo fix libraries problems libraries=["hellopy"], **common_args), setup( include_package_data=true, install_requires=["cython>=0.22"], setup_requires=["cython>=0.22"], packages=find_packages(), cmdclass={"build_ext": build_ext}, ext_modules=cythonize(extensions), exclude_package_data={"": ["*.cpp"]} )
then try compile package.
python setup.py build_ext --inplace ld: library not found -lhellopy clang: error: linker command failed exit code 1 (use -v see invocation)
Comments
Post a Comment