proycon / LaMachine

LaMachine - A software distribution of our in-house as well as some 3rd party NLP software - Virtual Machine, Docker, or local compilation/installation script
https://proycon.github.io/LaMachine
GNU General Public License v3.0
68 stars 20 forks source link

[virtualenv] Some packages don't work on Mac OS X (hunspell, python-frog) #5

Closed proycon closed 6 years ago

proycon commented 8 years ago

During install:

Python-timbl compilation, no pthread on Mac OS X?

building 'timblapi' extension
creating build
creating build/temp.macosx-10.10-x86_64-3.4
creating build/temp.macosx-10.10-x86_64-3.4/src
clang -Wno-unused-result -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/boost/1.58.0/include/ -I/Users/proycon/work/LaMachine/lamachine/include -I/usr/include/libxml2 -I/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/timblapi.cc -o build/temp.macosx-10.10-x86_64-3.4/src/timblapi.o
In file included from src/timblapi.cc:47:
src/timblapi.h:72:165: error: expected expression
        TimblApiWrapper(const std::string& args, const std::string& name="") : Timbl::TimblAPI(args, name) { detachedexp = NULL; debug = false; runningthreads = 0; lock = PTHREAD_MUTEX_INITIALIZER;}
                                                                                                                                                                           ^
/usr/include/pthread.h:180:35: note: expanded from macro 'PTHREAD_MUTEX_INITIALIZER'
#define PTHREAD_MUTEX_INITIALIZER {_PTHREAD_MUTEX_SIG_init, {0}}

Python-frog compilation:

clang++ -bundle -undefined dynamic_lookup build/temp.macosx-10.10-x86_64-3.4/frog_wrapper.o -L/Users/proycon/work/LaMachine/lamachine/lib -L/Users/proycon/local/lib/ -L/usr/lib -L/usr/local/lib -lfrog -lucto -lfolia -o build/lib.macosx-10.10-x86_64-3.4/frog.so
ld: warning: directory not found for option '-L/Users/proycon/local/lib/'
running install_lib
copying build/lib.macosx-10.10-x86_64-3.4/frog.so -> /Users/proycon/work/LaMachine/lamachine/lib/python3.4/site-packages
running install_egg_info
Writing /Users/proycon/work/LaMachine/lamachine/lib/python3.4/site-packages/python_frog-0.2.5.1-py3.4.egg-info

Gecco setup, error in 3rd party dependency hunspell.

rocessing dependencies for Gecco==0.2
Searching for hunspell
Reading https://pypi.python.org/simple/hunspell/
Best match: hunspell 0.3.3
Downloading https://pypi.python.org/packages/source/h/hunspell/hunspell-0.3.3.tar.gz#md5=25ceaf642f16e623a857689b2323bd65
Processing hunspell-0.3.3.tar.gz
Writing /var/folders/16/2x7n_xyn0nl64z08qk695c440000gn/T/easy_install-egn1e49c/hunspell-0.3.3/setup.cfg
Running hunspell-0.3.3/setup.py -q bdist_egg --dist-dir /var/folders/16/2x7n_xyn0nl64z08qk695c440000gn/T/easy_install-egn1e49c/hunspell-0.3.3/egg-dist-tmp-awkhvry5
hunspell.c:21:10: fatal error: 'hunspell.h' file not found
#include <hunspell.h>
         ^
1 error generated.
error: Setup script exited with error: command 'clang' failed with exit status 1
================= ERROR ===================
setup.py install gecco failed
===========================================

From python interpreter:

Python 3.4.3 (default, May  1 2015, 19:14:18)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.49)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import frog
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/proycon/work/LaMachine/lamachine/lib/python3.4/site-packages/frog.so, 2): Symbol not found: __ZNSt3__1lsIcNS_11char_traitsIcEENS_9allocatorIcEEEERNS_13basic_ostreamIT_T0_EES9_RKNS_12basic_stringIS6_S7_T1_EE
  Referenced from: /Users/proycon/work/LaMachine/lamachine/lib/libfrog.1.dylib
  Expected in: flat namespace
 in /Users/proycon/work/LaMachine/lamachine/lib/libfrog.1.dylib
>>> import timbl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/proycon/work/LaMachine/lamachine/lib/python3.4/site-packages/timbl.py", line 24, in <module>
    import timblapi
ImportError: dlopen(/Users/proycon/work/LaMachine/lamachine/lib/python3.4/site-packages/timblapi.so, 2): Symbol not found: __ZN5boost6python6detail11init_moduleER11PyModuleDefPFvvE
  Referenced from: /Users/proycon/work/LaMachine/lamachine/lib/python3.4/site-packages/timblapi.so
  Expected in: flat namespace
 in /Users/proycon/work/LaMachine/lamachine/lib/python3.4/site-packages/timblapi.so
>>>
proycon commented 8 years ago

python-frog and python-ucto compile but fail during module import, most likely related to issue LanguageMachines/libfolia#3

>>> import ucto
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/proycon/LaMachine/lamachine/lib/python3.4/site-packages/ucto.so, 2): Symbol not found: __ZNK5folia9FoliaImpl10element_idEv
  Referenced from: /Users/proycon/LaMachine/lamachine/lib/libucto.2.dylib
  Expected in: flat namespace
 in /Users/proycon/LaMachine/lamachine/lib/libucto.2.dylib
proycon commented 8 years ago

python-ucto now works, python-frog breaks still with same error as in first message

proycon commented 8 years ago

Removed gecco from LaMachine entirely... python-frog still fails:

Details for failed test [python] frog: Traceback (most recent call last): File "", line 1, in ImportError: dlopen(/Users/proycon/work/LaMachine/lamachine/lib/python3.5/site-packages/frog.cpython-35m-darwin.so, 2): Symbol not found: ZNSt31lsIcNS_11char_traitsIcEENS_9allocatorIcEEEERNS_13basic_ostreamIT_T0_EES9_RKNS_12basic_stringIS6_S7_T1_EE Referenced from: /Users/proycon/work/LaMachine/lamachine/lib/libfrog.1.dylib Expected in: flat namespace in /Users/proycon/work/LaMachine/lamachine/lib/libfrog.1.dylib

geledek commented 7 years ago

Hi @proycon, I still have error importing python-ucto on macOS.

The error is similar to the last one.

>>> import ucto Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: dlopen(/Users/u1/anaconda2/envs/py3/lib/python3.5/site-packages/ucto.cpython-35m-darwin.so, 2): Symbol not found: __ZN9Tokenizer14TokenizerClass12tokenizeLineERKSsS2_ Referenced from: /Users/u1/anaconda2/envs/py3/lib/python3.5/site-packages/ucto.cpython-35m-darwin.so Expected in: flat namespace in /Users/u1/anaconda2/envs/py3/lib/python3.5/site-packages/ucto.cpython-35m-darwin.so

proycon commented 7 years ago

Sorry for the delay, this is indeed a rather persistent problem that we don't really know the cause of :(

mikekestemont commented 7 years ago

I am also stuck on this last error... Any progress in the meanwhile?

proycon commented 7 years ago

Not really no. I would have to dive into this again. It's very mac-specific..

proycon commented 6 years ago

I'm digging into the Mac OS X compilation issues again in the scope of the new LaMachine v2 developments where I run into similar issues. python-timbl and colibricore compile and import fine.

One issue on Mac OS X is that libstdc++ is deprecated and libc++ should be used instead, so I pass the necessary -stdlib flag now in LaMachine v2.

python-ucto and python-frog compile but fail with a missing symbol (the same one, albeit different ones than in the original posts of this issue):

>>> import ucto
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/proycon/.conda/envs/lamachine-conda-dev-mac/lib/python3.6/site-packages/ucto.cpython-36m-darwin.so, 2): Symbol not found: __ZN4TiCC17UnicodeNormalizer9normalizeERKN6icu_5813UnicodeStringE
  Referenced from: /Users/proycon/lamachine-conda-dev-mac/lib/libfolia.8.dylib
  Expected in: flat namespace
 in /Users/proycon/lamachine-conda-dev-mac/lib/libfolia.8.dylib

ticcutils was not explicitly linked (otool -L), but adding that didn't help things either. After investigation with nm libticcutils.4.dylib I found that the icu version in the symbol name is different!

0000000000032760 T __ZN4TiCC17UnicodeNormalizer9normalizeERKN6icu_6013UnicodeStringE

So I'm guessing during compilation the wrong icu version is found? Investigating..

proycon commented 6 years ago

Finally solved now in upcoming LaMachine v2

mikekestemont commented 6 years ago

awesome

Thanks!