2

I updated xcode-select install to the latest version, which doesn't support libstdc++ anymore, therefore libraries such as 'iostream' can't be found when I run:

$ python3 setup.py build_ext --inline

Error message

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

I found this explanation: ld: library not found for -lstdc++.6

and this vague solution: https://forums.developer.apple.com/thread/106114

Is there a way I can append pass '-std=libc++' to the clang command?.

Setup.py file lookes like this:

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"
    ]
)
  • Can you share the result of `/usr/bin/clang --version`? – Louis Dionne Nov 15 '18 at 18:03
  • @LouisDionne Apple LLVM version 10.0.0 (clang-1000.11.45.5) Target: x86_64-apple-darwin18.2.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin – leanGuardia Nov 15 '18 at 18:30
  • I'm surprised -- I think it should pick up the libc++ headers by default. Can you try running `echo '#include ' | /usr/bin/clang -xc++ -fsyntax-only -v -` and report here (e.g. a link to a gist)? – Louis Dionne Nov 16 '18 at 17:13
  • I created it here: https://gist.github.com/leanguardia/b4eba7b7254b227b94d864e6bae3b68e, hopefully, this gives you some insight, thank you for the help. – leanGuardia Nov 16 '18 at 22:58
  • I'm puzzled -- so this command works but not the one used by swig? Something else is wrong here. It's hard for me to help further without a reproducer. – Louis Dionne Nov 19 '18 at 17:11
  • Same happens for me. – Martino Feb 04 '19 at 16:54

0 Answers0