1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-12 18:59:50 +03:00
aports/main/clang20/py3-clang-add-version-to-so-name.patch
Marian Buschsieweke 23670b14d3 main/clang20: add so version to py3-clang20
As of now, running the following python code

    from clang import cindex
    cindex.Index.create()

fails with:

    [...]
    clang.cindex.LibclangError: Error loading shared library libclang.so:
    No such file or directory. To provide a path to libclang use
    Config.set_library_path() or Config.set_library_file().

This could be fixed by patching every user to call

    cindex.Config.set_library_file("/usr/lib/libclang.so.20.1.3")

before calling `cindex.Index.create()`. But adding the version of the
library to the expected file name to match the installed file saves us
this trouble.
2025-05-06 12:41:56 +00:00

15 lines
579 B
Diff

This aids in allocating libclang.so from cindex.py. We do not install
libclang.so without version into /usr/lib to allow installing multiple versions.
Therefor, cindex.py should search for the versioned file instead.
--- a/bindings/python/clang/cindex.py
+++ b/bindings/python/clang/cindex.py
@@ -4244,7 +4244,7 @@ class Config:
elif name == "Windows":
file = "libclang.dll"
else:
- file = "libclang.so"
+ file = "libclang.so.@@SOVER@@"
if Config.library_path:
file = Config.library_path + "/" + file