Editing User:Krajkreddy/GSOC14/summary

From BRL-CAD

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 164: Line 164:
 
*created a dummy example of the code and it works fine. https://github.com/raj12lnm/TryPyBindGen
 
*created a dummy example of the code and it works fine. https://github.com/raj12lnm/TryPyBindGen
  
'''''Summary : Have the ability to parse a C++ header and create a wrapped library for it. Next I will move to wrapping the Giant .. the OpenNurbsLibrary in Python. :D
+
'''''Summary : Have the ability to parse a C++ header and create a wrapped library for it. Next I will move to wrapping the Giant .. the OpenNurb
 
 
'''''July 26
 
*wrote a c++ example in the pybindgen example. Looks like this is working fine.
 
*Tried parsing C++ header of OpenNurbs using pybindgen.
 
*looks like there is some issue here.
 
*The issue currently is as follows.
 
There are multiple symbols in different headers and gccxml is not able to gather information regarding the ones which depend on each other. For example the paste here http://tny.cz/8008c460 tells us how when parsing a file has given issues.
 
 
 
'''''July 28 (Monday)
 
*Found that Pybindgen requires a single header.
 
*Instead of automating it, used a frugal way by concating the header files in such a way that the order is topologically sorted in the dependency graph.
 
*While Parsing the header using Pybindgen I get an error.
 
*There is a bug at which I am stuck http://tny.cz/be8180ca.
 
*Since the header file is several lines(>65K) long all, Thus the parsing takes a long time. And the bug is somewhere at the end. All my efforts went in vain today.
 
*I have added the repository here https://github.com/raj12lnm/OpenNurbs-Python
 
**Installing the repository
 
***Install Pygccxml 1.0 from here https://launchpad.net/ubuntu/+source/pygccxml/1.0.0-4 (1.0 is supported by PyBindGen)
 
***Install Pybindgen bzr checkout https://code.launchpad.net/~gjc/pybindgen/trunk
 
***use python mymodule_gen.py > mymodulegen.py
 
***mkdir build
 
***python setup build
 
*Currently build will be successful but not correct, some symbols will be mismatched.
 
'''''July 29 (Tuesday)
 
* Continued to work on the error using breakpoints and manual code outputs. But failed to find the part of the header file which is producing this error.
 
'''''July 30 (Wednesday)
 
*Found the issue in the header file which prompts the above error.
 
*It is just the NULL default value for an integer type pointer.
 
*I have created a small example here https://github.com/raj12lnm/TryPyBindGen
 
*On digging the code although I could not find the exact issue but it has something to do with ctypes. Also, other pointers with 'NULL' default works fine.
 
*So know I have details of all the classes, methods their parameters, enums etc.
 
*Next step is to create a cpp file from this information and build the library.
 
'''''July 31 (Thursday)
 
*I get numerous build errors
 
*I have listed them here http://tny.cz/896562a1
 
*Looks like there are some issues to handle private keyword in pybindgen.
 
*I tried to look at the internal of the code and it turns out that pybindgen ignores private and protected methods.
 
*Reported the error to pybindgen developers.
 
'''''August 1 (Friday)
 
*Debugged the setup files and corrected the error for unitialized variables.
 
*On further looking, PBG has a way to ignore private and protected methods of classes, but it is somehow failing in the case of OpenNurbs's case.
 
*Also, Discussed about provisisons to initiated a way to wrap important classes of OpenNurbs in Python with Bryan(kanzure) on IRC.
 
 
 
'''''August 2 (Saturday)
 
 
 
I have sampled all the errors from the build http://tny.cz/802fe6f9.
 
 
 
The build mainly contains following types of errors from PBG(PyBindGen). They are :
 
*‘retval’ was not declared in this scope : In some functions/methods the sudo retval is not declared.
 
*Private methods are wrapped
 
* error: assignment of read-only variable :
 
*Call of overloaded functions.
 
*cannot find members in some struct which are used.
 
I tried to get into PBG source code to find the reason for these. But it looks like I will require some more time to understand PBG.
 
Also In the meanwhile I notified the developers of PBG regarding the status.
 
 
 
'''''August 4 (Monday)
 
*Worked with one of the developer of PBG.
 
*Now one of the error where const double and float pointers were causing errors are solved.
 
'''''August 5 (Tuesday)
 
*Worked on two errors which PBG is causing for C++ code.
 
**Inability to wrap overloaded functions
 
**wrapping of private methods.
 
All though couldnot understand how private method wrapping can be avoided by PBG. But there are few overloading functions. My plan is to manually change the overloading functions in the produced cpp file. (Although this might cause an issue because of large number but cannot find an alternative.)
 
 
 
 
 
'''''August 6 (Wednesday)
 
*I spend my time today mainly working on the issue of overloaded functions.
 
*As suggested by the PBG developer(by personnel email), I  checked the pybindgen.gccxmlparser module but could not find any issue.
 
*Later on diging the code of OpenNurbs I found that all the overloaded functions which were causing the issue were private constructors mainly used for singleton pattern
 
*Also Interestingly all these private constructors didnt have definitions as well.
 
*Thus I removed them manually from the auto generated c++ file.
 
 
 
 
 
'''''August 7 (Thursday)
 
*One of the error I the PBG was regarding retval which is an internal parameter in many functions. This was an error in PBG. Now resolved.
 
*Errors have majorily shrinked now by taking care of the above issues.
 
*Now the major errors are here http://tny.cz/2ed6eadc
 
*There are main two types of error left.
 
##Accessing of symbols from union which is not supported by PBG.
 
##Also overloading functions in string class of opennurbs.
 
 
 
'''''August 8 (Friday)
 
*While Compiling I received many errors related to overloading of functions.
 
*I have seen that these are in ON_String and ON_wString class.
 
*These are mainly created due to excessive overloading of methods.
 
*I have removed some redundant overloaded functions from these classes and now these work.
 
 
 
'''''August 9 (Saturday)
 
*Since Union is not supported by PBG, therefore the generated file creates error issues while compiling.
 
*In OpenNurbs library there is an instance of union in a struct MAP_VALUE
 
*I have contacted the developer of PBG. They have suggested on mannually changing the generated c++ code.
 
*I have thus manually changed the c++ code wherever there are instances of the struct.
 
*And thus now the struct errors are eliminated.
 
 
 
'''''August 11 (Monday)
 
*Now everything compiles perfectly.
 
*But on loading the compiled library in a python shell I lot of symbols are not defined.
 
*I found that BRL_CAD main repository removes the OpenGL dependencies thus I also removed them
 
*The problem on diagnosis turned out that, some functions in OpenNurbs have only declarations and lack definitions. This is indeed a common practice by c++ developers.
 
*But Since pybindgen only scans header files thus the undefined symbols creep in.
 
*I have removed such declarations. And it works well.
 
 
 
'''Suggested 'pencils down' date'''
 
 
 
End term summary is [[User:Krajkreddy/GSOC14/end_term_summary|here]]
 

Please note that all contributions to BRL-CAD may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see BRL-CAD:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)