Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import libarchive.public error AttributeError: dlsym(0x7fe20861a170, archive_read_open_filename_w): symbol not found #31

Closed
cvanlabe opened this issue Dec 3, 2018 · 3 comments

Comments

@cvanlabe
Copy link

cvanlabe commented Dec 3, 2018

Similar to issue #16 but with a different function where it goes bad so raising this as a separate one just in case.

Been banging my head over this the entire day... and can't see it anymore. This doesn't seem to be a libarchive-c Python issue perse, but let's get it investigated and documented here because it seems a lot of users are stuck with this (according to my Google-fu [or lack thereof])

Environment:
MacOS 10.14.1
Python 3.7.0 using a venv with libarchive-c==2.8
libarchive installed via brew.
Used the brew_find_libarchive script to locate where the devil brew put it: /usr/local/Cellar/libarchive/3.3.3/lib

Then tried different iterations and variations of setting:

  • LD_LIBRARY_PATH both in my system environment variables and above the import using os.environ
  • LA_LIBRARY_FILEPATH both in my system environment variables and above the import using os.environ

Each and every time the error is:

>>> import libarchive.public
read format "cab" is not supported
read format "warc" is not supported
read format "7zip" is not supported
read format "rar" is not supported
read format "lha" is not supported
read filter "all" is not supported
read filter "rpm" is not supported
read filter "lzop" is not supported
read filter "lzma" is not supported
read filter "none" is not supported
read filter "compress" is not supported
read filter "lz4" is not supported
read filter "lzip" is not supported
read filter "bzip2" is not supported
read filter "xz" is not supported
read filter "uu" is not supported
read filter "gzip" is not supported
read filter "grzip" is not supported
read filter "lrzip" is not supported
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/cvanlabe/blablabla/venv/lib/python3.7/site-packages/libarchive/__init__.py", line 1, in <module>
    from .entry import ArchiveEntry
  File "/Users/cvanlabe/blablablavenv/lib/python3.7/site-packages/libarchive/entry.py", line 6, in <module>
    from . import ffi
  File "/Users/cvanlabe/blablabla/venv/lib/python3.7/site-packages/libarchive/ffi.py", line 184, in <module>
    c_int, check_int)
  File "/Users/cvanlabe/blablabla/venv/lib/python3.7/site-packages/libarchive/ffi.py", line 95, in ffi
    f = getattr(libarchive, 'archive_'+name)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 369, in __getattr__
    func = self.__getitem__(name)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 374, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(0x7fe20861a170, archive_read_open_filename_w): symbol not found

Any hints are more than welcome, mind that the steps outlined in issue #16 are already tried (and failed).

How can I help providing better info to troubleshoot this?

@cvanlabe
Copy link
Author

cvanlabe commented Dec 3, 2018

I see in the code here: https://github.com/dsoprea/PyEasyArchive/blob/master/libarchive/library.py#L10

that the filename is hardcoded to: libarchive.so . But on MacOS there's only the files libarchive.13.dylib and libarchive.a .

@cvanlabe
Copy link
Author

cvanlabe commented Dec 3, 2018

Further debugging:

>>> find_and_load_library()
'/usr/lib/libarchive.dylib'
>>> os.environ['LA_LIBRARY_FILEPATH'] = '/usr/local/Cellar/libarchive/3.3.3/lib/libarchive.13.dylib'
>>> find_and_load_library()
'/usr/local/Cellar/libarchive/3.3.3/lib/libarchive.13.dylib'
>>>
>>> ctypes.cdll.LoadLibrary( find_and_load_library() )
<CDLL '/usr/local/Cellar/libarchive/3.3.3/lib/libarchive.13.dylib', handle 7fc8d9f056a0 at 0x109257d68>
>>>
>>>
>>> import libarchive.public
read format "warc" is not supported
read format "lha" is not supported
read format "cab" is not supported
read format "7zip" is not supported
read format "rar" is not supported
read filter "bzip2" is not supported
read filter "lzop" is not supported
read filter "lrzip" is not supported
read filter "compress" is not supported
read filter "grzip" is not supported
read filter "uu" is not supported
read filter "lzip" is not supported
read filter "none" is not supported
read filter "rpm" is not supported
read filter "all" is not supported
read filter "lzma" is not supported
read filter "xz" is not supported
read filter "lz4" is not supported
read filter "gzip" is not supported
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/cvanlabe/blablabla/venv/lib/python3.7/site-packages/libarchive/__init__.py", line 1, in <module>
    from .entry import ArchiveEntry
  File "/Users/cvanlabe/blablabla/venv/lib/python3.7/site-packages/libarchive/entry.py", line 6, in <module>
    from . import ffi
  File "/Users/cvanlabe/blablabla/venv/lib/python3.7/site-packages/libarchive/ffi.py", line 184, in <module>
    c_int, check_int)
  File "/Users/cvanlabe/blablabla/venv/lib/python3.7/site-packages/libarchive/ffi.py", line 95, in ffi
    f = getattr(libarchive, 'archive_'+name)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 369, in __getattr__
    func = self.__getitem__(name)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 374, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(0x7fc8d9f0a960, archive_read_open_filename_w): symbol not found
>>>

So the library does get loaded properly in library.py on line 51 with the correct environment variable set, but then fails further.

@cvanlabe
Copy link
Author

cvanlabe commented Dec 4, 2018

Ok...facepalm... somehow I got on this page through https://pydigger.com/pypi/libarchive thinking this was the Python libarchive library. Code is pretty similar, but not quite the same.

Ultimately, the problem was that I had installed this lib: https://github.com/Changaco/python-libarchive-c

Which is looking for OS Environment variable LIBARCHIVE .

So the following makes everything work:

import os
os.environ['LIBARCHIVE'] = '/usr/local/Cellar/libarchive/3.3.3/lib/libarchive.13.dylib'
import libarchive

Can someone please update the README and clearly articulate for other idiots like myself :) that this is NOT libarchive-c ? :)

Thanks!

Cedric

@cvanlabe cvanlabe closed this as completed Dec 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant