<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>48566</bug_id>
          
          <creation_ts>2023-11-23 15:39:10 +0300</creation_ts>
          <short_desc>Ошибка при запуске .py файла для теста модуля</short_desc>
          <delta_ts>2023-11-24 11:37:32 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>python3-module-clang</component>
          <version>unstable</version>
          <rep_platform>x86_64</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P5</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Величко София">velichkosp</reporter>
          <assigned_to name="Anton Vyatkin">smith.toni91</assigned_to>
          <cc>glebfm</cc>
    
    <cc>kotopesutility</cc>
    
    <cc>lakostis</cc>
    
    <cc>root</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>237726</commentid>
    <comment_count>0</comment_count>
    <who name="Величко София">velichkosp</who>
    <bug_when>2023-11-23 15:39:10 +0300</bug_when>
    <thetext>python3-module-clang-15.0.6.1-alt1.noarch

Alt Education 10.2-x86-64-kde
Alt Kworkstation 10.2.1 x86-64
Alt Workstation 10.1 x86-64
Alt Education 10.2-x86-64
Alt Server 10.1-x86-64

Шаги воспроизведения: 
1. Создать файл тестовый файл test.cpp со следующим содержимым :
#include &lt;iostream&gt;
using namespace std;
                
int main()                        
{                                 
    cout &lt;&lt; &quot;Hello World!&quot;;  
    return 0;                   
}                             

2. Создать файл test-clang.py для теста библиотеки  python3-module-clang  со следующим содержимым :

import clang.cindex
import typing

index = clang.cindex.Index.create()
translation_unit = index.parse(&apos;test-clang.cpp&apos;, args=[&apos;-std=c++17&apos;])

def filter_node_list_by_node_kind(
    nodes: typing.Iterable[clang.cindex.Cursor],
    kinds: list
) -&gt; typing.Iterable[clang.cindex.Cursor]:
    result = []

    for i in nodes:
        if i.kind in kinds:
            result.append(i)

    return result

all_classes = filter_node_list_by_node_kind(translation_unit.cursor.get_children(), [clang.cindex.CursorKind.CLASS_DECL, clang.cindex.CursorKind.STRUCT_DECL])

for i in all_classes:
    print (i.spelling)

3. Запустить файл для теста python3-module-clang :
$ python3 test-clang.py

Ожидаемый результат : В консоли появляется вывод с анализом исходного кода по AST
Реальный результат : Ошибка, невозможно найти файл libclang.so, хотя он присутствует
Вывод в консоли : 
Traceback (most recent call last):
  File &quot;/usr/lib/python3/site-packages/clang/cindex.py&quot;, line 4293, in get_cindex_library
    library = cdll.LoadLibrary(self.get_filename())
  File &quot;/usr/lib64/python3.9/ctypes/__init__.py&quot;, line 452, in LoadLibrary
    return self._dlltype(name)
  File &quot;/usr/lib64/python3.9/ctypes/__init__.py&quot;, line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libclang.so: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File &quot;/usr/lib/llvm-11.0/lib64/clang-test-so.py&quot;, line 3, in &lt;module&gt;
    index = clang.cindex.Index.create()
  File &quot;/usr/lib/python3/site-packages/clang/cindex.py&quot;, line 2819, in create
    return Index(conf.lib.clang_createIndex(excludeDecls, 0))
  File &quot;/usr/lib/python3/site-packages/clang/cindex.py&quot;, line 212, in __get__
    value = self.wrapped(instance)
  File &quot;/usr/lib/python3/site-packages/clang/cindex.py&quot;, line 4267, in lib
    lib = self.get_cindex_library()
  File &quot;/usr/lib/python3/site-packages/clang/cindex.py&quot;, line 4298, in get_cindex_library
    raise LibclangError(msg)
clang.cindex.LibclangError: libclang.so: cannot open shared object file: No such file or directory. To provide a path to libclang use Config.set_library_path() or Config.set_library_file().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>237729</commentid>
    <comment_count>1</comment_count>
    <who name="Величко София">velichkosp</who>
    <bug_when>2023-11-23 15:58:17 +0300</bug_when>
    <thetext>Дополнительная информация :
  1. Ошибка так же воспроизводится с версией llvm15.0
  2. Файл libclang.so лежит в каталоге /usr/lib/llvm-15.0/lib64/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>237769</commentid>
    <comment_count>2</comment_count>
    <who name="Anton Vyatkin">smith.toni91</who>
    <bug_when>2023-11-24 11:37:32 +0300</bug_when>
    <thetext>https://git.altlinux.org/tasks/334997/
Пофиксил. Проверил. Работает.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>