sighingnow / libclang

(Unofficial) Release libclang (clang.cindex) on pypi.
https://pypi.org/project/libclang
Other
81 stars 21 forks source link

Invalid MacOS `libclang.dylib` in 11.0.0 #2

Closed michael-go closed 3 years ago

michael-go commented 3 years ago

Hi 👋

Thanks for this nice package!

Version 11.0.0 fails with:

  File "/usr/local/lib/python3.7/site-packages/clang/cindex.py", line 2699, in create
    return Index(conf.lib.clang_createIndex(excludeDecls, 0))
  File "/usr/local/lib/python3.7/site-packages/clang/cindex.py", line 212, in __get__
    value = self.wrapped(instance)
  File "/usr/local/lib/python3.7/site-packages/clang/cindex.py", line 4147, in lib
    lib = self.get_cindex_library()
  File "/usr/local/lib/python3.7/site-packages/clang/cindex.py", line 4178, in get_cindex_library
    raise LibclangError(msg)
clang.cindex.LibclangError: dlopen(/usr/local/lib/python3.7/site-packages/clang/native/libclang.dylib, 6): no suitable image found.  Did find:
    /usr/local/lib/python3.7/site-packages/clang/native/libclang.dylib: unknown file type, first eight bytes: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    /usr/local/lib/python3.7/site-packages/clang/native/libclang.dylib: unknown file type, first eight bytes: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00. To provide a path to libclang use Config.set_library_path() or Config.set_library_file().

also running file on it gives "data"

However with libclang==10.0.1.0 it works find and also file identifies the file as: Mach-O 64-bit dynamically linked shared library x86_64

🙏

sighingnow commented 3 years ago

Hi @michael-go, thanks for telling me that. I will fix the pypi package ASAP.

sighingnow commented 3 years ago

Hi @michael-go, thanks for letting me know that. I will fixes the pypi package ASAP.

sighingnow commented 3 years ago

Hi @michael-go,

The file is corrupted due to the package was made by bsdtar on Mac and then extracted by gun-tar when uploading to pypi. That has been fixed by https://github.com/sighingnow/libclang/commit/502f79fa78ed4cb9f36613a40ec52db53889e8a9.

A new wheel package for Mac has been uploaded to pypi, you can upgrade to that version with the following command:

pip3 install -U libclang

You may also need to avoid the lag in mirrors:

pip3 install -U libclang -i https://pypi.org/simple
michael-go commented 3 years ago

Thanks - can confirm that version 11 works now 🙏

sighingnow commented 3 years ago

Thanks - can confirm that version 11 works now 🙏

Thanks for providing the information!