Compilation error for Mac
abodinier opened this issue · comments
I had trouble compiling the C++ code on Mac (More than 20 errors) :
fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. error: command 'gcc' failed with exit status 1
The reason for that is that setuptools used an old compiler which did not support c++11.
I found a fix and I wanted to share it for those it could help.
To fix it, I used an extra arg to the Extension in ./setup.py line 8 :
Before :
word_beam_search_ext = Extension('word_beam_search', sources=src, include_dirs=inc, language='c++)
After :
word_beam_search_ext = Extension('word_beam_search', sources=src, include_dirs=inc, language='c++', extra_compile_args=["-std=c++11"])
Thank you for this great repository.
Hi,
thanks for pointing that out.
Here the problem is that these compiler flags (like "-std=c++11") are not independent of compiler. Or do you know of a way to specify the C++11 standard in a compiler-independent way in setup.py?
To keep setup.py as flexible as possible, I will leave it as it is and propose locally changing setup.py as you described for whoever encounters this issue.
Thanks @abodinier, you have saved my day.
@abodinier's added arg worked for me! Thank you so much.