Georgetown-IR-Lab / QuickUMLS

System for Medical Concept Extraction and Linking
MIT License
369 stars 95 forks source link

Python3 wrapper build fails on OS X #4

Closed mlucas-NU closed 7 years ago

mlucas-NU commented 7 years ago

Swig fails to link the correct libraries to compile _simstring*.so

Undefined symbols for architecture x86_64: "_PyArg_ParseTuple", referenced from: _wrap_delete_SwigPyIterator(_object, _object) in export_wrap.o _wrap_SwigPyIterator_value(_object, _object) in export_wrap.o _wrap_SwigPyIterator_incr(_object, _object) in export_wrap.o _wrap_SwigPyIterator_decr(_object, _object) in export_wrap.o _wrap_SwigPyIterator_distance(_object, _object) in export_wrap.o _wrap_SwigPyIterator_equal(_object, _object) in export_wrap.o _wrap_SwigPyIterator_copy(_object, _object) in export_wrap.o ...

A similar problem occurred in another project and a solution was found.

https://github.com/chokkan/crfsuite/issues/11

I have verified that the same solution works by halting installation after the simstring tgz is unpacked, adding '-Wl,-undefined,dynamic_lookup' to extra_link_args in simstring/swig/python/setup.py.in, and resuming the installation.

soldni commented 7 years ago

thanks for pointing this out! I'll take a look at it later today.

mlucas-NU commented 7 years ago

I worked on this a little more. The above fix will allow the compiler to finish, but without the correct links to PyArg or libiconv. Running the example files still crashes when looking for libiconv, so that doesn't look like the right solution after all.

I noticed you made some progress within the osx-bug branch of Georgetown-IR-Lab/SimString, but I'm still having trouble compiling SimString with either project.

mlucas-NU commented 7 years ago

I found another repo that has a solution for compiling the module on OSX: github.com/blinkhealth/simstring-python-package

Generate the .so:

git clone https://github.com/blinkhealth/simstring-python-package cd simstring-python-package python setup.py build_ext --inplace

Then it just needs to be copied to the destination (after the standard installation fails, the correct folder is quickumls/simstring).

soldni commented 7 years ago

Thanks for pointing the repo out. It seems that your solution works, at least on OS X. Let me test it on some linux distribution, too. If it works there as well, I will switch over. Thanks a lot!

soldni commented 7 years ago

I've just released a new version that integrates the version of simstring you suggested. Again, thanks for the help! Let me know if you stumble across any other issue.