-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Binding LLVM itself #172
Comments
I have not tried binding LLVM itself but it sounds like an interesting project! - on issue itself: it sounds like Binder is not processing |
here is my
(lol) The header is actually part of the CIRCT project (which sits on top of LLVM and uses much of the same infrastructure). It contains includes for the Here is my script that runs binder
I have instrumented binder (mostly putting back in your debug prints) to try to debug - print log is here. The final error generated by binder is
which if you consult the log file, is actually successfully "discovered" and "
If you'd like I can put together a MWE somewhere but I'm sure if you try to bind anything in LLVM itself you'll probably get similar failure modes. |
@makslevental all-include.hpp should absolutely have include files for all types that you planning to bind. Just includes with forward declarations will not do: - full declarations will be needed. Hope this helps, |
...i think you understand that for LLVM that will end up being every single header in the build directory? Is this really a limitation of clangast (it can't parse headers to find more headers) or are you imposing this limitation? Also this won't work even if you try (I've tried) because |
@makslevental I am not sure if fully understand you question but I guess we can say that this is limitation of whole technology in general: you see, - in order to generate bindings we have to know full information about classes. Particularly we have to know each member function type signature. We do not need however to know implementation of the functions includes with such information could be omitted. To summarize: in order to generate Python bindings Binder have to parse full class definition of C++ classes, - there is no way around it. |
@lyskov I understand that you need full class definitions. I'm asking whether you really need to include all of the headers by hand in
So I'm asking whether clangast can discover |
oh, i see what you asking, let me rephrase my answer: parsing @makslevental does this answer your question? |
@lyskov Yes that clears up your comment but still leads me to be confused about why this is failing in this case? Can you suggest maybe something I could try to try to debug? Like I said I've already tried uncommenting some of your debug statements but I still couldn't quite figure out what the failure mode was. |
@lyskov Here's a reproducible failure assuming you have LLVM somewhere (should be a safe assumption 🤣):
|
ok, i just re-read whole conversation and i think i understand a bit better whats going on. Let me summarize:
In short: as i mention include file should contain all declarations. If you are getting forward declaration error this will be from LLVM parser level (ie before Binder have chance to work on it). And that should be addressed first. I see that your includes actually do have .imp includes though. Have you checked the include files in question? Does they actually contain output that you need? Also, from the log file that you posted it is unclear what errors you run into (if any). Could you please re-run this with unmodified version of Binder and post log file? (if you going to share using GDrive please make sure to use .txt extension so it is possible to view files without downloading them - thanks,) |
I'm not sure how to explain more clearly what's happening (since I posted a MWE). So I'll try again: Here is the error that unmodified (master tip) binder produces:
Here is a
Here is my
Here is my script that uses all the correct
Note that the full path for
I don't know what else to tell you and I also don't know how this is failing. EDIT: If I fullpath include
|
Thank you for info @makslevental ! I think i got the idea of what might be going on here. Could you please try to explicitly disable bindings for As i mentioned before: have you checked that full declaration of class |
I have answered this question in 10 different ways by now. I will answer again for the final time:
Thank you for the project but at this point I'm moving on. |
@makslevental i understand your frustration but please try to look at this from maintainer point of view: it is really impossible for one to read through all code of someone else projects which generate bugs (at least if you do not have infinite time which i do not!). The only realistic way this could work if bug reporter take time to isolate bug and provide minimal example that is easy reproduce and work with, - preferably single .hpp file with just a few class definitions. Please note that such minimal example can not be just bash script that links to LLVM sources tree (which by no means minimum!). I will be more then happy to debug (and fix if possible) this issue for you if you will take time to do that. Thanks, Also, - thank you for linking LLVM files, - this makes debugging easier! Could you please post which LLVM version do you use for this? re issue in general: it is possible for Binder to not be able to sort types so they could be bound without breaking dependencies. Example of this will be due to types circular dependencies. As i mention above simplest solution will be to disable bindings for one of such classes. |
Thanks for building this - it's very useful. One question: have you tried to use binder to bind to LLVM itself? I've tried and run into forward decl issues (ie binder only finds forward decls and not the actual impls that are buried in various
.inc
files).The text was updated successfully, but these errors were encountered: