cstyle
cstyle copied to clipboard
issues running cstyle in git-bash with Windows 10
Hi,
I am facing some issues trying to use the tool with git bash terminal for WIndows 10.
First, there is a dependency issue:
$ pip3 install python-clang
ERROR: Could not find a version that satisfies the requirement python-clang (from versions: none)
ERROR: No matching distribution found for python-clang
I installed clang instead.
$ pip3 list | grep clang
clang 14.0
clang-format 15.0.4
libclang 14.0.6
Then, I add to make the following patch in cstyle.py to find the libclang dll:
clang.cindex.Config.set_library_file('C:/Program Files/LLVM/bin/libclang.dll')
But it is failing:
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\clang\cindex.py", line 4161, in register_function
func = getattr(lib, item[0])
File "C:\Python310\lib\ctypes\__init__.py", line 387, in __getattr__
func = self.__getitem__(name)
File "C:\Python310\lib\ctypes\__init__.py", line 392, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'clang_CompileCommand_getFilename' not found. Did you mean: 'clang_CompileCommand_getDirectory'?
During handling of the above exception, another exception occurred:
...
File "C:\Python310\lib\site-packages\clang\cindex.py", line 2793, in create
return Index(conf.lib.clang_createIndex(excludeDecls, 0))
File "C:\Python310\lib\site-packages\clang\cindex.py", line 212, in __get__
value = self.wrapped(instance)
File "C:\Python310\lib\site-packages\clang\cindex.py", line 4242, in lib
register_functions(lib, not Config.compatibility_check)
File "C:\Python310\lib\site-packages\clang\cindex.py", line 4189, in register_functions
register(f)
File "C:\Python310\lib\site-packages\clang\cindex.py", line 4186, in register
return register_function(lib, item, ignore_errors)
File "C:\Python310\lib\site-packages\clang\cindex.py", line 4167, in register_function
raise LibclangError(msg)
clang.cindex.LibclangError: function 'clang_CompileCommand_getFilename' not found. Please ensure that your python bindings are compatible with your libclang.so version.