如何在Cython中链接Mac OS框架

时间:2018-03-19 15:08:21

标签: macos clang cython cythonize

如何在Cython中链接Mac OS框架?

我失败了

from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
ext_modules=[
    Extension("PyLexActivator",
          sources=["PyLexActivator.pyx"],
          language='c++',
          extra_objects=["libLexActivator.a"], 
          extra_link_args=['-framework CoreFoundation', 
                     '-framework SystemConfiguration'],
    )
]
setup(
  name = "PyLexActivator",
  ext_modules = cythonize(ext_modules)
)

错误

python setup.py build_ext --inplace
running build_ext
building 'PyLexActivator' extension
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/o/anaconda/include -arch x86_64 -I. -I/Users/o/anaconda/include/python3.5m -c PyLexActivator.cpp -o build/temp.macosx-10.6-x86_64-3.5/PyLexActivator.o
/usr/bin/clang++ -bundle -undefined dynamic_lookup -L/Users/o/anaconda/lib -arch x86_64 build/temp.macosx-10.6-x86_64-3.5/PyLexActivator.o libLexActivator.a -L/Users/o/anaconda/lib -o 
/Users/suo/Documents/guanran/face_recommend/cryptlex/PyLexActivator.cpython-35m-darwin.so -framework Foundation -framework SystemConfiguration
clang: error: unknown argument: '-framework CoreFoundation'
clang: error: unknown argument: '-framework SystemConfiguration'
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
error: command '/usr/bin/clang++' failed with exit status 1

添加框架的完整路径也不起作用。

1 个答案:

答案 0 :(得分:1)

我找到了类似post的答案。

<button reset="true" >1 Candy</button>
<button reset="true" >2 Candy</button>