Tf-pose-estimation: pafprocess.cpp:1:10: fatal error: 'iostream' file not found

Created on 24 Nov 2018  路  9Comments  路  Source: ildoonet/tf-pose-estimation

pafprocess $ sudo python setup.py build_ext --inplace
running build_ext
building '_pafprocess' extension
swigging pafprocess.i to pafprocess_wrap.cpp
swig -python -c++ -o pafprocess_wrap.cpp pafprocess.i
g++ -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -I/anaconda3/lib/python3.6/site-packages/numpy/core/include -I. -I/anaconda3/include/python3.6m -c pafprocess.cpp -o build/temp.macosx-10.7-x86_64-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

     ^~~~~~~~~~

1 warning and 1 error generated.
error: command 'g++' failed with exit status 1

Most helpful comment

When compiling with libc++ the recommended minimum deployment target is 10.9 according to https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes

Add the following to setup.py to fix the invalid deployment target error:

os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'

All 9 comments

I got same error. I want to know how to solve it too.
I show my environment below:
銉籱acOS Mojave
銉籿ersion 10.14.2 (18C54)
銉籑acBook(Retina, 12-inch , 2017)

I had the same problem in Mojave and solved it.
You can pass compile option by adding extra_compile_args as following in setup.py.
swig_opts=['-c++'],
extra_compile_args = ['-stdlib=libc++'],

Thank you for sharing your solution.
But, I got new error below:

x86_64-3.6/pafprocess_wrap.o -o /Users/kawanami/workspace/tf-pose-estimation/tf_pose/pafprocess/_pafprocess.cpython-36m-darwin.so
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' failed with exit status 1

My MacOS version is 10.14.2 and following url says "XCode 10.1 (with its command line tools) fixes it again, that's likely why running xcode-select --install works again. I think the problem was in 10.0 only."
https://stackoverflow.com/questions/52441952/os-x-ld-library-not-found-for-lstdc

I solved it.
Firstly, mojave user has to install "Command Line Tools (macOS 10.13) for Xcode 9.4.1" from this link [https://developer.apple.com/download/more/].
In this website, please search with "Command Line Tools".

And after install "Command Line Tools (macOS 10.13) for Xcode 9.4.1", please try below:

$ cd tf_pose/pafprocess

$ swig -python -c++ pafprocess.i && python3 setup.py build_ext --inplace

I hope you can solve this matter.

I had the same problem in Mojave and solved it.
You can pass compile option by adding extra_compile_args as following in setup.py.
swig_opts=['-c++'],
extra_compile_args = ['-stdlib=libc++'],

To solve the second error too, it is enough to add a link option too in the same file:
extra_link_args=['-stdlib=libc++'],

Installing a previous version of Xcode is not the best option since you are simply using a deprecated library.

extra_compile_args = ['-stdlib=libc++'],

To solve the second error too, it is enough to add a link option too in the same file:
extra_link_args=['-stdlib=libc++'],

Installing a previous version of Xcode is not the best option since you are simply using a deprecated library.

Thanks! My bug got solved by this!
swig_opts=['-c++'],
extra_compile_args = ['-stdlib=libc++'],
extra_link_args=['-stdlib=libc++'],

extra_compile_args = ['-stdlib=libc++'],

To solve the second error too, it is enough to add a link option too in the same file:
extra_link_args=['-stdlib=libc++'],
Installing a previous version of Xcode is not the best option since you are simply using a deprecated library.

Thanks! My bug got solved by this!
swig_opts=['-c++'],
extra_compile_args = ['-stdlib=libc++'],
extra_link_args=['-stdlib=libc++'],

I added these to setup.py but get the error clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later). Any ideas how I can fix this?

I am running Mojave 10.14.6 and using swig installed via homebrew.

When compiling with libc++ the recommended minimum deployment target is 10.9 according to https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes

Add the following to setup.py to fix the invalid deployment target error:

os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'

Was this page helpful?
0 / 5 - 0 ratings