GithubHelp home page GithubHelp logo

Comments (14)

XVilka avatar XVilka commented on July 18, 2024

If you can point me in the place in the code where it handled - I can try to fix/improve by myself. Thank you!

from ctypeslib.

trolldbois avatar trolldbois commented on July 18, 2024

that seems to be an llvm/clang error message. the most probable explanation is that the include path does not contain the user headers' include folder.
try using --clang-args="-I/usr/your/path/to/headers/files/" ?

from ctypeslib.

XVilka avatar XVilka commented on July 18, 2024

added those, doesn't seem to help. See how I did it in my script http://xvilka.me/genbind.py.txt

from ctypeslib.

trolldbois avatar trolldbois commented on July 18, 2024

I confirm it's an include path issue.
@XVilka try clang_opts = ["-I/usr/local/include/libr/", "-I/usr/local/include/", "-I/usr/local/include/libr/include"]

From a clean radare2 git repo I was able to make the "angled error" disappear:

radare2$ clang2py ./libr/include/r_core.h --clang-args="-I ./libr/include/"

I do not know where your libr includes are installed, but if you add the folder containing r_userconf.h to the Include path, it works.

from ctypeslib.

XVilka avatar XVilka commented on July 18, 2024

@trolldbois all files are located in /usr/local/include/libr/, both r_core.h and r_userconf.h.

from ctypeslib.

trolldbois avatar trolldbois commented on July 18, 2024

XVilka, try to use clang to parse the radare headers.
clang-5.0 -E libr/include/r_core.h
That usually produces the error you reported because the include path is lacking.
The fix is :
clang-5.0 -E libr/include/r_core.h -I./libr/include/

So when you have a working clang command line, you will have a working ctypeslib command line

from ctypeslib.

XVilka avatar XVilka commented on July 18, 2024

Interesting thing that clang line works for me, while ctypeslib - doesn't.

from ctypeslib.

trolldbois avatar trolldbois commented on July 18, 2024

Can you reproduce an error with clang2py ?
Or are you saying your code that uses ctypeslib doesn't work ?
.

from ctypeslib.

trolldbois avatar trolldbois commented on July 18, 2024

Your code has the following error:
clangparser.Clang_Parser(flags = [])

Flags should not be empty.

from ctypeslib.

XVilka avatar XVilka commented on July 18, 2024

@trolldbois took a line from your examples.

from ctypeslib.

XVilka avatar XVilka commented on July 18, 2024

@trolldbois yes, if I call clang2py --clang-args="-I/usr/local/include/libr" /usr/local/include/libr/r_core.h everything works OK. Very strange.

from ctypeslib.

trolldbois avatar trolldbois commented on July 18, 2024

So if you change your code a bit like this https://gist.github.com/trolldbois/af7fee01b1afa13a74c196fefceeda93 it will work .

The clang parser is the class that need the Include command line options. Not the code generator.
Can you point me to the example you used so I can double check it on my side ?

from ctypeslib.

XVilka avatar XVilka commented on July 18, 2024

@trolldbois Thank you! That indeed solved the issue. Can't find where I saw this, maybe I just misread it...

from ctypeslib.

trolldbois avatar trolldbois commented on July 18, 2024

Great !

from ctypeslib.

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.