Error when running: "libclang.so: cannot open shared object file: No such file or directory"
First, I ran sudo apt-get install python-yaml and sudo pip install clang. Success.
Then I tried:
[dev@ubuntu:~/cncc (master)] $ ls
cncc examples LICENSE MyClass.cpp MyClass.h README.md util
[dev@ubuntu:~/cncc (master)] $ git log -1
commit 4529cb3536c7cec20ea0bb850d0f95e80cded733
Author: Daniel J. Hofmann <[email protected]>
Date: Wed Aug 19 14:55:48 2015 +0200
Respect global style file, closes #5
Local style files do not seem to make a lot sense. What we could do is
walk all parent directories like `clang-format` does, though.
[dev@ubuntu:~/cncc (master)] $ cat MyClass.h
class MyClass{
public:
void init(int a, int b);
int loopAlot();
private:
int var1, var2;
};
[dev@ubuntu:~/cncc (master)] $ cat MyClass.cpp
#include "MyClass.h"
void MyClass::init(int a, int b){
var1 = a;
var2 = b;
}
int MyClass::loopAlot(){
int res = this->var1 + var2;
for(int i=0; i<this->var1; ++i){
res = res + this->var2;
}
return res;
}
[dev@ubuntu:~/cncc (master)] $ ./cncc --style=examples/basic.style MyClass.cpp
Traceback (most recent call last):
File "./cncc", line 22, in <module>
index = I.create()
File "/usr/local/lib/python2.7/dist-packages/clang/cindex.py", line 2119, in create
return Index(conf.lib.clang_createIndex(excludeDecls, 0))
File "/usr/local/lib/python2.7/dist-packages/clang/cindex.py", line 141, in __get__
value = self.wrapped(instance)
File "/usr/local/lib/python2.7/dist-packages/clang/cindex.py", line 3429, in lib
lib = self.get_cindex_library()
File "/usr/local/lib/python2.7/dist-packages/clang/cindex.py", line 3460, 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().
Any idea what I'm doing wrong?
Sorry for not responding earlier, seems like I overlooked the notification.
You do not have a matching libclang native shared library for the Python wrapper that python-clang is supposed to wrap. I found PyPI to not provide wrappers compatible with every clang version. That is, check your clang --version, and then see if PyPI has a matching wrapper for this (I think the one for 3.6 was missing, and e.g. Ubuntu 15.04 comes with Clang 3.6).
That's the main reason this issue was never resolved.
The easiest way to install python-clang is by means of your package manager, e.g. aptitude on Debian-based systems.
Hi, for who have problem with python-clang, make a simbolic link for the same version of native clang and the python-bind: cd /usr/lib/x86_64-linux-gnu/ sudo ln -s libclang-3.8.so.1 libclang.so cheers []s