spotify/sparkey-python

undefined symbol: sparkey_errstring

DomHudson opened this issue · 2 comments

Hi,

I'm having trouble importing the sparkey module with a fresh install. I think this is because ctypes cannot find the sparkey library?

$ pip install git+https://github.com/spotify/sparkey-python.git
$ python

Python 3.6.5 (default, Apr  1 2018, 05:46:30) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sparkey

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dom/Code/sparkey/env/lib/python3.6/site-packages/sparkey/__init__.py", line 69, in <module>
    _errstring = _format(libsparkey.sparkey_errstring, _str, ctypes.c_int)
  File "/usr/lib/python3.6/ctypes/__init__.py", line 361, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib/python3.6/ctypes/__init__.py", line 366, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: python: undefined symbol: sparkey_errstring

I have libsparkey installed so I can succesfully run:

~/repo/sparkey-python$ PYTHONPATH=. python3.6
Python 3.6.3 (default, Oct  3 2017, 21:45:48) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sparkey
>>>

When I remove the library I get:

OSError: libsparkey.so.0: cannot open shared object file: No such file or directory

I am not sure how pip works

What do you get when you run this?

$ nm /usr/local/lib/libsparkey.so.0 | grep sparkey_errstring
0000000000004bc0 T sparkey_errstring

My apologies - it seems my libsparkey installation didn't work properly. Fixing the installation and all works well now.