Code Monkey home page Code Monkey logo

Comments (6)

tqblack avatar tqblack commented on July 29, 2024 4

Definitely was a user error on the above comment, but to fix the clang error all I did was open the code_tokenizer.py file and replace line 24 with this, save and exit. --> clang.cindex.Config.set_library_file('/usr/lib/x86_64-linux-gnu/libclang-6.0.so.1')

This worked for me and I was able to get some output.

from transcoder.

tqblack avatar tqblack commented on July 29, 2024 1

Tried both methods, still throwing this error:

`Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/clang/cindex.py", line 4129, in get_cindex_library
library = cdll.LoadLibrary(self.get_filename())
File "/usr/lib/python3.6/ctypes/init.py", line 426, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python3.6/ctypes/init.py", line 348, in init
self._handle = _dlopen(self._name, mode)
OSError: /path/to/lib/clang/libclang-11.so/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 "TransCoder/translate.py", line 24, in
import preprocessing.src.code_tokenizer as code_tokenizer
File "/content/TransCoder/preprocessing/src/code_tokenizer.py", line 29, in
idx = clang.cindex.Index.create()
File "/usr/local/lib/python3.6/dist-packages/clang/cindex.py", line 2666, in create
return Index(conf.lib.clang_createIndex(excludeDecls, 0))
File "/usr/local/lib/python3.6/dist-packages/clang/cindex.py", line 198, in get
value = self.wrapped(instance)
File "/usr/local/lib/python3.6/dist-packages/clang/cindex.py", line 4103, in lib
lib = self.get_cindex_library()
File "/usr/local/lib/python3.6/dist-packages/clang/cindex.py", line 4134, in get_cindex_library
raise LibclangError(msg)
clang.cindex.LibclangError: /path/to/lib/clang/libclang-11.so/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().`

from transcoder.

QuentinN42 avatar QuentinN42 commented on July 29, 2024

According to @brozi first commit if libclang-11.so isn't located on /usr/lib/llvm-7/lib/ you must modify ./preprocessing/src/code_tokenizer.py at line 24 from

clang.cindex.Config.set_library_path('/usr/lib/llvm-7/lib/')

To :

clang.cindex.Config.set_library_path("/path/to/lib/clang/libclang-11.so")

from transcoder.

brozi avatar brozi commented on July 29, 2024

I don't know if you managed to fix your problem but you can also try to downgrade the clang package to version 6.0.0.2 and then locate libclang.so if it is not in /usr/lib/llvm-7/lib/

pip install clang==6.0.0.2

from transcoder.

AheadYoung avatar AheadYoung commented on July 29, 2024

line 24
clang.cindex.Config.set_library_file('/usr/lib/x86_64-linux-gnu/libclang-6.0.so.1')

and Comment out line 30
#idx = clang.cindex.Index.create()

from transcoder.

malachaux avatar malachaux commented on July 29, 2024

This repo is now deprecated. Please now refer to our new repository https://github.com/facebookresearch/CodeGen, which solves this issue. Does not use clang anymore !

from transcoder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.