Xcode更新后,“ python3 setup.py build_ext --inplace”中断,因为它使用libstdc ++而不是libc ++

时间:2018-11-14 19:57:50

标签: python xcode setup.py libstdc++ libc++

我将xcode-select安装更新为最新版本,该版本不再支持libstdc ++,因此在运行时找不到'iostream'之类的库:

$ python3 setup.py build_ext --inline

错误消息

running build_ext
building '_pafprocess' extension
swigging pafprocess.i to pafprocess_wrap.cpp
swig -python -c++ -o pafprocess_wrap.cpp pafprocess.i
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -I/Users/luchovilla/Py/posEst/lib/python3.6/site-packages/numpy/core/include -I. -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pafprocess.cpp -o build/temp.macosx-10.6-intel-3.6/pafprocess.o
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++
      standard library instead [-Wstdlibcxx-not-found]
pafprocess.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
         ^~~~~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/clang' failed with exit status 1

我找到了以下解释:ld: library not found for -lstdc++.6

和这个模糊的解决方案:https://forums.developer.apple.com/thread/106114

有没有办法将通行符'-std = libc ++'附加到clang命令?

Setup.py文件如下所示:

from distutils.core import setup, Extension
import numpy
import os

# os.environ['CC'] = 'g++';
setup(name='pafprocess_ext', version='1.0',
    ext_modules=[
        Extension('_pafprocess', ['pafprocess.cpp', 'pafprocess.i'],
                  swig_opts=['-c++'],
                  depends=["pafprocess.h"],
                  include_dirs=[numpy.get_include(), '.'])
    ],
    py_modules=[
        "pafprocess"
    ]
)

0 个答案:

没有答案