seomoz / reppy

Modern robots.txt Parser for Python
MIT License
187 stars 40 forks source link

Compilation errors on OSX Mojave 10.14 #126

Closed mfhepp closed 4 years ago

mfhepp commented 4 years ago

Hi, when trying to install Reppy on OSX Mojave 10.14.x, I ran into a problem that many others seem to have with similar libraries:

The gcc compiler from the OSX developer tools does not find standard header files, like so

   warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
    reppy/rep-cpp/src/agent.cpp:1:10: fatal error: 'algorithm' file not found
    #include <algorithm>
             ^~~~~~~~~~~
    1 warning and 1 error generated.
    error: command 'gcc' failed with exit status 1

The solution is pretty simple, yet hard to find: You need to set the environment variable MACOSX_DEPLOYMENT_TARGET to 10.14 for Mojave and likely 10.15 for Catalina, like so

export MACOSX_DEPLOYMENT_TARGET=10.14

Then,

pip install reppy or, what I used pip install --user --force-reinstall --ignore-installed --no-binary :all: reppy

work like a charm.

I spent hours trying to fix this, so maybe this is useful for others :-). A route that did not work out well was using Homebrew to install a standard GCC compiler, btw.

Thanks to @ChristophSchmidl who gave this hint at:

https://github.com/ccxt/ccxt/issues/3710#issuecomment-575627844

dlecocq commented 4 years ago

Thanks, @mfhepp ! I'm sure it'll save folks time :-)