如何在Cython中链接Mac OS框架

久作

如何在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

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

久作

我从类似的帖子中找到了答案

import os
os.environ['LDFLAGS'] = '-framework CoreFoundation -framework SystemConfiguration'

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章