본문 바로가기

Language/python

python-clang 설정관련

Ubuntu 18.04 64bit 작업중...


1. libclang.so 못찾을때

ppiazi@ppiazi-VirtualBox:~/work/clang-example$ python3 cindex-includes.py sample.cpp
Traceback (most recent call last):
  File "/home/ppiazi/.local/lib/python3.6/site-packages/clang/cindex.py", line 4129, in get_cindex_library
    library = cdll.LoadLibrary(self.get_filename())
  File "/home/ppiazi/miniconda3/lib/python3.6/ctypes/__init__.py", line 426, in LoadLibrary
    return self._dlltype(name)
  File "/home/ppiazi/miniconda3/lib/python3.6/ctypes/__init__.py", line 348, 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 "cindex-includes.py", line 55, in <module>
    main()
  File "cindex-includes.py", line 30, in main
    index = Index.create()
  File "/home/ppiazi/.local/lib/python3.6/site-packages/clang/cindex.py", line 2666, in create
    return Index(conf.lib.clang_createIndex(excludeDecls, 0))
  File "/home/ppiazi/.local/lib/python3.6/site-packages/clang/cindex.py", line 198, in __get__
    value = self.wrapped(instance)
  File "/home/ppiazi/.local/lib/python3.6/site-packages/clang/cindex.py", line 4103, in lib
    lib = self.get_cindex_library()
  File "/home/ppiazi/.local/lib/python3.6/site-packages/clang/cindex.py", line 4134, 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().


 - https://rpsene.com/2017/03/03/linux-libclang-on-ubuntu/