-
Notifications
You must be signed in to change notification settings - Fork 45
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
KeyError 'file' when using pyplusplus #32
Comments
Hi thank you very much for the feedback. First, are you on OS X, Linux or Windows, and what compiler do you use ? As you have seen, there is already a mechanism to skip some fields that have no I would prefer to investigate the case more in depth before blindly skipping everything which has not a For this I will try to create a test to reproduce your case. Would it be possible to reduce you c++ code to a minimalistic example which demonstrate the failures ? This would really help. You can have a look at the first pygccxml example to write a small test case: http://pygccxml.readthedocs.org/en/develop/examples/parsing/example.html You can also give me the full file if you don't have time, I will trim it down to find the problem. Also, I will be able to look directly at the full xml file, which will greatly help. |
Well, looks like environment problem? I'm using Linux, ubuntu14.04. castxml --version CastXML project maintained and supported by Kitware (kitware.com). clang version 3.9.0 (trunk 259983) (llvm/trunk 259980) using the latest pygccxml. clang --version gcc --version I tried the first example as http://pygccxml.readthedocs.org/en/develop/examples/parsing/example.html $ python example.py |
Okay I also have a Ubuntu 14.04, and gcc 4.8.4. My castxml was compiled with llvm 3.6.1. I could not reproduce the problems. I'll need to upgrade to llvm 3.9 then. I need to move stuff around in my root folder because I am starting to have a lot of compilers there. I hope I can do this tomorrow evening, and install the latest compiler. I'll keep you updated of my findings. |
Ok this is weird. I could reproduce the error and analysed it as much I could. The problem comes from llvm 3.9 (trunk). I will not write code to support a development version of llvm. This is a moving target ... I am cross-checking this with the CastXML developer (maybe we need to fix this in CastXML; or more probably in LLVM). At least we caught a problem before the llvm release with you help. For the moment you need to rely on llvm >= 3.8.0. I think this is more reasonable. With this version it should work (I only tested 3.6 and 3.7, but 3.8.0 should be OK). Of course this bug will stay open while I gather more information and try to get this fixed. |
The missing field names on |
The fields without file defintion have been added to the list of tags which need to be skipped.
Thanks. I still need to tweak things in pygccxml. When I am done I'll push v1.7.3 with the fixes for llvm 3.9. |
The fields without file defintion have been added to the list of tags which need to be skipped. Chery-picked from develop branch
All my patches are now on the v1.7.3 branch, which will be released soon. They have also been merged to develop. It should be usable now with the latest llvm. I'll close this bug, please open a new one if you have still problems. |
Hi I tried to use py++ to automatic wrap c++ files.
Using gccxml and pygccxml is ok, now I changed to use castxml, and I face below, seems in
def __read_location(self, decl, attrs):
'file' is not in attrs.
{'name': '', 'access': 'public', 'context': '_590', 'offset': '0', 'type': '_3541', 'id': '_1405'}
Traceback (most recent call last):
File "chg.py", line 8, in
,xml_generator_path='/usr/local/bin/castxml')
File "/usr/local/lib/python2.7/dist-packages/pyplusplus/module_builder/boost_python_builder.py", line 104, in init
, indexing_suite_version)
File "/usr/local/lib/python2.7/dist-packages/pyplusplus/module_builder/boost_python_builder.py", line 147, in __parse_declarations
decls = reader.read_files( files, compilation_mode )
File "build/bdist.linux-x86_64/egg/pygccxml/parser/project_reader.py", line 249, in read_files
File "build/bdist.linux-x86_64/egg/pygccxml/parser/project_reader.py", line 278, in __parse_file_by_file
File "build/bdist.linux-x86_64/egg/pygccxml/parser/source_reader.py", line 334, in read_file
File "build/bdist.linux-x86_64/egg/pygccxml/parser/source_reader.py", line 354, in read_cpp_source_file
File "build/bdist.linux-x86_64/egg/pygccxml/parser/source_reader.py", line 443, in __parse_xml_file
File "build/bdist.linux-x86_64/egg/pygccxml/parser/etree_scanner.py", line 56, in read
File "build/bdist.linux-x86_64/egg/pygccxml/parser/scanner.py", line 221, in startElement
File "build/bdist.linux-x86_64/egg/pygccxml/parser/scanner.py", line 274, in __read_location
KeyError: 'file'
I printed attrs
{'context': '_586', 'artificial': '1', 'access': 'public', 'location': 'f28:20', 'file': 'f28', 'inline': '1', 'line': '20', 'id': '_1403', 'name': 'Chg'}
{'file': 'f28', 'name': '=', 'mangled': 'ZN3ChgaSERKS', 'artificial': '1', 'access': 'public', 'returns': '_3982', 'location': 'f28:20', 'context': '_586', 'inline': '1', 'line': '20', 'id': '_1404'}
{'name': '', 'access': 'public', 'context': '_590', 'offset': '0', 'type': '_3541', 'id': '_1405'}
Traceback (most recent call last):
File "chg.py", line 8, in
,xml_generator_path='/usr/local/bin/castxml')
Here 'name' is empty and no 'file',
for a workaround, I modified this py file
After that for my simple c++ code, I can wrap correctly just as using gccxml.
The text was updated successfully, but these errors were encountered: