src-d / tmsc

Other
21 stars 9 forks source link

error: command 'g++' failed with exit status 1 (during installation) #7

Closed jasminetanom closed 6 years ago

jasminetanom commented 6 years ago

Hi there, I'm having an issue with the installation, and I sincerely hope someone could please help me. I ran pip3 install tmsc in the terminal (macOS) and got the following error. I've tried reinstalling setuptools and gcc but still can't resolve the error. Would be truly grateful for any assistance :) (I wanted to post in the Slack channel but I don't know if it's a place for noob questions like this haha.) Thank you!

    mv libuast-v1.9.1 libuast
    cp -a libuast/src bblfsh/libuast
    rm -rf libuast
    building 'bblfsh.pyuast' extension
    creating build/temp.macosx-10.6-intel-3.6
    creating build/temp.macosx-10.6-intel-3.6/bblfsh
    creating build/temp.macosx-10.6-intel-3.6/bblfsh/libuast
    g++ -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -Ibblfsh/libuast/ -I/usr/local/include -I/usr/local/include/libxml2 -I/usr/include -I/usr/include/libxml2 -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c bblfsh/pyuast.cc -o build/temp.macosx-10.6-intel-3.6/bblfsh/pyuast.o -std=c++11
    bblfsh/pyuast.cc:1:10: fatal error: 'cstdint' file not found
    #include <cstdint>
             ^~~~~~~~~
    1 error generated.
    error: command 'g++' failed with exit status 1

    ----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/v3/bk6dxbhs5fg_pswc0h2ngg100000gn/T/pip-build-u9ffqec_/bblfsh/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/v3/bk6dxbhs5fg_pswc0h2ngg100000gn/T/pip-fk64a1cy-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/v3/bk6dxbhs5fg_pswc0h2ngg100000gn/T/pip-build-u9ffqec_/bblfsh/
vmarkovtsev commented 6 years ago

Hi @jasminetanom

No worries, we respond either in issues or in Slack.

Your problem seems to be the lack of system headers. This reminds me something of https://github.com/vrasneur/pyfasttext/issues/1 and similar problems our users had in the past on macOS.

If you are using Anaconda, please ~never use it again~ use the standard pip install. Seriously, 90% of the problems happened because of the screwed environment in Anaconda.

This error appears while the bblfsh package is being installed. You can try to install it separately to debug faster:

pip3 install bblfsh

If the error still shows, I need the output of

g++ -xc++ -E -v -
jasminetanom commented 6 years ago

Hi Vadim, I sincerely appreciate your prompt and helpful response. I ran pip3 install bblfish and the same error shows. The output of g++ -xc++ -E -v - for me is

Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.13.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -E -disable-free -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 305 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0 -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/jasminetan -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.13.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o - -x c++ -
clang -cc1 version 9.0.0 (clang-900.0.39.2) default target x86_64-apple-darwin17.3.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
 /usr/local/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.

Thanks so much once again!

vmarkovtsev commented 6 years ago

Try this:

CFLAGS=-stdlib=libc++ pip3 install bblfish
bluecloudws commented 6 years ago

Thanks, with those flag settings I was able to install bblfish and tmsc

vmarkovtsev commented 6 years ago

Great. @jasminetanom Can I close this?

smola commented 6 years ago

@vmarkovtsev Should we add a Troubleshooting section in README.md with this workaround? Or maybe we should ping bblfsh guys to fix this on libuast/client-python build on macOS?

vmarkovtsev commented 6 years ago

@smola Looks like a bblfsh build issue to me. We've got many Python packages which depend on bblfsh and adding the same troubleshooting to each does not seem elegant... At the same time, the possible fix is to resort to stdint.h - against the standard but works.

bzz commented 6 years ago

If no objections, let's close it, as tmsc on macOS installs well now.

But please, do not hesitate to re-open incase the issue is not solved.