Open Zacharyyyy opened 5 years ago
I cloned the repo and changed main_module_kwargs[‘include_dirs’] in setup.py to
/usr/local/Cellar/hunspell/1.7.0_2/include/hunspell
And the error message changed, now I can't fund any information to fix it.
11 warnings generated.
creating build/lib.macosx-10.9-x86_64-3.7
g++ -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.7/hunspell.o -lhunspell -o build/lib.macosx-10.9-x86_64-3.7/hunspell.cpython-37m-darwin.so
ld: library not found for -lhunspell
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' failed with exit status 1
I have the same problem
have the same issue.
@blatinier Please review this issue
I don't own any mac and I won't. I have no knowledge of mac packaging systems, library folders, architecture, etc… I don't see how I can help much…
Error message says it doesn't find hunspell header file. So you should ensure that hunspell-dev
equivalent for mac is installed.
I hope you'll find a solution
I know it's hacky, but setting:
main_module_kwargs = {"sources" : ['absolute/path/to/your/hunspell_dir/in/python/site-packages/hunspell.cpp'], "language": "c++"}
appears to work. Sure it throws more errors (to do with my SDK), but setup finds the file now.
Update: @MayuraVerma @IRNLPCoder by the way:
The cause of ld: library not found for -lhunspell
appears a lot of the time if you have either a) only installed XCode command line tools without XCode, or b) installed command line tools before installing XCode. (My case is (a).) I can only suggest playing with PATH exports or -L flags - either way, it's out of scope for pyhunspell (and isn't really caused by it) as you are into Hunspell/XCode territory and local variables.
@blatinier by the way - On MacOS, the equivalent of hunspell-dev
/ header files are automatically installed when you install Hunspell via Homebrew. (Which is why the symlink fix over in #26 always works for people after some messing around - the header files are actually there.)
@x-Code-x thank you very much. Uninstalling and reinstalling xcode didn't cut the deal. However, updating the hunspell path in setup.py and running it SOLVED the problem.
platform Darwin is mapped to mac os, else didn't cut the deal either.
elif platform.system() == "Darwin":
main_module_kwargs['define_macros'] = [('_LINUX', None)]
main_module_kwargs['libraries'] = ['hunspell']
main_module_kwargs['include_dirs'] = '/usr/local/Cellar/hunspell/1.7.0_2/include/hunspell',
main_module_kwargs['extra_compile_args'] = ['-Wall']
else:
main_module_kwargs['define_macros'] = [('_LINUX', None)]
main_module_kwargs['libraries'] = ['hunspell']
main_module_kwargs['include_dirs'] = get_linux_include_dirs() + ['/usr/local/Cellar/hunspell/1.7.0_2/include/hunspell']
main_module_kwargs['extra_compile_args'] = ['-Wall']
This change is what I needed for Mac OSX HighSierra 10.13.4 in setup.py:
elif platform.system() == "Darwin":
main_module_kwargs['define_macros'] = [('_LINUX', None)]
main_module_kwargs['libraries'] = ['hunspell-1.7']
main_module_kwargs['include_dirs'] = '/usr/local/Cellar/hunspell/1.7.0_2/include/hunspell',
main_module_kwargs['library_dirs'] = ['/usr/local/Cellar/hunspell/1.7.0_2/lib']
main_module_kwargs['extra_compile_args'] = ['-Wall']
@blatinier macos user here. I managed to get the include error cleanly fixed (using pkg-config), but pkg-config can't help on the library error because it expect a non-version-suffixed library, that hunspell does not (and seemingly) won't provide. Can't we modify the binding so that the built process accepts the version given by pkg-config?
EDIT: If I propose a PR using pkg-config in the setup.py that cleanly fix the problem, will you accept it?
OK there are actually many PRs trying to solve the problem opened for 2+ years. This project looks abandonned
hunspell version: 1.7.0_2 according top in instruction in https://pypi.org/project/hunspell/, I need to provide the .h location in my system. But I don't know how to check that. All I know is that the libs are store in here
/usr/local/Cellar/hunspell/1.7.0_2/lib
, and at the moment there areI have also tried other method to install it, and I have push another issue for the problems with that. https://github.com/blatinier/pyhunspell/issues/26#issuecomment-508415502
the follow is the error message